diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2002-07-06 00:25:30 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2002-07-06 00:25:30 +0000 |
commit | 8537dbae0f09c5300ca65bf88e48121c11154b18 (patch) | |
tree | ba16c52f497593df9c56fb4d4c58061f8bb93d69 | |
parent | df061a43b6051ab6d4756f1e5676c1e16b4a4f99 (diff) | |
download | gcc-8537dbae0f09c5300ca65bf88e48121c11154b18.zip gcc-8537dbae0f09c5300ca65bf88e48121c11154b18.tar.gz gcc-8537dbae0f09c5300ca65bf88e48121c11154b18.tar.bz2 |
re PR c++/7099 (G++ doesn't set the noreturn attribute on std::exit and std::abort)
2002-07-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
PR c++/7099
* g++.dg/warn/noreturn1.C: New test.
From-SVN: r55277
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/noreturn-1.C | 71 |
2 files changed, 76 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8880177..8ce200d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..17375d4 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/noreturn-1.C @@ -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); +} + |