diff options
author | Joseph Myers <jsm28@cam.ac.uk> | 1999-05-02 08:14:53 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 1999-05-02 08:14:53 -0700 |
commit | 4014b382ea674616d0b1a981254ce7a26b9919e7 (patch) | |
tree | 0f95e2d1d8fea336a004ab8d993f1f9e53617efb /gcc | |
parent | 62fc8756ab940766ebe3e6ed72fd9f25460fe71e (diff) | |
download | gcc-4014b382ea674616d0b1a981254ce7a26b9919e7.zip gcc-4014b382ea674616d0b1a981254ce7a26b9919e7.tar.gz gcc-4014b382ea674616d0b1a981254ce7a26b9919e7.tar.bz2 |
Joseph S.
Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.dg/cast-qual-1.c, gcc.dg/return-type-1.c, gcc.dg/unused-1.c:
New tests.
From-SVN: r26731
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cast-qual-1.c | 30 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/return-type-1.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/unused-1.c | 11 |
4 files changed, 55 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 39c0ee3..64ffc51 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +1999-05-02 Joseph S. Myers <jsm28@cam.ac.uk> + + * gcc.dg/cast-qual-1.c, gcc.dg/return-type-1.c, gcc.dg/unused-1.c: + New tests. + 1999-05-02 Craig Burley <craig@jcb-sc.com> * g77.f-torture/compile/19990502-1.f: New test. diff --git a/gcc/testsuite/gcc.dg/cast-qual-1.c b/gcc/testsuite/gcc.dg/cast-qual-1.c new file mode 100644 index 0000000..a7a3470 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cast-qual-1.c @@ -0,0 +1,30 @@ +/* Incorrect `cast discards `const'' warnings. There should be warnings + in bad_cast and bad_assign; bad_assign gets the correct warning, but + good_cast may get the warning instead of bad_cast. + gcc 2.7.2.3 passes, egcs-1.1.2 and egcs-ss-19990428 fail. + http://www.cygnus.com/ml/egcs-bugs/1998-Aug/0635.html */ +/* { dg-do compile } */ +/* { dg-options "-Wcast-qual" } */ +void +good_cast(const void *bar) +{ + (char *const *)bar; /* { dg-bogus "cast discards" "discarding `const' warning" } */ +} + +void +bad_cast(const void *bar) +{ + (const char **)bar; /* { dg-warning "cast discards" "discarding `const' warning" } */ +} + +void +good_assign(const void *bar) +{ + char *const *foo = bar; +} + +void +bad_assign(const void *bar) +{ + const char **foo = bar; /* { dg-warning "initialization discards" "discarding `const' warning" } */ +} diff --git a/gcc/testsuite/gcc.dg/return-type-1.c b/gcc/testsuite/gcc.dg/return-type-1.c new file mode 100644 index 0000000..4b24553 --- /dev/null +++ b/gcc/testsuite/gcc.dg/return-type-1.c @@ -0,0 +1,9 @@ +/* Missing warning for falling off the end of a non-void function. + egcs-1.1.2 passes, egcs-ss-19990428 fails. + http://egcs.cygnus.com/ml/egcs-bugs/1999-03/msg00220.html */ +/* { dg-do compile } */ +/* { dg-options "-O -Wreturn-type" } */ +int +foo(void) +{ +} /* { dg-warning "control reaches end of non-void function" "warning for falling off end of non-void function" } */ diff --git a/gcc/testsuite/gcc.dg/unused-1.c b/gcc/testsuite/gcc.dg/unused-1.c new file mode 100644 index 0000000..be94186 --- /dev/null +++ b/gcc/testsuite/gcc.dg/unused-1.c @@ -0,0 +1,11 @@ +/* Missing `unused parameter' warning. + egcs-1.1.2 fails, egcs-ss-19990418 passes. + http://www.cygnus.com/ml/egcs-bugs/1998-Sep/0199.html */ +/* { dg-do compile } */ +/* { dg-options "-O -Wall -W" } */ +int +f(c) + char c; /* { dg-warning "unused parameter" "unused parameter warning" } */ +{ + return 0; +} |