]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/7099 (G++ doesn't set the noreturn attribute on std::exit and std::abort)
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Sat, 6 Jul 2002 00:25:30 +0000 (00:25 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sat, 6 Jul 2002 00:25:30 +0000 (00:25 +0000)
2002-07-05  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

        PR c++/7099
        * g++.dg/warn/noreturn1.C: New test.

From-SVN: r55277

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/noreturn-1.C [new file with mode: 0644]

index 8880177b83a26565879e51eedd82796170558aca..8ce200dd0e5368af9749025e5bc7bcd098fdefbb 100644 (file)
@@ -1,3 +1,8 @@
+2002-07-05  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       PR c++/7099
+        * g++.dg/warn/noreturn1.C: New test.
+
 2002-07-03  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/6706
diff --git a/gcc/testsuite/g++.dg/warn/noreturn-1.C b/gcc/testsuite/g++.dg/warn/noreturn-1.C
new file mode 100644 (file)
index 0000000..17375d4
--- /dev/null
@@ -0,0 +1,71 @@
+// Test that noreturn attributes are properly set.
+// Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> 2002-06-18.
+// { dg-do compile }
+// { dg-options "-Wall -O2" }
+
+#include <cstdlib>
+
+int foo1 (int i)
+{
+  switch (i)
+    {
+    case 1:
+    case 2:
+      return i;
+    }
+  abort();
+}
+
+int foo2 (int i)
+{
+  switch (i)
+    {
+    case 1:
+    case 2:
+      return i;
+    }
+  std::abort();
+}
+
+int foo3 (int i)
+{
+  switch (i)
+    {
+    case 1:
+    case 2:
+      return i;
+    }
+  exit(1);
+}
+
+int foo4 (int i)
+{
+  switch (i)
+    {
+    case 1:
+    case 2:
+      return i;
+    }
+  std::exit(1);
+}
+
+void __attribute__ ((__noreturn__)) foo5 ()
+{
+  abort();
+}
+
+void __attribute__ ((__noreturn__)) foo6 ()
+{
+  std::abort();
+}
+
+void __attribute__ ((__noreturn__)) foo7 ()
+{
+  exit(1);
+}
+
+void __attribute__ ((__noreturn__)) foo8 ()
+{
+  std::exit(1);
+}
+
This page took 0.092543 seconds and 5 git commands to generate.