2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / return-type-2.c
blob183c6a88d4045926f86cf0fe11ab9dced481f827
1 /* Bogus warnings claiming we fall off the end of a non-void function.
2 By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/27/2000. */
3 /* { dg-do compile } */
4 /* { dg-options "-O2 -Wreturn-type" } */
6 extern void abort (void) __attribute__ ((__noreturn__));
8 int
9 foo1 (int i)
11 if (i)
12 return i;
14 abort ();
15 } /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */
17 __inline__ int
18 foo2 (int i)
20 if (i)
21 return i;
23 abort ();
24 } /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */
26 static int
27 foo3 (int i)
29 if (i)
30 return i;
32 abort ();
33 } /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */
35 static __inline__ int
36 foo4 (int i)
38 if (i)
39 return i;
41 abort ();
42 } /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */
44 int bar (int i)
46 return foo1 (i) + foo2 (i) + foo3 (i) + foo4 (i);