mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-30 23:55:56 +08:00
* gcc.dg/return-type-2.c: New test.
From-SVN: r36010
This commit is contained in:
parent
6e88e75cc2
commit
bbfbf340fc
@ -1,3 +1,7 @@
|
||||
2000-08-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* gcc.dg/return-type-2.c: New test.
|
||||
|
||||
2000-08-27 Geoff Keating <geoffk@cygnus.com>
|
||||
|
||||
* gcc.c-torture/compile/20000825-1.c: New test.
|
||||
|
47
gcc/testsuite/gcc.dg/return-type-2.c
Normal file
47
gcc/testsuite/gcc.dg/return-type-2.c
Normal file
@ -0,0 +1,47 @@
|
||||
/* Bogus warnings claiming we fall off the end of a non-void function.
|
||||
By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/27/2000. */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -Wreturn-type" } */
|
||||
|
||||
extern void abort (void) __attribute__ ((__noreturn__));
|
||||
|
||||
int
|
||||
foo1 (int i)
|
||||
{
|
||||
if (i)
|
||||
return i;
|
||||
|
||||
abort ();
|
||||
} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */
|
||||
|
||||
__inline__ int
|
||||
foo2 (int i)
|
||||
{
|
||||
if (i)
|
||||
return i;
|
||||
|
||||
abort ();
|
||||
} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */
|
||||
|
||||
static int
|
||||
foo3 (int i)
|
||||
{
|
||||
if (i)
|
||||
return i;
|
||||
|
||||
abort ();
|
||||
} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */
|
||||
|
||||
static __inline__ int
|
||||
foo4 (int i)
|
||||
{
|
||||
if (i)
|
||||
return i;
|
||||
|
||||
abort ();
|
||||
} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */
|
||||
|
||||
int bar (int i)
|
||||
{
|
||||
return foo1 (i) + foo2 (i) + foo3 (i) + foo4 (i);
|
||||
}
|
Loading…
Reference in New Issue
Block a user