diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-08-23 16:13:47 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-08-23 16:13:47 +0000 |
commit | 16e82a8e8f2766af39bd891fb2cc0da3b8e0117e (patch) | |
tree | 5e8a157ec041c96ec106a6df77176615b5972056 /gcc/testsuite/gcc.dg/wtr-aggr-init-1.c | |
parent | d039c4a3d58f7b0e6abcd0b343cbf61e8322b05b (diff) | |
download | gcc-16e82a8e8f2766af39bd891fb2cc0da3b8e0117e.tar.gz |
* gcc.dg/cpp/tr-warn4.c, gcc.dg/cpp/tr-warn5.c,
gcc.dg/wtr-aggr-init-1.c, gcc.dg/wtr-escape-1.c,
gcc.dg/wtr-int-type-1.c, gcc.dg/wtr-static-1.c,
gcc.dg/wtr-strcat-1.c, gcc.dg/wtr-switch-1.c,
gcc.dg/wtr-unary-plus-1.c, gcc.dg/wtr-union-init-1.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35913 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/wtr-aggr-init-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/wtr-aggr-init-1.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/wtr-aggr-init-1.c b/gcc/testsuite/gcc.dg/wtr-aggr-init-1.c new file mode 100644 index 00000000000..259716e5e42 --- /dev/null +++ b/gcc/testsuite/gcc.dg/wtr-aggr-init-1.c @@ -0,0 +1,38 @@ +/* Test for -Wtraditional warnings on automatic aggregate initialization. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +struct foo +{ + int i; + long l; +}; + +struct foo f0 = { 0, 0 }; +static struct foo f1 = { 0, 0 }; + +void +testfunc1 (void) +{ + struct foo f3 = { 0, 0 }; /* { dg-warning "traditional C rejects automatic" "automatic aggregate initialization" } */ + static struct foo f4 = { 0, 0 }; + + f3 = f4; +} + +#line 26 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + +struct foo f5 = { 0, 0 }; +static struct foo f6 = { 0, 0 }; + +void +testfunc2 (void) +{ + struct foo f7 = { 0, 0 }; + static struct foo f8 = { 0, 0 }; + + f7 = f8; +} |