Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/g++.dg/ext/attr-noreturn-2.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/g++.dg/ext/attr-noreturn-2.C Thu Oct 25 07:37:49 2018 +0900 @@ -0,0 +1,47 @@ +/* PR c++/83871 - wrong code for attribute const and pure on distinct + template specializations + Test to verify that attributes noreturn on multiple declarations of + the same function are merged. + { dg-do compile } + { dg-options "-O -fdump-tree-optimized" } */ + +int __attribute__ ((noreturn)) fnoreturn (); + +void fnoreturn_failed (); + +int test_noreturn () throw () +{ + fnoreturn (); + fnoreturn_failed (); + // Verify that the call to fnoreturn_failed() is eliminated. + // { dg-final { scan-tree-dump-not "fnoreturn_failed" "optimized" } } + + // Expect no -Wreturn-type warning despite the absence of a return + // statement in a non-void function. +} + + +int __attribute__ ((noreturn)) fnoreturn_none (); +int fnoreturn_none (); + +void fnoreturn_none_failed (); + + +int test_noreturn_none () +{ + fnoreturn_none (); + fnoreturn_none_failed (); + // { dg-final { scan-tree-dump-not "fnoreturn_none_failed" "optimized" } } +} + +int fnone_noreturn (); +int __attribute__ ((noreturn)) fnone_noreturn (); + +void fnone_noreturn_failed (); + +int test_none_noreturn () throw () +{ + fnone_noreturn (); + fnone_noreturn_failed (); + // { dg-final { scan-tree-dump-not "fnone_noreturn_failed" "optimized" } } +}