diff options
author | dj <dj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-18 20:04:01 +0000 |
---|---|---|
committer | dj <dj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-18 20:04:01 +0000 |
commit | be9ec78a5e0ba875b3089584174aabe4624c047c (patch) | |
tree | 0ce66fbd7f1ed533eda7b0fb37b3023a151aae03 /gcc | |
parent | 76f02516d92d7110b13140af39499b789ea392da (diff) | |
download | gcc-be9ec78a5e0ba875b3089584174aabe4624c047c.tar.gz |
* gcc.dg/Werror-1.c, gcc.dg/Werror-2.c, gcc.dg/Werror-3.c,
gcc.dg/Werror-4.c, gcc.dg/Werror-5.c, gcc.dg/Werror-6.c,
gcc.dg/Werror-7.c, gcc.dg/Werror-8.c, gcc.dg/Werror-9.c,
gcc.dg/Werror-10.c, gcc.dg/Werror-11.c, gcc.dg/Werror-12: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109908 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Werror-1.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Werror-10.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Werror-11.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Werror-12.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Werror-2.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Werror-3.c | 15 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Werror-4.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Werror-5.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Werror-6.c | 15 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Werror-7.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Werror-8.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Werror-9.c | 17 |
13 files changed, 210 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f7973945267..deca25d9850 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2006-01-18 DJ Delorie <dj@redhat.com> + + * gcc.dg/Werror-1.c, gcc.dg/Werror-2.c, gcc.dg/Werror-3.c, + gcc.dg/Werror-4.c, gcc.dg/Werror-5.c, gcc.dg/Werror-6.c, + gcc.dg/Werror-7.c, gcc.dg/Werror-8.c, gcc.dg/Werror-9.c, + gcc.dg/Werror-10.c, gcc.dg/Werror-11.c, gcc.dg/Werror-12: New. + 2006-01-18 Jeff Law <law@redhat.com> * gcc.c-torture/execute/930529-1.x: Use -fwrapv as test depends diff --git a/gcc/testsuite/gcc.dg/Werror-1.c b/gcc/testsuite/gcc.dg/Werror-1.c new file mode 100644 index 00000000000..d50e07c45f2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Werror-1.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-Walways-true -Wattributes -Werror" } */ +/* { dg-warning "warnings being treated as errors" "" {target "*-*-*"} 0 } */ + +/* This is the first in a series of test cases that test the + interaction between -Wfoo, -Werror, -Werror=foo, and #pragma GCC + diagnostic error foo. This one has all the bits we're testing, the + others are subsets of this one. */ + +#pragma GCC diagnostic error "-Walways-true" + +void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */ + +int i; + +void +foo () +{ + if (&i) /* { dg-error "error: .* will always evaluate as 'true'" } */ + grill (); +} diff --git a/gcc/testsuite/gcc.dg/Werror-10.c b/gcc/testsuite/gcc.dg/Werror-10.c new file mode 100644 index 00000000000..3e2c9dffa4f --- /dev/null +++ b/gcc/testsuite/gcc.dg/Werror-10.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-Wattributes -Werror" } */ +/* { dg-warning "warnings being treated as errors" "" {target "*-*-*"} 0 } */ + +/* Make sure #pragma can work with -Werror. */ + +#pragma GCC diagnostic error "-Walways-true" + +void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */ + +int i; + +void +foo () +{ + if (&i) /* { dg-error "error: .* will always evaluate as 'true'" } */ + grill (); +} diff --git a/gcc/testsuite/gcc.dg/Werror-11.c b/gcc/testsuite/gcc.dg/Werror-11.c new file mode 100644 index 00000000000..14aae3129f8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Werror-11.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-Wattributes -Werror" } */ +/* { dg-warning "warnings being treated as errors" "" {target "*-*-*"} 0 } */ + +/* Make sure #pragma can override -Werror. */ + +#pragma GCC diagnostic warning "-Walways-true" + +void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */ + +int i; + +void +foo () +{ + if (&i) /* { dg-warning "warning: .* will always evaluate as 'true'" } */ + grill (); +} diff --git a/gcc/testsuite/gcc.dg/Werror-12.c b/gcc/testsuite/gcc.dg/Werror-12.c new file mode 100644 index 00000000000..0cb1f78f805 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Werror-12.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-Wattributes -Walways-true" } */ + +/* Make sure #pragma can override -Wfoo. */ + +#pragma GCC diagnostic ignored "-Walways-true" + +void __attribute__((dj)) bar() { } /* { dg-warning "attribute directive ignored" } */ + +int i; + +void +foo () +{ + if (&i) /* { dg-bogus "true" } */ + grill (); +} diff --git a/gcc/testsuite/gcc.dg/Werror-2.c b/gcc/testsuite/gcc.dg/Werror-2.c new file mode 100644 index 00000000000..8e08ba0857e --- /dev/null +++ b/gcc/testsuite/gcc.dg/Werror-2.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ + +/* This one is the baseline. Make sure with no option we get no + warnings. */ + +void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */ + +int i; + +void +foo () +{ + if (&i) + grill (); +} diff --git a/gcc/testsuite/gcc.dg/Werror-3.c b/gcc/testsuite/gcc.dg/Werror-3.c new file mode 100644 index 00000000000..a994714446c --- /dev/null +++ b/gcc/testsuite/gcc.dg/Werror-3.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-Walways-true -Wattributes" } */ + +/* Make sure the command line option enables the warning. */ + +void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */ + +int i; + +void +foo () +{ + if (&i) /* { dg-warning "warning: .* will always evaluate as 'true'" } */ + grill (); +} diff --git a/gcc/testsuite/gcc.dg/Werror-4.c b/gcc/testsuite/gcc.dg/Werror-4.c new file mode 100644 index 00000000000..45d217b3233 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Werror-4.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-Wattributes" } */ + +/* Make sure the pragma enables the error. */ + +#pragma GCC diagnostic error "-Walways-true" + +void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */ + +int i; + +void +foo () +{ + if (&i) /* { dg-error "error: .* will always evaluate as 'true'" } */ + grill (); +} diff --git a/gcc/testsuite/gcc.dg/Werror-5.c b/gcc/testsuite/gcc.dg/Werror-5.c new file mode 100644 index 00000000000..39125904dfa --- /dev/null +++ b/gcc/testsuite/gcc.dg/Werror-5.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-Walways-true -Wattributes -Werror" } */ +/* { dg-warning "warnings being treated as errors" "" {target "*-*-*"} 0 } */ + +/* Make sure -Werror turns warnings in to errors. */ + +void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */ + +int i; + +void +foo () +{ + if (&i) /* { dg-warning "warning: .* will always evaluate as 'true'" } */ + grill (); +} diff --git a/gcc/testsuite/gcc.dg/Werror-6.c b/gcc/testsuite/gcc.dg/Werror-6.c new file mode 100644 index 00000000000..11f28b0aa6a --- /dev/null +++ b/gcc/testsuite/gcc.dg/Werror-6.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-Wattributes -Werror=always-true" } */ + +/* Make sure -Werror-foo emits an error and not a warning */ + +void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */ + +int i; + +void +foo () +{ + if (&i) /* { dg-error "error: .* will always evaluate as 'true'" } */ + grill (); +} diff --git a/gcc/testsuite/gcc.dg/Werror-7.c b/gcc/testsuite/gcc.dg/Werror-7.c new file mode 100644 index 00000000000..e6671991f5a --- /dev/null +++ b/gcc/testsuite/gcc.dg/Werror-7.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-Walways-true -Werror -Wno-error=always-true -Wattributes" } */ +/* { dg-warning "warnings being treated as errors" "" {target "*-*-*"} 0 } */ + +/* Make sure -Wno-error= overrides -Werror. */ + +void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */ + +int i; + +void +foo () +{ + if (&i) /* { dg-warning "warning: .* will always evaluate as 'true'" } */ + grill (); +} diff --git a/gcc/testsuite/gcc.dg/Werror-8.c b/gcc/testsuite/gcc.dg/Werror-8.c new file mode 100644 index 00000000000..ec70a2e8eab --- /dev/null +++ b/gcc/testsuite/gcc.dg/Werror-8.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-Wattributes" } */ + +/* Make sure #pragma can enable a warning. */ + +#pragma GCC diagnostic warning "-Walways-true" + +void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */ + +int i; + +void +foo () +{ + if (&i) /* { dg-warning "warning: .* will always evaluate as 'true'" } */ + grill (); +} diff --git a/gcc/testsuite/gcc.dg/Werror-9.c b/gcc/testsuite/gcc.dg/Werror-9.c new file mode 100644 index 00000000000..5b287793f55 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Werror-9.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-Wattributes" } */ + +/* Make sure #pragma can enable a warning as an error. */ + +#pragma GCC diagnostic error "-Walways-true" + +void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */ + +int i; + +void +foo () +{ + if (&i) /* { dg-error "error: .* will always evaluate as 'true'" } */ + grill (); +} |