aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2000-08-28 01:06:33 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2000-08-28 01:06:33 +0000
commitbbfbf340fc90540e37aff95581596c7225ae926b (patch)
treeafc7362a05fbc8c33ab7d0d31a55169a93247373
parent6e88e75cc25634f1f5ff2ce8a35ad4fcfb3ba764 (diff)
downloadgcc-bbfbf340fc90540e37aff95581596c7225ae926b.zip
gcc-bbfbf340fc90540e37aff95581596c7225ae926b.tar.gz
gcc-bbfbf340fc90540e37aff95581596c7225ae926b.tar.bz2
* gcc.dg/return-type-2.c: New test.
From-SVN: r36010
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/return-type-2.c47
2 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5f478db..6466b59 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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.
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 0000000..183c6a8
--- /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 <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);
+}