[New testcase] Wrong: "warning: `noreturn' function does return"
Andreas Jaeger
aj@suse.de
Fri May 5 01:32:00 GMT 2000
This small program:
extern void abort (void) __attribute__ ((__noreturn__));
void noreturn (int x) __attribute__ ((__noreturn__));
void
noreturn (int x)
{
abort ();
}
generates a warning with the current CVS gcc version on i686-linux-gnu
if compiled with:
/opt/gcc-2.96.test/bin/gcc -c noreturn.c -O3 -Wall
noreturn.c: In function `noreturn':
noreturn.c:11: warning: `noreturn' function does return
There's no warning with -O2 - and no test for this in the testsuite so
far. I've noticed the warnings in testing glibc first where we use a
number of noreturn attributes.
I'd like to put this patch into the testsuite. Ok, to commit?
Andreas
2000-05-04 Andreas Jaeger <aj@suse.de>
* gcc.dg/noreturn-2.c: New test.
/* Check for invalid "noreturn" warning. */
/* { dg-do compile } */
/* { dg-options "-O3 -Wall" } */
extern void abort (void) __attribute__ ((__noreturn__));
void noreturn (int x) __attribute__ ((__noreturn__));
void
noreturn (int x)
{
abort ();
}
--
Andreas Jaeger
SuSE Labs aj@suse.de
More information about the Gcc-patches
mailing list