aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-tree.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2017-01-04 17:40:59 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2017-01-04 17:40:59 +0000
commit5dd9a9d0c9294455077ba6401701fd3566dcf07c (patch)
tree881a273cbb54d8222e066d9f714a5334e21e14fb /gcc/c/c-tree.h
parentd0a0bfd9394f303ac9ada8803c72ad846bbab990 (diff)
downloadgcc-5dd9a9d0c9294455077ba6401701fd3566dcf07c.zip
gcc-5dd9a9d0c9294455077ba6401701fd3566dcf07c.tar.gz
gcc-5dd9a9d0c9294455077ba6401701fd3566dcf07c.tar.bz2
C FE: implement fix-it hint for -Wmissing-braces
gcc/c/ChangeLog: * c-parser.c (c_parser_declaration_or_fndef): Create a rich_location at init_loc and parse it to start_init. (last_init_list_comma): New global. (c_parser_braced_init): Update last_init_list_comma when parsing commas. Pass it to pop_init_level. Pass location of closing brace to pop_init_level. (c_parser_postfix_expression_after_paren_type): Create a rich_location at type_loc and parse it to start_init. (c_parser_omp_declare_reduction): Likewise for loc. * c-tree.h (start_init): Add rich_location * param. (pop_init_level): Add location_t param. * c-typeck.c (struct initializer_stack): Add field "missing_brace_richloc". (start_init): Add richloc param, use it to initialize the stack node's missing_brace_richloc. (last_init_list_comma): New decl. (finish_implicit_inits): Pass last_init_list_comma to pop_init_level. (push_init_level): When finding missing open braces, add fix-it hints to the richloc. (pop_init_level): Add "insert_before" param and pass it when calling pop_init_level. Add fixits about missing close braces to any richloc. Use the richloc for the -Wmissing-braces warning. (set_designator): Pass last_init_list_comma to pop_init_level. (process_init_element): Likewise. gcc/testsuite/ChangeLog: * gcc.dg/Wmissing-braces-fixits.c: New test case. From-SVN: r244061
Diffstat (limited to 'gcc/c/c-tree.h')
-rw-r--r--gcc/c/c-tree.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index 2604884..ae01450 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -642,12 +642,13 @@ extern tree c_cast_expr (location_t, struct c_type_name *, tree);
extern tree build_c_cast (location_t, tree, tree);
extern void store_init_value (location_t, tree, tree, tree);
extern void maybe_warn_string_init (location_t, tree, struct c_expr);
-extern void start_init (tree, tree, int);
+extern void start_init (tree, tree, int, rich_location *);
extern void finish_init (void);
extern void really_start_incremental_init (tree);
extern void finish_implicit_inits (location_t, struct obstack *);
extern void push_init_level (location_t, int, struct obstack *);
-extern struct c_expr pop_init_level (location_t, int, struct obstack *);
+extern struct c_expr pop_init_level (location_t, int, struct obstack *,
+ location_t);
extern void set_init_index (location_t, tree, tree, struct obstack *);
extern void set_init_label (location_t, tree, location_t, struct obstack *);
extern void process_init_element (location_t, struct c_expr, bool,