2009-03-24 05:24:46 +03:00
|
|
|
// RUN: clang-cc -verify -fsyntax-only %s
|
2008-10-19 06:04:16 +04:00
|
|
|
|
|
|
|
static void (*fp0)(void) __attribute__((noreturn));
|
|
|
|
|
|
|
|
static void __attribute__((noreturn)) f0(void) {
|
|
|
|
fatal();
|
|
|
|
}
|
|
|
|
|
|
|
|
// On K&R
|
|
|
|
int f1() __attribute__((noreturn));
|
|
|
|
|
|
|
|
int g0 __attribute__((noreturn)); // expected-warning {{'noreturn' attribute only applies to function types}}
|
|
|
|
|
|
|
|
int f2() __attribute__((noreturn(1, 2))); // expected-error {{attribute requires 0 argument(s)}}
|
2009-04-29 04:43:21 +04:00
|
|
|
|
|
|
|
void f3() __attribute__((noreturn));
|
|
|
|
|
|
|
|
void f3() {
|
|
|
|
return; // expected-error {{function 'f3' declared 'noreturn' should not return}}
|
|
|
|
}
|
|
|
|
|