Commit 7370e0da by Arnaud Charlet Committed by Arnaud Charlet

c-tree.h, c-decl.c (build_enumerator): Add location parameter.

	* c-tree.h, c-decl.c (build_enumerator): Add location parameter.
	* c-parser.c (c_parser_enum_specifier): Adjust call to build_enumerator.

From-SVN: r163988
parent e0d4c0b3
2010-09-08 Arnaud Charlet <charlet@adacore.com>
* c-tree.h, c-decl.c (build_enumerator): Add location parameter.
* c-parser.c (c_parser_enum_specifier): Adjust call to build_enumerator.
2010-09-08 Kenneth Zadeck <zadeck@naturalbridge.com> 2010-09-08 Kenneth Zadeck <zadeck@naturalbridge.com>
PR doc/45587 PR doc/45587
* doc/md.texi: Fixed modes on several standard pattern names. * doc/md.texi: Fixed modes on several standard pattern names.
......
...@@ -7343,12 +7343,13 @@ finish_enum (tree enumtype, tree values, tree attributes) ...@@ -7343,12 +7343,13 @@ finish_enum (tree enumtype, tree values, tree attributes)
/* Build and install a CONST_DECL for one value of the /* Build and install a CONST_DECL for one value of the
current enumeration type (one that was begun with start_enum). current enumeration type (one that was begun with start_enum).
LOC is the location of the enumerator. DECL_LOC is the location of the enumerator.
LOC is the location of the '=' operator if any, DECL_LOC otherwise.
Return a tree-list containing the CONST_DECL and its value. Return a tree-list containing the CONST_DECL and its value.
Assignment of sequential values by default is handled here. */ Assignment of sequential values by default is handled here. */
tree tree
build_enumerator (location_t loc, build_enumerator (location_t decl_loc, location_t loc,
struct c_enum_contents *the_enum, tree name, tree value) struct c_enum_contents *the_enum, tree name, tree value)
{ {
tree decl, type; tree decl, type;
...@@ -7436,7 +7437,7 @@ build_enumerator (location_t loc, ...@@ -7436,7 +7437,7 @@ build_enumerator (location_t loc,
>= TYPE_PRECISION (integer_type_node) >= TYPE_PRECISION (integer_type_node)
&& TYPE_UNSIGNED (type))); && TYPE_UNSIGNED (type)));
decl = build_decl (loc, CONST_DECL, name, type); decl = build_decl (decl_loc, CONST_DECL, name, type);
DECL_INITIAL (decl) = convert (type, value); DECL_INITIAL (decl) = convert (type, value);
pushdecl (decl); pushdecl (decl);
......
...@@ -1833,7 +1833,7 @@ c_parser_enum_specifier (c_parser *parser) ...@@ -1833,7 +1833,7 @@ c_parser_enum_specifier (c_parser *parser)
bool seen_comma; bool seen_comma;
c_token *token; c_token *token;
location_t comma_loc = UNKNOWN_LOCATION; /* Quiet warning. */ location_t comma_loc = UNKNOWN_LOCATION; /* Quiet warning. */
location_t value_loc; location_t decl_loc, value_loc;
if (c_parser_next_token_is_not (parser, CPP_NAME)) if (c_parser_next_token_is_not (parser, CPP_NAME))
{ {
c_parser_error (parser, "expected identifier"); c_parser_error (parser, "expected identifier");
...@@ -1845,7 +1845,7 @@ c_parser_enum_specifier (c_parser *parser) ...@@ -1845,7 +1845,7 @@ c_parser_enum_specifier (c_parser *parser)
enum_id = token->value; enum_id = token->value;
/* Set the location in case we create a decl now. */ /* Set the location in case we create a decl now. */
c_parser_set_source_position_from_token (token); c_parser_set_source_position_from_token (token);
value_loc = token->location; decl_loc = value_loc = token->location;
c_parser_consume_token (parser); c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_EQ)) if (c_parser_next_token_is (parser, CPP_EQ))
{ {
...@@ -1855,7 +1855,7 @@ c_parser_enum_specifier (c_parser *parser) ...@@ -1855,7 +1855,7 @@ c_parser_enum_specifier (c_parser *parser)
} }
else else
enum_value = NULL_TREE; enum_value = NULL_TREE;
enum_decl = build_enumerator (value_loc, enum_decl = build_enumerator (decl_loc, value_loc,
&the_enum, enum_id, enum_value); &the_enum, enum_id, enum_value);
TREE_CHAIN (enum_decl) = values; TREE_CHAIN (enum_decl) = values;
values = enum_decl; values = enum_decl;
......
...@@ -427,7 +427,8 @@ extern int quals_from_declspecs (const struct c_declspecs *); ...@@ -427,7 +427,8 @@ extern int quals_from_declspecs (const struct c_declspecs *);
extern struct c_declarator *build_array_declarator (location_t, tree, extern struct c_declarator *build_array_declarator (location_t, tree,
struct c_declspecs *, struct c_declspecs *,
bool, bool); bool, bool);
extern tree build_enumerator (location_t, struct c_enum_contents *, tree, tree); extern tree build_enumerator (location_t, location_t, struct c_enum_contents *,
tree, tree);
extern tree check_for_loop_decls (location_t); extern tree check_for_loop_decls (location_t);
extern void mark_forward_parm_decls (void); extern void mark_forward_parm_decls (void);
extern void declare_parm_level (void); extern void declare_parm_level (void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment