diff options
author | Joseph Myers <jsm28@cam.ac.uk> | 2001-01-24 20:41:49 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2001-01-24 20:41:49 +0000 |
commit | cedd825f0f18088f7235f02136021bd63a2e12df (patch) | |
tree | fb7631bc21b96e7a0071cd36b5ff78d5c6b71fe9 /gcc/c-parse.in | |
parent | 9bad11e125dadee39cbefe8e52a2fc9fa77ef062 (diff) | |
download | gcc-cedd825f0f18088f7235f02136021bd63a2e12df.zip gcc-cedd825f0f18088f7235f02136021bd63a2e12df.tar.gz gcc-cedd825f0f18088f7235f02136021bd63a2e12df.tar.bz2 |
c-parse.in (cast_expr): Move compound literals from here ...
* c-parse.in (cast_expr): Move compound literals from here ...
(primary): ... to here. Use standard terminology "compound
literal" instead of "constructor expression".
testsuite:
* gcc.c-torture/compile/20010124-1.c: New test.
From-SVN: r39246
Diffstat (limited to 'gcc/c-parse.in')
-rw-r--r-- | gcc/c-parse.in | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 30f2551..5b32768 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -542,35 +542,6 @@ cast_expr: type = groktypename ($2); warn_strict_prototypes = SAVED_warn_strict_prototypes; $$ = build_c_cast (type, $4); } - | '(' typename ')' '{' - { start_init (NULL_TREE, NULL, 0); - $2 = groktypename ($2); - really_start_incremental_init ($2); } - initlist_maybe_comma '}' %prec UNARY - { const char *name; - tree result = pop_init_level (0); - tree type = $2; - finish_init (); - - if (pedantic && ! flag_isoc99) - pedwarn ("ISO C89 forbids constructor expressions"); - if (TYPE_NAME (type) != 0) - { - if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) - name = IDENTIFIER_POINTER (TYPE_NAME (type)); - else - name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); - } - else - name = ""; - $$ = result; - if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type)) - { - int failure = complete_array_type (type, $$, 1); - if (failure) - abort (); - } - } ; expr_no_commas: @@ -659,6 +630,35 @@ primary: | CONSTANT | string { $$ = combine_strings ($1); } + | '(' typename ')' '{' + { start_init (NULL_TREE, NULL, 0); + $2 = groktypename ($2); + really_start_incremental_init ($2); } + initlist_maybe_comma '}' %prec UNARY + { const char *name; + tree result = pop_init_level (0); + tree type = $2; + finish_init (); + + if (pedantic && ! flag_isoc99) + pedwarn ("ISO C89 forbids compound literals"); + if (TYPE_NAME (type) != 0) + { + if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) + name = IDENTIFIER_POINTER (TYPE_NAME (type)); + else + name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); + } + else + name = ""; + $$ = result; + if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type)) + { + int failure = complete_array_type (type, $$, 1); + if (failure) + abort (); + } + } | '(' expr ')' { char class = TREE_CODE_CLASS (TREE_CODE ($2)); if (class == 'e' || class == '1' |