On 05/09/14 01:27, Marek Polacek wrote:
Another piece of puzzle.  error_init didn't have a location parameter,
so initialization errors had wrong column info.  This patch adds
location parameter to error_init and to a few of other functions.
The testcases show what has better column info now.
Note what I wrote in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61096#c3 -- three
error_init calls seem to be unreachable, bonus points for anyone who
can construct a testcase that triggers them ;).  And neither testsuite nor
bootstrap exercises them I think.
Many pedwarn_init calls still use input_location; I'm going to address
that later when I find some time.

Regtested/bootstrapped on x86_64-linux, ok for trunk?

2014-05-09  Marek Polacek  <pola...@redhat.com>

        PR c/61096
        * c-parser.c (c_parser_braced_init): Pass brace_loc to push_init_level.
        (c_parser_initelt): Pass location to set_init_label.  Pass array index
        location to set_init_index.
        * c-tree.h (push_init_level): Update declaration.
        (pop_init_level): Likewise.
        (set_init_index): Likewise.
        (set_init_label): Likewise.
        * c-typeck.c (error_init): Add location parameter.  Call error_at
        instead of error.
        (digest_init): Pass init_loc to error_init.
        (really_start_incremental_init):
        (push_init_level): Add location parameter.  Pass loc to pop_init_level
        and error_init.
        (pop_init_level): Likewise.
        (set_designator): Add location parameter.  Pass loc to pop_init_level,
        push_init_level, and error_init.
        (set_init_index): Add location parameter.  Pass loc to error_init and
        set_designator.
        (set_init_label): Likewise.
        (output_init_element): Pass loc to error_init.
        (process_init_element): Pass loc to error_init, pop_init_level,
        pedwarn_init, and push_init_level.

        * gcc.dg/pr61096-1.c: New test.
        * gcc.dg/pr61096-2.c: New test.
OK.
Jeff

Reply via email to