diff options
author | Joseph Myers <jsm28@cam.ac.uk> | 2000-11-13 13:31:16 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2000-11-13 13:31:16 +0000 |
commit | 26d4fec72e0319f2af9416ceaa9c76430b9e808d (patch) | |
tree | 7f9d7597fc09c082ffe833c9bc59a6994331b0a1 /gcc/c-parse.in | |
parent | 1173593dd6368a86253e21fcb00ff8496c0eac34 (diff) | |
download | gcc-26d4fec72e0319f2af9416ceaa9c76430b9e808d.zip gcc-26d4fec72e0319f2af9416ceaa9c76430b9e808d.tar.gz gcc-26d4fec72e0319f2af9416ceaa9c76430b9e808d.tar.bz2 |
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
Diffstat (limited to 'gcc/c-parse.in')
-rw-r--r-- | gcc/c-parse.in | 12 |
1 files changed, 10 insertions, 2 deletions
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 |