From 4014b382ea674616d0b1a981254ce7a26b9919e7 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Sun, 2 May 1999 08:14:53 -0700 Subject: [PATCH] Joseph S. Joseph S. Myers * gcc.dg/cast-qual-1.c, gcc.dg/return-type-1.c, gcc.dg/unused-1.c: New tests. From-SVN: r26731 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/cast-qual-1.c | 30 ++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/return-type-1.c | 9 +++++++++ gcc/testsuite/gcc.dg/unused-1.c | 11 ++++++++++ 4 files changed, 55 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/cast-qual-1.c create mode 100644 gcc/testsuite/gcc.dg/return-type-1.c create mode 100644 gcc/testsuite/gcc.dg/unused-1.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 39c0ee314e6a..64ffc51820d2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +1999-05-02 Joseph S. Myers + + * gcc.dg/cast-qual-1.c, gcc.dg/return-type-1.c, gcc.dg/unused-1.c: + New tests. + 1999-05-02 Craig Burley * 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 000000000000..a7a34700bd53 --- /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 000000000000..4b245533ac91 --- /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 000000000000..be941860e493 --- /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; +} -- 2.43.5