aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc/objc-gnu-runtime-abi-01.c
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2020-10-24 09:48:44 +0100
committerIain Sandoe <iain@sandoe.co.uk>2020-11-01 20:28:57 +0000
commitbb93020ff852fb159bc329bbaea12a33a4ef6761 (patch)
tree3e568e503293dc71ed8c26a6eb95dff25945d1bc /gcc/objc/objc-gnu-runtime-abi-01.c
parent7a2cc1e8438ee853900f20880ca8858c17486b10 (diff)
downloadgcc-bb93020ff852fb159bc329bbaea12a33a4ef6761.zip
gcc-bb93020ff852fb159bc329bbaea12a33a4ef6761.tar.gz
gcc-bb93020ff852fb159bc329bbaea12a33a4ef6761.tar.bz2
Objective-C : Implement SEL as a built-in typedef.
The reference implementation for Objective-C provides the SEL typedef (although it is also available from <objc/objc.h>). gcc/objc/ChangeLog: * objc-act.c (synth_module_prologue): Get the SEL identifier. * objc-act.h (enum objc_tree_index): Add OCTI_SEL_NAME. (objc_selector_name): New. (SEL_TYPEDEF_NAME): New. * objc-gnu-runtime-abi-01.c (gnu_runtime_01_initialize): Initialize SEL typedef. * objc-next-runtime-abi-01.c (next_runtime_01_initialize): Likewise. * objc-next-runtime-abi-02.c gcc/testsuite/ChangeLog: * obj-c++.dg/SEL-typedef.mm: New test. * objc.dg/SEL-typedef.m: New test.
Diffstat (limited to 'gcc/objc/objc-gnu-runtime-abi-01.c')
-rw-r--r--gcc/objc/objc-gnu-runtime-abi-01.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/objc/objc-gnu-runtime-abi-01.c b/gcc/objc/objc-gnu-runtime-abi-01.c
index 25c0e01..ac9a862 100644
--- a/gcc/objc/objc-gnu-runtime-abi-01.c
+++ b/gcc/objc/objc-gnu-runtime-abi-01.c
@@ -208,6 +208,13 @@ static void gnu_runtime_01_initialize (void)
type = build_qualified_type (type, TYPE_QUAL_CONST);
objc_selector_type = build_pointer_type (type);
+ /* SEL typedef. */
+ type = lang_hooks.decls.pushdecl (build_decl (input_location,
+ TYPE_DECL,
+ objc_selector_name,
+ objc_selector_type));
+ TREE_NO_WARNING (type) = 1;
+
/* typedef id (*IMP)(id, SEL, ...); */
ftype = build_varargs_function_type_list (objc_object_type,
objc_object_type,