URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc3/] [gcc/] [testsuite/] [g++.dg/] [warn/] [noreturn-1.C] - Rev 516
Compare with Previous | Blame | View Log
// 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);
}