summaryrefslogtreecommitdiff
path: root/gcc/c-parser.c
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-19 15:29:18 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-19 15:29:18 +0000
commit843bd2fa78007c193692f6382edf3b6b5c2d3a62 (patch)
tree0dea9b2fb4eca6aa396f8ba7b9c2513061e504ae /gcc/c-parser.c
parent4a76ab2acb9e11d7a0fbb6ac702b781f73418a46 (diff)
downloadgcc-843bd2fa78007c193692f6382edf3b6b5c2d3a62.tar.gz
./:
* dse.c (struct store_info): Rename bitmap field to bmap. Change all uses. * c-decl.c (in_struct, struct_types): Remove. (struct c_binding): Add in_struct field. (c_binding_ptr): Define type, along with VEC. (struct c_struct_parse_info): Define. (struct_parse_info): New static variable. (bind): Initialize in_struct field. (start_struct): Remove enclosing_in_struct and enclosing_struct_types parameters. Add enclosing_struct_parse_info parameter. Change all callers. Set struct_parse_info rather than in_struct and struct_types. (grokfield): If -Wc++-compat and there is a symbol binding for the field name, set the in_struct flag and push it on the struct_parse_info->fields vector. (warn_cxx_compat_finish_struct): New static function. (finish_struct): Remove enclosing_in_struct and enclosing_struct_types parameters. Add enclosing_struct_parse_info parameter. Change all callers. Don't set C_TYPE_DEFINED_IN_STRUCT here. Call warn_cxx_compat_finish_struct. Free struct_parse_info and set to parameter. Only push on struct_types if warn_cxx_compat. (finish_enum): Only push on struct_types if warn_cxx_compat. (declspecs_add_type): Add loc parameter. Change all callers. Change all error calls to error_at. Pass loc, not input_location, to pedwarn calls. Warn if -Wc++-compat and a typedef name is defined in a struct. If -Wc++-compat and parsing a struct, record that a typedef name was used. * c-parser.c (c_parser_declspecs): Get location to pass to declspecs_add_type. (c_parser_struct_or_union_specifier): Update calls to start_struct and finish_struct. * c-tree.h (struct c_struct_parse_info): Declare. (finish_struct, start_struct): Update declarations. (declspecs_add_type): Update declaration. objc/: * objc-act.c (objc_in_struct, objc_struct_types): Remove. (objc_struct_info): New static variable. (objc_start_struct): Pass &objc_struct_info, not &objc_in_struct and &objc_struct_types, to start_struct. (objc_finish_struct): Likewise for finish_struct. objcp/: * objcp-decl.h (start_struct): Remove in_struct and struct_types parameters. Add struct_info parameter. (finish_struct): Likewise. testsuite/: * gcc.dg/Wcxx-compat-15.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148709 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r--gcc/c-parser.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 2b78c3042fa..0fc1abb5119 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -1447,6 +1447,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
{
struct c_typespec t;
tree attrs;
+ location_t loc = c_parser_peek_token (parser)->location;
if (c_parser_next_token_is (parser, CPP_NAME))
{
tree value = c_parser_peek_token (parser)->value;
@@ -1482,7 +1483,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
t.expr = NULL_TREE;
t.expr_const_operands = true;
}
- declspecs_add_type (specs, t);
+ declspecs_add_type (loc, specs, t);
continue;
}
if (c_parser_next_token_is (parser, CPP_LESS))
@@ -1498,7 +1499,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
t.spec = objc_get_protocol_qualified_type (NULL_TREE, proto);
t.expr = NULL_TREE;
t.expr_const_operands = true;
- declspecs_add_type (specs, t);
+ declspecs_add_type (loc, specs, t);
continue;
}
gcc_assert (c_parser_next_token_is (parser, CPP_KEYWORD));
@@ -1547,7 +1548,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
t.spec = c_parser_peek_token (parser)->value;
t.expr = NULL_TREE;
t.expr_const_operands = true;
- declspecs_add_type (specs, t);
+ declspecs_add_type (loc, specs, t);
c_parser_consume_token (parser);
break;
case RID_ENUM:
@@ -1556,7 +1557,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
attrs_ok = true;
seen_type = true;
t = c_parser_enum_specifier (parser);
- declspecs_add_type (specs, t);
+ declspecs_add_type (loc, specs, t);
break;
case RID_STRUCT:
case RID_UNION:
@@ -1566,7 +1567,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
seen_type = true;
t = c_parser_struct_or_union_specifier (parser);
invoke_plugin_callbacks (PLUGIN_FINISH_TYPE, t.spec);
- declspecs_add_type (specs, t);
+ declspecs_add_type (loc, specs, t);
break;
case RID_TYPEOF:
/* ??? The old parser rejected typeof after other type
@@ -1577,7 +1578,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
attrs_ok = true;
seen_type = true;
t = c_parser_typeof_specifier (parser);
- declspecs_add_type (specs, t);
+ declspecs_add_type (loc, specs, t);
break;
case RID_CONST:
case RID_VOLATILE:
@@ -1815,10 +1816,8 @@ c_parser_struct_or_union_specifier (c_parser *parser)
{
/* Parse a struct or union definition. Start the scope of the
tag before parsing components. */
- bool in_struct;
- VEC(tree,heap) *struct_types;
- tree type = start_struct (struct_loc, code, ident,
- &in_struct, &struct_types);
+ struct c_struct_parse_info *struct_info;
+ tree type = start_struct (struct_loc, code, ident, &struct_info);
tree postfix_attrs;
/* We chain the components in reverse order, then put them in
forward order at the end. Each struct-declaration may
@@ -1908,8 +1907,7 @@ c_parser_struct_or_union_specifier (c_parser *parser)
}
postfix_attrs = c_parser_attributes (parser);
ret.spec = finish_struct (struct_loc, type, nreverse (contents),
- chainon (attrs, postfix_attrs),
- in_struct, struct_types);
+ chainon (attrs, postfix_attrs), struct_info);
ret.kind = ctsk_tagdef;
ret.expr = NULL_TREE;
ret.expr_const_operands = true;