From 26d4fec72e0319f2af9416ceaa9c76430b9e808d Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 13 Nov 2000 13:31:16 +0000 Subject: c-parse.in (initelt): Give appropriate pedantic warnings... * c-parse.in (initelt): Give appropriate pedantic warnings, depending on flag_isoc99, for non-ISO syntax and for C99 syntax outside C99 mode. (designator): If pedantic, pedwarn for a designator specifying a range of elements. * c-typeck.c (set_init_index, set_init_label): Don't pedwarn for these cases. * extend.texi: Document the C99 syntax as the preferred syntax, and the pre-2.5 syntax as obsolete. Mention use of designator lists for nested subobjects. From-SVN: r37421 --- gcc/c-parse.in | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'gcc/c-parse.in') diff --git a/gcc/c-parse.in b/gcc/c-parse.in index ed272c8..3550bef 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -1132,9 +1132,15 @@ initlist1: It may use braces. */ initelt: designator_list '=' initval + { if (pedantic && ! flag_isoc99) + pedwarn ("ISO C89 forbids specifying subobject to initialize"); } | designator initval + { if (pedantic) + pedwarn ("obsolete use of designated initializer without `='"); } | identifier ':' - { set_init_label ($1); } + { set_init_label ($1); + if (pedantic) + pedwarn ("obsolete use of designated initializer with `:'"); } initval | initval ; @@ -1162,7 +1168,9 @@ designator: so don't include these productions in the Objective-C grammar. */ ifc | '[' expr_no_commas ELLIPSIS expr_no_commas ']' - { set_init_index ($2, $4); } + { set_init_index ($2, $4); + if (pedantic) + pedwarn ("ISO C forbids specifying range of elements to initialize"); } | '[' expr_no_commas ']' { set_init_index ($2, NULL_TREE); } end ifc -- cgit v1.1