1 // RUN: %clang_cc1 -std=c++11 -fms-compatibility -fsyntax-only -verify %s
3 int foo() __attribute__((optnone
));
4 int bar() __attribute__((optnone
)) __attribute__((noinline
));
6 int baz() __attribute__((always_inline
)) __attribute__((optnone
)); // expected-warning{{'always_inline' attribute ignored}} expected-note{{conflicting attribute is here}}
7 int quz() __attribute__((optnone
)) __attribute__((always_inline
)); // expected-warning{{'always_inline' attribute ignored}} expected-note{{conflicting attribute is here}}
9 __attribute__((always_inline
)) int baz1(); // expected-warning{{'always_inline' attribute ignored}}
10 __attribute__((optnone
)) int baz1() { return 1; } // expected-note{{conflicting attribute is here}}
12 __attribute__((optnone
)) int quz1(); // expected-note{{conflicting attribute is here}}
13 __attribute__((always_inline
)) int quz1() { return 1; } // expected-warning{{'always_inline' attribute ignored}}
15 int bay() __attribute__((minsize
)) __attribute__((optnone
)); // expected-warning{{'minsize' attribute ignored}} expected-note{{conflicting}}
16 int quy() __attribute__((optnone
)) __attribute__((minsize
)); // expected-warning{{'minsize' attribute ignored}} expected-note{{conflicting}}
18 __attribute__((minsize
)) int bay1(); // expected-warning{{'minsize' attribute ignored}}
19 __attribute__((optnone
)) int bay1() { return 1; } // expected-note{{conflicting attribute is here}}
21 __attribute__((optnone
)) int quy1(); // expected-note{{conflicting attribute is here}}
22 __attribute__((minsize
)) int quy1() { return 1; } // expected-warning{{'minsize' attribute ignored}}
24 __attribute__((always_inline
)) // expected-warning{{'always_inline' attribute ignored}}
25 __attribute__((minsize
)) // expected-warning{{'minsize' attribute ignored}}
27 __attribute__((optnone
)) // expected-note 2 {{conflicting}}
30 __forceinline
__attribute__((optnone
)) int bax(); // expected-warning{{'__forceinline' attribute ignored}} expected-note{{conflicting}}
31 __attribute__((optnone
)) __forceinline
int qux(); // expected-warning{{'__forceinline' attribute ignored}} expected-note{{conflicting}}
33 __forceinline
int bax2(); // expected-warning{{'__forceinline' attribute ignored}}
34 __attribute__((optnone
)) int bax2() { return 1; } // expected-note{{conflicting}}
35 __attribute__((optnone
)) int qux2(); // expected-note{{conflicting}}
36 __forceinline
int qux2() { return 1; } // expected-warning{{'__forceinline' attribute ignored}}
38 int globalVar
__attribute__((optnone
)); // expected-warning{{'optnone' attribute only applies to functions}}
40 int fubar(int __attribute__((optnone
)), int); // expected-warning{{'optnone' attribute only applies to functions}}
43 int aField
__attribute__((optnone
)); // expected-warning{{'optnone' attribute only applies to functions}}
47 void foo() __attribute__((optnone
));
48 static void bar() __attribute__((optnone
));
51 // Verify that we can specify the [[clang::optnone]] syntax as well.
56 int bar2() __attribute__((noinline
));
58 [[clang::optnone
]] // expected-note {{conflicting}}
59 int baz2() __attribute__((always_inline
)); // expected-warning{{'always_inline' attribute ignored}}
61 [[clang::optnone
]] int globalVar2
; //expected-warning{{'optnone' attribute only applies to functions}}
64 [[clang::optnone
]] int aField
; // expected-warning{{'optnone' attribute only applies to functions}}
74 // Verify that we can handle the [[_Clang::optnone]] and
75 // [[__clang__::optnone]] spellings, as well as [[clang::__optnone__]].
76 [[_Clang::optnone
]] int foo3();
77 [[__clang__::optnone
]] int foo4(); // expected-warning {{'__clang__' is a predefined macro name, not an attribute scope specifier; did you mean '_Clang' instead?}}
78 [[clang::__optnone__
]] int foo5();
79 [[_Clang::__optnone__
]] int foo6();
81 [[_Clang::optnone
]] int foo7
; // expected-warning {{'optnone' attribute only applies to functions}}