aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-parser.c
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-10-20 22:41:53 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-10-20 22:41:53 +0000
commit249a82c4c632bbba058b583d41b3829ae7e8f119 (patch)
treed92f3d904701bebb9ece6405dc79f58c575c78f0 /gcc/c-parser.c
parentf1e344ed754edda1085dfeecca07680119f3a67c (diff)
downloadgcc-249a82c4c632bbba058b583d41b3829ae7e8f119.zip
gcc-249a82c4c632bbba058b583d41b3829ae7e8f119.tar.gz
gcc-249a82c4c632bbba058b583d41b3829ae7e8f119.tar.bz2
In gcc/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (c_parser_objc_method_type): Mark inline. Return a bool instead of a tree. (c_parser_objc_method_decl): Added bool argument. Updated call to objc_build_method_signature. (c_parser_objc_method_definition): Do not call objc_set_method_type. Updated calls to c_parser_objc_method_type, c_parser_objc_method_decl and objc_start_method_definition. (c_parser_objc_methodproto): Do not call objc_set_method_type. Updated calls to c_parser_objc_method_type, c_parser_objc_method_decl and objc_add_method_declaration. In gcc/c-family/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com> * c-common.h (objc_set_method_type): Removed. (objc_add_method_declaration): Added boolean argument. (objc_start_method_definition): Same change. (objc_build_method_signature): Same change. * stub-objc.c (objc_set_method_type): Removed. (objc_add_method_declaration): Added boolean argument. (objc_start_method_definition): Same change. (objc_build_method_signature): Same change. In gcc/cp/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_method_type): Mark inline. Return a bool instead of calling objc_set_method_type. (cp_parser_objc_method_signature): Updated calls to cp_parser_objc_method_type and to objc_build_method_signature. (cp_parser_objc_method_prototype_list): Updated calls to objc_add_method_declaration. Use token->type to determine if it is a class method or not. (cp_parser_objc_method_definition_list): Same change. In gcc/objc/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.h (objc_inherit_code): Removed. * objc-act.c (objc_inherit_code): Removed. (objc_set_method_type): Removed. (objc_build_method_signature): Added is_class_method argument. Use it instead of the global objc_inherit_code variable. (objc_add_method_declaration): Same change. (objc_start_method_definition): Same change. (objc_generate_cxx_ctor_or_dtor): Updated call to objc_start_method_definition. Do not call objc_set_method_type. (adjust_type_for_id_default): Mark as inline. (objc_synthesize_getter): Updated call to objc_start_method_definition. Do not set objc_inherit_code. (objc_synthesize_setter): Updated call to objc_start_method_definition. Do not set objc_inherit_code. From-SVN: r165741
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r--gcc/c-parser.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index d234218..e4efd38 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -1067,11 +1067,11 @@ static void c_parser_objc_class_instance_variables (c_parser *);
static void c_parser_objc_class_declaration (c_parser *);
static void c_parser_objc_alias_declaration (c_parser *);
static void c_parser_objc_protocol_definition (c_parser *, tree);
-static enum tree_code c_parser_objc_method_type (c_parser *);
+static bool c_parser_objc_method_type (c_parser *);
static void c_parser_objc_method_definition (c_parser *);
static void c_parser_objc_methodprotolist (c_parser *);
static void c_parser_objc_methodproto (c_parser *);
-static tree c_parser_objc_method_decl (c_parser *, tree *);
+static tree c_parser_objc_method_decl (c_parser *, bool, tree *);
static tree c_parser_objc_type_name (c_parser *);
static tree c_parser_objc_protocol_refs (c_parser *);
static void c_parser_objc_try_catch_statement (c_parser *);
@@ -6889,19 +6889,21 @@ c_parser_objc_protocol_definition (c_parser *parser, tree attributes)
objc-method-type:
+
-
-*/
-static enum tree_code
+ Return true if it is a class method (+) and false if it is
+ an instance method (-).
+*/
+static inline bool
c_parser_objc_method_type (c_parser *parser)
{
switch (c_parser_peek_token (parser)->type)
{
case CPP_PLUS:
c_parser_consume_token (parser);
- return PLUS_EXPR;
+ return true;
case CPP_MINUS:
c_parser_consume_token (parser);
- return MINUS_EXPR;
+ return false;
default:
gcc_unreachable ();
}
@@ -6916,11 +6918,10 @@ c_parser_objc_method_type (c_parser *parser)
static void
c_parser_objc_method_definition (c_parser *parser)
{
- enum tree_code type = c_parser_objc_method_type (parser);
+ bool is_class_method = c_parser_objc_method_type (parser);
tree decl, attributes = NULL_TREE;
- objc_set_method_type (type);
parser->objc_pq_context = true;
- decl = c_parser_objc_method_decl (parser, &attributes);
+ decl = c_parser_objc_method_decl (parser, is_class_method, &attributes);
if (decl == error_mark_node)
return; /* Bail here. */
@@ -6938,7 +6939,7 @@ c_parser_objc_method_definition (c_parser *parser)
}
parser->objc_pq_context = false;
- if (objc_start_method_definition (decl, attributes))
+ if (objc_start_method_definition (is_class_method, decl, attributes))
{
add_stmt (c_parser_compound_statement (parser));
objc_finish_method_definition (current_function_decl);
@@ -7024,12 +7025,12 @@ c_parser_objc_methodprotolist (c_parser *parser)
static void
c_parser_objc_methodproto (c_parser *parser)
{
- enum tree_code type = c_parser_objc_method_type (parser);
+ bool is_class_method = c_parser_objc_method_type (parser);
tree decl, attributes = NULL_TREE;
- objc_set_method_type (type);
+
/* Remember protocol qualifiers in prototypes. */
parser->objc_pq_context = true;
- decl = c_parser_objc_method_decl (parser, &attributes);
+ decl = c_parser_objc_method_decl (parser, is_class_method, &attributes);
/* Forget protocol qualifiers now. */
parser->objc_pq_context = false;
@@ -7042,7 +7043,7 @@ c_parser_objc_methodproto (c_parser *parser)
}
if (decl != error_mark_node)
- objc_add_method_declaration (decl, attributes);
+ objc_add_method_declaration (is_class_method, decl, attributes);
c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
}
@@ -7115,7 +7116,7 @@ c_parser_objc_maybe_method_attributes (c_parser* parser, tree* attributes)
*/
static tree
-c_parser_objc_method_decl (c_parser *parser, tree *attributes)
+c_parser_objc_method_decl (c_parser *parser, bool is_class_method, tree *attributes)
{
tree type = NULL_TREE;
tree sel;
@@ -7206,7 +7207,7 @@ c_parser_objc_method_decl (c_parser *parser, tree *attributes)
if (attr_err)
return error_mark_node;
- return objc_build_method_signature (type, sel, parms, ellipsis);
+ return objc_build_method_signature (is_class_method, type, sel, parms, ellipsis);
}
/* Parse an objc-type-name.