From 16e82a8e8f2766af39bd891fb2cc0da3b8e0117e Mon Sep 17 00:00:00 2001 From: ghazi Date: Wed, 23 Aug 2000 16:13:47 +0000 Subject: * 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 --- gcc/testsuite/gcc.dg/wtr-aggr-init-1.c | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/wtr-aggr-init-1.c (limited to 'gcc/testsuite/gcc.dg/wtr-aggr-init-1.c') 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 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; +} -- cgit v1.2.1