aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-family/ChangeLog4
-rw-r--r--gcc/c-family/stub-objc.c2
-rw-r--r--gcc/c-parser.c4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/parser.c16
-rw-r--r--gcc/objc/ChangeLog7
-rw-r--r--gcc/objc/objc-act.c58
8 files changed, 64 insertions, 37 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6165fdd..d6ce73141 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * c-parser.c (c_parser_objc_class_declaration): Updated call to
+ objc_declare_class.
+
2011-04-14 Richard Guenther <rguenther@suse.de>
* tree.h (get_object_alignment_1): Declare.
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index fb9d99d..4b47474 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * stub-objc.c (objc_declare_class): Updated argument name.
+
2011-04-12 Nathan Froyd <froydnj@codesourcery.com>
* c-common.h (c_common_init_ts): Declare.
diff --git a/gcc/c-family/stub-objc.c b/gcc/c-family/stub-objc.c
index 16f2931..6834721 100644
--- a/gcc/c-family/stub-objc.c
+++ b/gcc/c-family/stub-objc.c
@@ -110,7 +110,7 @@ objc_declare_alias (tree ARG_UNUSED (alias), tree ARG_UNUSED (orig))
}
void
-objc_declare_class (tree ARG_UNUSED (list))
+objc_declare_class (tree ARG_UNUSED (identifier))
{
}
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 0aefa42..8000b75 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -6994,7 +6994,6 @@ c_parser_objc_class_instance_variables (c_parser *parser)
static void
c_parser_objc_class_declaration (c_parser *parser)
{
- tree list = NULL_TREE;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_AT_CLASS));
c_parser_consume_token (parser);
/* Any identifiers, including those declared as type names, are OK
@@ -7010,7 +7009,7 @@ c_parser_objc_class_declaration (c_parser *parser)
return;
}
id = c_parser_peek_token (parser)->value;
- list = chainon (list, build_tree_list (NULL_TREE, id));
+ objc_declare_class (id);
c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_COMMA))
c_parser_consume_token (parser);
@@ -7018,7 +7017,6 @@ c_parser_objc_class_declaration (c_parser *parser)
break;
}
c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
- objc_declare_class (list);
}
/* Parse an objc-alias-declaration.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 271da0c..37b1071 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * parser.c (cp_parser_objc_class_declaration): Updated for change
+ in objc_declare_class().
+
2011-04-14 Nathan Froyd <froydnj@codesourcery.com>
* decl.c (poplevel): Use block_chainon.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 051c1c8..17f5850 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -21615,7 +21615,21 @@ static void
cp_parser_objc_class_declaration (cp_parser* parser)
{
cp_lexer_consume_token (parser->lexer); /* Eat '@class'. */
- objc_declare_class (cp_parser_objc_identifier_list (parser));
+ while (true)
+ {
+ tree id;
+
+ id = cp_parser_identifier (parser);
+ if (id == error_mark_node)
+ break;
+
+ objc_declare_class (id);
+
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+ cp_lexer_consume_token (parser->lexer);
+ else
+ break;
+ }
cp_parser_consume_semicolon_at_end_of_statement (parser);
}
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index c2f6769..f39cb0a 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,10 @@
+2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-act.c (objc_declare_class): Changed to take a single
+ identifier as argument instead of a tree list. This means callers
+ don't have to build temporary tree lists to call this function.
+ (synth_module_prologue): Updated calls to objc_declare_class.
+
2011-04-13 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (build_keyword_selector): Use get_identifier_with_length
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 4194621..c68f628 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -2953,7 +2953,7 @@ synth_module_prologue (void)
/* Forward-declare '@interface Protocol'. */
type = get_identifier (PROTOCOL_OBJECT_CLASS_NAME);
- objc_declare_class (tree_cons (NULL_TREE, type, NULL_TREE));
+ objc_declare_class (type);
objc_protocol_type = build_pointer_type (xref_tag (RECORD_TYPE, type));
/* Declare receiver type used for dispatching messages to 'super'. */
@@ -2985,7 +2985,7 @@ synth_module_prologue (void)
if (!constant_string_class_name)
constant_string_class_name = runtime.default_constant_string_class_name;
constant_string_id = get_identifier (constant_string_class_name);
- objc_declare_class (tree_cons (NULL_TREE, constant_string_id, NULL_TREE));
+ objc_declare_class (constant_string_id);
/* Pre-build the following entities - for speed/convenience. */
self_id = get_identifier ("self");
@@ -3360,48 +3360,42 @@ objc_declare_alias (tree alias_ident, tree class_ident)
}
void
-objc_declare_class (tree ident_list)
+objc_declare_class (tree identifier)
{
- tree list;
#ifdef OBJCPLUS
if (current_namespace != global_namespace) {
error ("Objective-C declarations may only appear in global scope");
}
#endif /* OBJCPLUS */
- for (list = ident_list; list; list = TREE_CHAIN (list))
+ if (! objc_is_class_name (identifier))
{
- tree ident = TREE_VALUE (list);
-
- if (! objc_is_class_name (ident))
+ tree record = lookup_name (identifier), type = record;
+
+ if (record)
{
- tree record = lookup_name (ident), type = record;
-
- if (record)
+ if (TREE_CODE (record) == TYPE_DECL)
+ type = DECL_ORIGINAL_TYPE (record)
+ ? DECL_ORIGINAL_TYPE (record)
+ : TREE_TYPE (record);
+
+ if (!TYPE_HAS_OBJC_INFO (type)
+ || !TYPE_OBJC_INTERFACE (type))
{
- if (TREE_CODE (record) == TYPE_DECL)
- type = DECL_ORIGINAL_TYPE (record)
- ? DECL_ORIGINAL_TYPE (record)
- : TREE_TYPE (record);
-
- if (!TYPE_HAS_OBJC_INFO (type)
- || !TYPE_OBJC_INTERFACE (type))
- {
- error ("%qE redeclared as different kind of symbol",
- ident);
- error ("previous declaration of %q+D",
- record);
- }
+ error ("%qE redeclared as different kind of symbol",
+ identifier);
+ error ("previous declaration of %q+D",
+ record);
}
-
- record = xref_tag (RECORD_TYPE, ident);
- INIT_TYPE_OBJC_INFO (record);
- /* In the case of a @class declaration, we store the ident
- in the TYPE_OBJC_INTERFACE. If later an @interface is
- found, we'll replace the ident with the interface. */
- TYPE_OBJC_INTERFACE (record) = ident;
- hash_class_name_enter (cls_name_hash_list, ident, NULL_TREE);
}
+
+ record = xref_tag (RECORD_TYPE, identifier);
+ INIT_TYPE_OBJC_INFO (record);
+ /* In the case of a @class declaration, we store the ident in
+ the TYPE_OBJC_INTERFACE. If later an @interface is found,
+ we'll replace the ident with the interface. */
+ TYPE_OBJC_INTERFACE (record) = identifier;
+ hash_class_name_enter (cls_name_hash_list, identifier, NULL_TREE);
}
}