1 // RUN: %clang_cc1 -verify -fsyntax-only %s 2 3 int bar(); 4 5 [[gnu::always_inline]] void always_inline_fn(void) { } 6 [[gnu::flatten]] void flatten_fn(void) { } 7 8 [[gnu::noinline]] void noinline_fn(void) { } 9 10 void foo() { 11 [[clang::noinline]] bar(); 12 [[clang::noinline(0)]] bar(); // expected-error {{'noinline' attribute takes no arguments}} 13 int x; 14 [[clang::noinline]] x = 0; // expected-warning {{'noinline' attribute is ignored because there exists no call expression inside the statement}} 15 [[clang::noinline]] { asm("nop"); } // expected-warning {{'noinline' attribute is ignored because there exists no call expression inside the statement}} 16 [[clang::noinline]] label: x = 1; // expected-warning {{'noinline' attribute only applies to functions and statements}} 17 18 19 [[clang::noinline]] always_inline_fn(); // expected-warning {{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} 20 [[clang::noinline]] flatten_fn(); // expected-warning {{statement attribute 'noinline' has higher precedence than function attribute 'flatten'}} 21 [[clang::noinline]] noinline_fn(); 22 23 [[gnu::noinline]] bar(); // expected-warning {{attribute is ignored on this statement as it only applies to functions; use '[[clang::noinline]]' on statements}} 24 __attribute__((noinline)) bar(); // expected-warning {{attribute is ignored on this statement as it only applies to functions; use '[[clang::noinline]]' on statements}} 25 } 26 27 [[clang::noinline]] static int i = bar(); // expected-warning {{'noinline' attribute only applies to functions and statements}} 28