From: Kaveh R. Ghazi Date: Mon, 28 Aug 2000 01:06:33 +0000 (+0000) Subject: * gcc.dg/return-type-2.c: New test. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bbfbf340fc90540e37aff95581596c7225ae926b;p=gcc.git * gcc.dg/return-type-2.c: New test. From-SVN: r36010 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5f478db13cf..6466b590df8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2000-08-27 Kaveh R. Ghazi + + * gcc.dg/return-type-2.c: New test. + 2000-08-27 Geoff Keating * gcc.c-torture/compile/20000825-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/return-type-2.c b/gcc/testsuite/gcc.dg/return-type-2.c new file mode 100644 index 00000000000..183c6a88d40 --- /dev/null +++ b/gcc/testsuite/gcc.dg/return-type-2.c @@ -0,0 +1,47 @@ +/* Bogus warnings claiming we fall off the end of a non-void function. + By Kaveh R. Ghazi 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); +}