parser.h: Add arguments to all plugins.

objcp:
	* plugin/parser.h: Add arguments to all plugins.
cp:
	* parser.c (cp_parser_primary_expression): Add arguments to all the plugins.

From-SVN: r170105
This commit is contained in:
Mike Stump 2011-02-13 10:28:45 +00:00 committed by Mike Stump
parent 88a3b64909
commit a4404ff533
4 changed files with 24 additions and 21 deletions

View File

@ -1,5 +1,6 @@
2011-02-13 Mike Stump <mikestump@comcast.net> 2011-02-13 Mike Stump <mikestump@comcast.net>
* parser.c (cp_parser_primary_expression): Add arguments to all the plugins.
* lex.c: Plugify. * lex.c: Plugify.
* Make-lang.in (objcp/plugin/lex.h): Likewise. * Make-lang.in (objcp/plugin/lex.h): Likewise.
* Make-lang.in (cp/parser.o): Move c-family/c-objc.h dependancy * Make-lang.in (cp/parser.o): Move c-family/c-objc.h dependancy

View File

@ -3671,11 +3671,11 @@ cp_parser_primary_expression (cp_parser *parser,
} }
case CPP_OPEN_SQUARE: case CPP_OPEN_SQUARE:
PLUGIN_PRIMARY_EXPRESSION_3(parser); PLUGIN_PRIMARY_EXPRESSION_3 (parser);
maybe_warn_cpp0x (CPP0X_LAMBDA_EXPR); maybe_warn_cpp0x (CPP0X_LAMBDA_EXPR);
return cp_parser_lambda_expression (parser); return cp_parser_lambda_expression (parser);
PLUGIN_PRIMARY_EXPRESSION_2(parser, cp_parser_error) PLUGIN_PRIMARY_EXPRESSION_2 (parser, cp_parser_error)
case CPP_KEYWORD: case CPP_KEYWORD:
switch (token->keyword) switch (token->keyword)
@ -3806,7 +3806,7 @@ cp_parser_primary_expression (cp_parser *parser,
case RID_IS_LITERAL_TYPE: case RID_IS_LITERAL_TYPE:
return cp_parser_trait_expr (parser, token->keyword); return cp_parser_trait_expr (parser, token->keyword);
PLUGIN_PRIMARY_EXPRESSION_1(parser) PLUGIN_PRIMARY_EXPRESSION_1 (parser)
case RID_TEMPLATE: case RID_TEMPLATE:
if (parser->in_function_body if (parser->in_function_body
@ -9401,7 +9401,7 @@ cp_parser_declaration (cp_parser* parser)
else if (token1.keyword == RID_INLINE else if (token1.keyword == RID_INLINE
&& token2.keyword == RID_NAMESPACE) && token2.keyword == RID_NAMESPACE)
cp_parser_namespace_definition (parser); cp_parser_namespace_definition (parser);
PLUGIN_DECLARATION PLUGIN_DECLARATION (token1, attributes)
/* We must have either a block declaration or a function /* We must have either a block declaration or a function
definition. */ definition. */
else else
@ -12800,7 +12800,7 @@ cp_parser_simple_type_specifier (cp_parser* parser,
if (type && type != error_mark_node) if (type && type != error_mark_node)
{ {
PLUGIN_SIMPLE_TYPE_SPECIFIER; PLUGIN_SIMPLE_TYPE_SPECIFIER (parser, type, decl_specs);
/* There is no valid C++ program where a non-template type is /* There is no valid C++ program where a non-template type is
followed by a "<". That usually indicates that the user followed by a "<". That usually indicates that the user
@ -12876,11 +12876,11 @@ cp_parser_nonclass_name (cp_parser* parser)
/* Look up the type-name. */ /* Look up the type-name. */
type_decl = cp_parser_lookup_name_simple (parser, identifier, token->location); type_decl = cp_parser_lookup_name_simple (parser, identifier, token->location);
PLUGIN_NONCLASS_NAME1; PLUGIN_NONCLASS_NAME1 (parser, type_decl, identifier);
/* Issue an error if we did not find a type-name. */ /* Issue an error if we did not find a type-name. */
if (TREE_CODE (type_decl) != TYPE_DECL if (TREE_CODE (type_decl) != TYPE_DECL
PLUGIN_NONCLASS_NAME) PLUGIN_NONCLASS_NAME (parser, type_decl, cp_lexer_peek_token))
{ {
if (!cp_parser_simulate_error (parser)) if (!cp_parser_simulate_error (parser))
cp_parser_name_lookup_error (parser, identifier, type_decl, cp_parser_name_lookup_error (parser, identifier, type_decl,
@ -16724,7 +16724,7 @@ cp_parser_class_name (cp_parser *parser,
else if (TREE_CODE (decl) != TYPE_DECL else if (TREE_CODE (decl) != TYPE_DECL
|| TREE_TYPE (decl) == error_mark_node || TREE_TYPE (decl) == error_mark_node
|| !MAYBE_CLASS_TYPE_P (TREE_TYPE (decl)) || !MAYBE_CLASS_TYPE_P (TREE_TYPE (decl))
PLUGIN_CLASS_NAME) PLUGIN_CLASS_NAME (parser, cp_lexer_peek_token, CPP_DOT))
decl = error_mark_node; decl = error_mark_node;
if (decl == error_mark_node) if (decl == error_mark_node)
@ -17585,7 +17585,8 @@ cp_parser_member_declaration (cp_parser* parser)
return; return;
} }
PLUGIN_MEMBER_DECLARATION; PLUGIN_MEMBER_DECLARATION (parser, cp_lexer_next_token_is_keyword,
finish_member_declaration);
/* If the next token is `static_assert' we have a static assertion. */ /* If the next token is `static_assert' we have a static assertion. */
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_STATIC_ASSERT)) if (cp_lexer_next_token_is_keyword (parser->lexer, RID_STATIC_ASSERT))

View File

@ -1,5 +1,6 @@
2011-02-13 Mike Stump <mikestump@comcast.net> 2011-02-13 Mike Stump <mikestump@comcast.net>
* plugin/parser.h: Add arguments to all plugins.
* plugin/lex.h: Plugify. * plugin/lex.h: Plugify.
2011-02-12 Mike Stump <mikestump@comcast.net> 2011-02-12 Mike Stump <mikestump@comcast.net>

View File

@ -127,7 +127,7 @@ static tree cp_parser_objc_struct_declaration
break;@) break;@)
#define PLUGIN_DECLARATION @( #define PLUGIN_DECLARATION(token1, attributes) @(
/* Objective-C++ declaration/definition. */ /* Objective-C++ declaration/definition. */
else if (c_dialect_objc () && OBJC_IS_AT_KEYWORD (token1.keyword)) else if (c_dialect_objc () && OBJC_IS_AT_KEYWORD (token1.keyword))
cp_parser_objc_declaration (parser, NULL_TREE); cp_parser_objc_declaration (parser, NULL_TREE);
@ -136,7 +136,7 @@ static tree cp_parser_objc_struct_declaration
&& cp_parser_objc_valid_prefix_attributes (parser, &attributes)) && cp_parser_objc_valid_prefix_attributes (parser, &attributes))
cp_parser_objc_declaration (parser, attributes);@) cp_parser_objc_declaration (parser, attributes);@)
#define PLUGIN_SIMPLE_TYPE_SPECIFIER @( #define PLUGIN_SIMPLE_TYPE_SPECIFIER(parser, type, decl_specs) @(
do { do {
/* See if TYPE is an Objective-C type, and if so, parse and /* See if TYPE is an Objective-C type, and if so, parse and
accept any protocol references following it. Do this before accept any protocol references following it. Do this before
@ -160,7 +160,7 @@ static tree cp_parser_objc_struct_declaration
} while (0)@) } while (0)@)
#define PLUGIN_NONCLASS_NAME1 @( #define PLUGIN_NONCLASS_NAME1(parser, type_decl, identifier) @(
do { do {
if (TREE_CODE (type_decl) != TYPE_DECL if (TREE_CODE (type_decl) != TYPE_DECL
&& (objc_is_id (identifier) || objc_is_class_name (identifier))) && (objc_is_id (identifier) || objc_is_class_name (identifier)))
@ -173,7 +173,7 @@ static tree cp_parser_objc_struct_declaration
} }
} while (0)@) } while (0)@)
#define PLUGIN_NONCLASS_NAME @( #define PLUGIN_NONCLASS_NAME(parser, type_decl, cp_lexer_peek_token) @(
/* In Objective-C, we have the complication that class names are /* In Objective-C, we have the complication that class names are
normally type names and start declarations (eg, the normally type names and start declarations (eg, the
"NSObject" in "NSObject *object;"), but can be used in an "NSObject" in "NSObject *object;"), but can be used in an
@ -183,14 +183,14 @@ static tree cp_parser_objc_struct_declaration
|| (objc_is_class_name (TREE_TYPE (type_decl)) || (objc_is_class_name (TREE_TYPE (type_decl))
&& cp_lexer_peek_token (parser->lexer)->type == CPP_DOT)@) && cp_lexer_peek_token (parser->lexer)->type == CPP_DOT)@)
#define PLUGIN_CLASS_NAME @( #define PLUGIN_CLASS_NAME(parser, cp_lexer_peek_token, CPP_DOT) @(
/* In Objective-C 2.0, a classname followed by '.' starts a /* In Objective-C 2.0, a classname followed by '.' starts a
dot-syntax expression, and it's not a type-name. */ dot-syntax expression, and it's not a type-name. */
|| (c_dialect_objc () || (c_dialect_objc ()
&& cp_lexer_peek_token (parser->lexer)->type == CPP_DOT && cp_lexer_peek_token (parser->lexer)->type == CPP_DOT
&& objc_is_class_name (decl))@) && objc_is_class_name (decl))@)
#define PLUGIN_MEMBER_DECLARATION @( #define PLUGIN_MEMBER_DECLARATION(parser, cp_lexer_next_token_is_keyword, finish_member_declaration) @(
do { do {
/* Check for @defs. */ /* Check for @defs. */
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_AT_DEFS)) if (cp_lexer_next_token_is_keyword (parser->lexer, RID_AT_DEFS))
@ -217,11 +217,11 @@ static tree cp_parser_objc_struct_declaration
#define PLUGIN_PRIMARY_EXPRESSION(parser, decl, cp_lexer_consume_token, cp_lexer_peek_token) #define PLUGIN_PRIMARY_EXPRESSION(parser, decl, cp_lexer_consume_token, cp_lexer_peek_token)
#define PLUGIN_TOKEN_STARTS_CAST_EXPR #define PLUGIN_TOKEN_STARTS_CAST_EXPR
#define PLUGIN_STATEMENT #define PLUGIN_STATEMENT
#define PLUGIN_DECLARATION #define PLUGIN_DECLARATION(token1, attributes)
#define PLUGIN_SIMPLE_TYPE_SPECIFIER #define PLUGIN_SIMPLE_TYPE_SPECIFIER(parser, type, decl_specs)
#define PLUGIN_NONCLASS_NAME1 #define PLUGIN_NONCLASS_NAME1(parser, type_decl, identifier)
#define PLUGIN_NONCLASS_NAME #define PLUGIN_NONCLASS_NAME(parser, type_decl, cp_lexer_peek_token)
#define PLUGIN_CLASS_NAME #define PLUGIN_CLASS_NAME(parser, cp_lexer_peek_token, CPP_DOT)
#define PLUGIN_MEMBER_DECLARATION #define PLUGIN_MEMBER_DECLARATION(parser, cp_lexer_next_token_is_keyword, finish_member_declaration)
#endif #endif