Commit 4014b382 by Joseph Myers Committed by Richard Henderson

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
parent 62fc8756
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> 1999-05-02 Craig Burley <craig@jcb-sc.com>
* g77.f-torture/compile/19990502-1.f: New test. * g77.f-torture/compile/19990502-1.f: New test.
......
/* 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" } */
}
/* 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" } */
/* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment