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
This commit is contained in:
Kaveh R. Ghazi 2002-07-06 00:25:30 +00:00 committed by Roger Sayle
parent df061a43b6
commit 8537dbae0f
2 changed files with 76 additions and 0 deletions

View 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

View File

@ -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);
}