summaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.c
diff options
context:
space:
mode:
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-25 10:49:56 +0000
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-25 10:49:56 +0000
commitadc93f318aa9da3277035ea5a1179a1e07c2a967 (patch)
treef4d8a50111777846844df804a7eadd99ced2527f /gcc/c/c-parser.c
parent49eafa822f36dcbcf388c1fcff5ae0f0863cb8f8 (diff)
downloadgcc-adc93f318aa9da3277035ea5a1179a1e07c2a967.tar.gz
PR c/60114
c/ * c-parser.c (c_parser_initelt): Pass input_location to process_init_element. (c_parser_initval): Pass loc to process_init_element. * c-tree.h (process_init_element): Adjust declaration. * c-typeck.c (push_init_level): Pass input_location to process_init_element. (pop_init_level): Likewise. (set_designator): Likewise. (output_init_element): Add location_t parameter. Pass loc to digest_init. (output_pending_init_elements): Pass input_location to output_init_element. (process_init_element): Add location_t parameter. Pass loc to output_init_element. testsuite/ * gcc.dg/pr60114.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209794 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r--gcc/c/c-parser.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index c229bdb47ad..56f79f6a795 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -4219,7 +4219,8 @@ c_parser_initelt (c_parser *parser, struct obstack * braced_init_obstack)
init.original_type = NULL;
c_parser_error (parser, "expected identifier");
c_parser_skip_until_found (parser, CPP_COMMA, NULL);
- process_init_element (init, false, braced_init_obstack);
+ process_init_element (input_location, init, false,
+ braced_init_obstack);
return;
}
}
@@ -4351,7 +4352,8 @@ c_parser_initelt (c_parser *parser, struct obstack * braced_init_obstack)
init.original_type = NULL;
c_parser_error (parser, "expected %<=%>");
c_parser_skip_until_found (parser, CPP_COMMA, NULL);
- process_init_element (init, false, braced_init_obstack);
+ process_init_element (input_location, init, false,
+ braced_init_obstack);
return;
}
}
@@ -4372,18 +4374,19 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
{
struct c_expr init;
gcc_assert (!after || c_dialect_objc ());
+ location_t loc = c_parser_peek_token (parser)->location;
+
if (c_parser_next_token_is (parser, CPP_OPEN_BRACE) && !after)
init = c_parser_braced_init (parser, NULL_TREE, true);
else
{
- location_t loc = c_parser_peek_token (parser)->location;
init = c_parser_expr_no_commas (parser, after);
if (init.value != NULL_TREE
&& TREE_CODE (init.value) != STRING_CST
&& TREE_CODE (init.value) != COMPOUND_LITERAL_EXPR)
init = convert_lvalue_to_rvalue (loc, init, true, true);
}
- process_init_element (init, false, braced_init_obstack);
+ process_init_element (loc, init, false, braced_init_obstack);
}
/* Parse a compound statement (possibly a function body) (C90 6.6.2,