1 // RUN: %clang_cc1 -verify -Wno-strict-prototypes -fsyntax-only %s
3 static void (*fp0
)(void) __attribute__((noreturn
));
7 static void __attribute__((noreturn
)) f0(void) {
9 } // expected-warning {{function declared 'noreturn' should not return}}
12 int f1() __attribute__((noreturn
));
14 int g0
__attribute__((noreturn
)); // expected-warning {{'noreturn' only applies to function types; type here is 'int'}}
16 int f2(void) __attribute__((noreturn(1, 2))); // expected-error {{'noreturn' attribute takes no arguments}}
18 void f3(void) __attribute__((noreturn
));
20 return; // expected-warning {{function 'f3' declared 'noreturn' should not return}}
23 #pragma clang diagnostic error "-Winvalid-noreturn"
25 void f4(void) __attribute__((noreturn
));
27 return; // expected-error {{function 'f4' declared 'noreturn' should not return}}
31 extern void f5 (unsigned long) __attribute__ ((__noreturn__
));
34 f5 (unsigned long size
)
40 __attribute__((noreturn
)) void f(__attribute__((noreturn
)) void (*x
)(void)) {
44 typedef void (*Fun
)(void) __attribute__ ((noreturn(2))); // expected-error {{'noreturn' attribute takes no arguments}}
47 typedef void fn_t(void);
49 fn_t
*fp
__attribute__((noreturn
));
50 void __attribute__((noreturn
)) f6(int i
) {
54 fn_t
*fps
[4] __attribute__((noreturn
));
55 void __attribute__((noreturn
)) f7(int i
) {
59 extern fn_t
*ifps
[] __attribute__((noreturn
));
60 void __attribute__((noreturn
)) f8(int i
) {
64 void __attribute__((noreturn
)) f9(int n
) {
65 extern int g9(int, fn_t
**);
66 fn_t
*fp
[n
] __attribute__((noreturn
));
71 typedef fn_t
*fptrs_t
[4];
72 fptrs_t ps
__attribute__((noreturn
));
73 void __attribute__((noreturn
)) f10(int i
) {