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::always_inline]] bar(); 12 [[clang::always_inline(0)]] bar(); // expected-error {{'always_inline' attribute takes no arguments}} 13 int x; 14 [[clang::always_inline]] int i = bar(); // expected-warning {{'always_inline' attribute only applies to functions and statements}} 15 [[clang::always_inline]] x = 0; // expected-warning {{'always_inline' attribute is ignored because there exists no call expression inside the statement}} 16 [[clang::always_inline]] { asm("nop"); } // expected-warning {{'always_inline' attribute is ignored because there exists no call expression inside the statement}} 17 [[clang::always_inline]] label : x = 1; // expected-warning {{'always_inline' attribute only applies to functions and statements}} 18 19 [[clang::always_inline]] always_inline_fn(); 20 [[clang::always_inline]] noinline_fn(); // expected-warning {{statement attribute 'always_inline' has higher precedence than function attribute 'noinline'}} 21 [[clang::always_inline]] flatten_fn(); // expected-warning {{statement attribute 'always_inline' has higher precedence than function attribute 'flatten'}} 22 23 [[gnu::always_inline]] bar(); // expected-warning {{attribute is ignored on this statement as it only applies to functions; use '[[clang::always_inline]]' on statements}} 24 __attribute__((always_inline)) bar(); // expected-warning {{attribute is ignored on this statement as it only applies to functions; use '[[clang::always_inline]]' on statements}} 25 } 26 27 [[clang::always_inline]] static int i = bar(); // expected-warning {{'always_inline' attribute only applies to functions and statements}} 28