aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2014-05-10 20:03:57 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2014-05-10 20:03:57 +0000
commitd033409e943fd9c584a3488df2709671e30555a6 (patch)
treefdf170b705a741473342bef1cba458b93231ff9f /gcc/c/c-parser.c
parent00599202676518ba22834e3fb5d818dc9ff8fa98 (diff)
downloadgcc-d033409e943fd9c584a3488df2709671e30555a6.zip
gcc-d033409e943fd9c584a3488df2709671e30555a6.tar.gz
gcc-d033409e943fd9c584a3488df2709671e30555a6.tar.bz2
c-parser.c (c_parser_declaration_or_fndef): Pass init_loc to maybe_warn_string_init.
* c-parser.c (c_parser_declaration_or_fndef): Pass init_loc to maybe_warn_string_init. (c_parser_postfix_expression_after_paren_type): Pass type_loc to maybe_warn_string_init. * c-tree.h (maybe_warn_string_init): Update declaration. * c-typeck.c (maybe_warn_string_init): Add location parameter. Call pedwarn_init with loc instead of with input_location. (digest_init): Pass init_loc to maybe_warn_string_init. (pop_init_level): Call pedwarn_init with loc instead of with input_location. (set_init_index): Likewise. (process_init_element): Likewise. * gcc.dg/pedwarn-init.c: New test. * gcc.dg/init-string-1.c: Adjust dg-error. From-SVN: r210300
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r--gcc/c/c-parser.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 432bf96..6e8554d 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -1777,9 +1777,9 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
}
if (d != error_mark_node)
{
- maybe_warn_string_init (TREE_TYPE (d), init);
+ maybe_warn_string_init (init_loc, TREE_TYPE (d), init);
finish_decl (d, init_loc, init.value,
- init.original_type, asm_name);
+ init.original_type, asm_name);
}
}
else
@@ -7599,7 +7599,7 @@ c_parser_postfix_expression_after_paren_type (c_parser *parser,
}
init = c_parser_braced_init (parser, type, false);
finish_init ();
- maybe_warn_string_init (type, init);
+ maybe_warn_string_init (type_loc, type, init);
if (type != error_mark_node
&& !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (type))