1 /* Check for various valid and erroneous "noreturn" cases. */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -Wmissing-noreturn" } */
5 extern void exit (int);
7 extern void foo1(void) __attribute__ ((__noreturn__
));
11 } /* { dg-warning "`noreturn' function does return" "detect falling off end of noreturn" } */
13 extern void foo2(void) __attribute__ ((__noreturn__
));
18 } /* { dg-bogus "warning:" "this function should not get any warnings" } */
20 extern void foo3(void);
24 } /* { dg-bogus "warning:" "this function should not get any warnings" } */
26 extern void foo4(void);
31 } /* { dg-warning "candidate for attribute `noreturn'" "detect noreturn candidate" } */
33 extern void foo5(void) __attribute__ ((__noreturn__
));
37 return; /* { dg-warning "`noreturn' has a `return' statement" "detect invalid return" } */
38 } /* { dg-warning "`noreturn' function does return" "detect return from noreturn" } */
40 extern void foo6(void);
45 } /* { dg-bogus "warning:" "this function should not get any warnings" } */
47 extern void foo7(void);
52 } /* { dg-bogus "warning:" "this function should not get any warnings" } */
54 extern void foo8(void) __attribute__ ((__noreturn__
));
59 } /* { dg-warning "`noreturn' function does return" "detect return from tail call" } */