aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authorIain Sandoe <iains@gcc.gnu.org>2010-09-28 21:02:38 +0000
committerIain Sandoe <iains@gcc.gnu.org>2010-09-28 21:02:38 +0000
commitf7e71da52f7d29cd3bdb81815026d0daf8bbbb9e (patch)
tree0b58ec78878b5ec817b8d9d6545ff6e30a03c52c /gcc/objc
parentf0a0390e691ece0d859b7d87c6e6617d227cb8dd (diff)
downloadgcc-f7e71da52f7d29cd3bdb81815026d0daf8bbbb9e.zip
gcc-f7e71da52f7d29cd3bdb81815026d0daf8bbbb9e.tar.gz
gcc-f7e71da52f7d29cd3bdb81815026d0daf8bbbb9e.tar.bz2
add parsing for ObjC* method & method parm attributes
gcc/cp: Partially merged from apple/trunk branch on FSF servers: 2006-04-26 Fariborz Jahanian <fjahanian@apple.com> Radar 3803157 (method attributes) * parser.c (cp_parser_objc_method_keyword_params): Handle attributes. (cp_parser_objc_method_tail_params_opt): Likewise. (cp_parser_objc_method_signature): Likewise. (cp_parser_objc_method_maybe_bad_prefix_attributes): New. (cp_parser_objc_method_prototype_list): Handle attributes. (cp_parser_objc_method_definition_list): Likewise. gcc/objc: * objc-act.c (objc_add_method_declaration): Handle attributes. (objc_start_method_definition): Likewise. (objc_generate_cxx_ctor_or_dtor): Pass NULL attributes to ctor/dtor. (objc_build_keyword_decl): Handle attributes. gcc: * c-parser.c (c_parser_declaration_or_fndef): Diagnose incorrect prefix attributes on methods. (c_parser_objc_method_definition): Handle attributes. (c_parser_objc_methodproto): Likewise. (c_parser_objc_maybe_method_attributes): New. (c_parser_objc_method_decl): Handle attributes, add a similar diagnostic to ObjC++ for a missing definition. gcc/c-family: * c-common.h: Update declarations to include attributes. * stub-objc.c: Likewise. testsuite: * objc.dg/attributes/method-attribute-1.m: New. * objc.dg/attributes/method-attribute-2.m: New. * obj-c++.dg/attributes/method-attribute-1.m: New. * obj-c++.dg/attributes/method-attribute-2.m: New. From-SVN: r164702
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/ChangeLog8
-rw-r--r--gcc/objc/objc-act.c27
2 files changed, 30 insertions, 5 deletions
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 7aa91dc..26be691 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,11 @@
+2010-09-28 Iain Sandoe <iains@gcc.gnu.org>
+
+ * objc-act.c (objc_add_method_declaration): Handle and ignore
+ attributes.
+ (objc_start_method_definition): Likewise.
+ (objc_generate_cxx_ctor_or_dtor): Pass NULL attributes to ctor/dtor.
+ (objc_build_keyword_decl): Handle and ignore attributes.
+
2010-09-28 Richard Henderson <rth@redhat.com>
* objc-act.c (objc_eh_personality): Use targetm.except_unwind_info.
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 67e9b51..02c60ab 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -769,7 +769,7 @@ objc_build_method_signature (tree rettype, tree selector,
}
void
-objc_add_method_declaration (tree decl)
+objc_add_method_declaration (tree decl, tree attributes)
{
if (!objc_interface_context)
{
@@ -780,6 +780,11 @@ objc_add_method_declaration (tree decl)
fatal_error ("method declaration not in @interface context");
}
+ if (attributes)
+ warning_at (input_location, OPT_Wattributes,
+ "method attributes are not available in this version"
+ " of the compiler, (ignored)");
+
objc_add_method (objc_interface_context,
decl,
objc_inherit_code == CLASS_METHOD_DECL);
@@ -789,7 +794,7 @@ objc_add_method_declaration (tree decl)
'false' if not (because we are outside an @implementation context).
*/
bool
-objc_start_method_definition (tree decl)
+objc_start_method_definition (tree decl, tree attributes)
{
if (!objc_implementation_context)
{
@@ -797,6 +802,11 @@ objc_start_method_definition (tree decl)
return false;
}
+ if (attributes)
+ warning_at (input_location, OPT_Wattributes,
+ "method attributes are not available in this version"
+ " of the compiler, (ignored)");
+
#ifndef OBJCPLUS
/* Indicate no valid break/continue context by setting these variables
to some non-null, non-label value. We'll notice and emit the proper
@@ -4644,7 +4654,7 @@ objc_generate_cxx_ctor_or_dtor (bool dtor)
? TAG_CXX_DESTRUCT
: TAG_CXX_CONSTRUCT),
make_node (TREE_LIST),
- false));
+ false), NULL);
body = begin_function_body ();
compound_stmt = begin_compound_stmt (0);
@@ -5976,6 +5986,7 @@ adjust_type_for_id_default (tree type)
In: key_name, an "identifier_node" (optional).
arg_type, a "tree_list" (optional).
arg_name, an "identifier_node".
+ attributes, a optional tree containing param attributes.
Note: It would be really nice to strongly type the preceding
arguments in the function prototype; however, then I
@@ -5984,10 +5995,16 @@ adjust_type_for_id_default (tree type)
Out: an instance of "keyword_decl". */
tree
-objc_build_keyword_decl (tree key_name, tree arg_type, tree arg_name)
+objc_build_keyword_decl (tree key_name, tree arg_type,
+ tree arg_name, tree attributes)
{
tree keyword_decl;
+ if (attributes)
+ warning_at (input_location, OPT_Wattributes,
+ "method parameter attributes are not available in this "
+ "version of the compiler, (ignored)");
+
/* If no type is specified, default to "id". */
arg_type = adjust_type_for_id_default (arg_type);
@@ -8128,7 +8145,7 @@ encode_array (tree type, int curtype, int format)
tree an_int_cst = TYPE_SIZE (type);
tree array_of = TREE_TYPE (type);
char buffer[40];
-
+
if (an_int_cst == NULL)
{
/* We are trying to encode an incomplete array. An incomplete