xref: /llvm-project/clang/test/Sema/attr-function-return.c (revision 2d0137dd64017c34101f8a763fd8958c20acd6bb)
1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -verify %s
2 
x(void)3 __attribute__((function_return("keep"))) void x(void) {}
4 
5 // expected-warning@+1 {{'function_return' attribute argument not supported: thunk}}
y(void)6 __attribute__((function_return("thunk"))) void y(void) {}
7 
8 // expected-warning@+1 {{'function_return' attribute argument not supported: thunk-inline}}
z(void)9 __attribute__((function_return("thunk-inline"))) void z(void) {}
10 
w(void)11 __attribute__((function_return("thunk-extern"))) void w(void) {}
12 
13 // expected-warning@+1 {{'function_return' attribute argument not supported: invalid}}
v(void)14 __attribute__((function_return("invalid"))) void v(void) {}
15 
16 // expected-error@+1 {{expected string literal as argument of 'function_return' attribute}}
a(void)17 __attribute__((function_return(5))) void a(void) {}
18 
19 // expected-error@+1 {{'function_return' attribute takes one argument}}
b(void)20 __attribute__((function_return)) void b(void) {}
21 
22 // expected-warning@+1 {{'function_return' attribute only applies to functions}}
23 __attribute__((function_return)) int c;
24