1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -fms-compatibility -fsyntax-only -verify %s 2*0a6a1f1dSLionel Sambuc 3*0a6a1f1dSLionel Sambuc int foo() __attribute__((optnone)); 4*0a6a1f1dSLionel Sambuc int bar() __attribute__((optnone)) __attribute__((noinline)); 5*0a6a1f1dSLionel Sambuc 6*0a6a1f1dSLionel Sambuc int baz() __attribute__((always_inline)) __attribute__((optnone)); // expected-warning{{'always_inline' attribute ignored}} expected-note{{conflicting attribute is here}} 7*0a6a1f1dSLionel Sambuc int quz() __attribute__((optnone)) __attribute__((always_inline)); // expected-warning{{'always_inline' attribute ignored}} expected-note{{conflicting attribute is here}} 8*0a6a1f1dSLionel Sambuc 9*0a6a1f1dSLionel Sambuc __attribute__((always_inline)) int baz1(); // expected-warning{{'always_inline' attribute ignored}} baz1()10*0a6a1f1dSLionel Sambuc__attribute__((optnone)) int baz1() { return 1; } // expected-note{{conflicting attribute is here}} 11*0a6a1f1dSLionel Sambuc 12*0a6a1f1dSLionel Sambuc __attribute__((optnone)) int quz1(); // expected-note{{conflicting attribute is here}} quz1()13*0a6a1f1dSLionel Sambuc__attribute__((always_inline)) int quz1() { return 1; } // expected-warning{{'always_inline' attribute ignored}} 14*0a6a1f1dSLionel Sambuc 15*0a6a1f1dSLionel Sambuc int bay() __attribute__((minsize)) __attribute__((optnone)); // expected-warning{{'minsize' attribute ignored}} expected-note{{conflicting}} 16*0a6a1f1dSLionel Sambuc int quy() __attribute__((optnone)) __attribute__((minsize)); // expected-warning{{'minsize' attribute ignored}} expected-note{{conflicting}} 17*0a6a1f1dSLionel Sambuc 18*0a6a1f1dSLionel Sambuc __attribute__((minsize)) int bay1(); // expected-warning{{'minsize' attribute ignored}} bay1()19*0a6a1f1dSLionel Sambuc__attribute__((optnone)) int bay1() { return 1; } // expected-note{{conflicting attribute is here}} 20*0a6a1f1dSLionel Sambuc 21*0a6a1f1dSLionel Sambuc __attribute__((optnone)) int quy1(); // expected-note{{conflicting attribute is here}} quy1()22*0a6a1f1dSLionel Sambuc__attribute__((minsize)) int quy1() { return 1; } // expected-warning{{'minsize' attribute ignored}} 23*0a6a1f1dSLionel Sambuc 24*0a6a1f1dSLionel Sambuc __attribute__((always_inline)) // expected-warning{{'always_inline' attribute ignored}} 25*0a6a1f1dSLionel Sambuc __attribute__((minsize)) // expected-warning{{'minsize' attribute ignored}} 26*0a6a1f1dSLionel Sambuc void bay2(); 27*0a6a1f1dSLionel Sambuc __attribute__((optnone)) // expected-note 2 {{conflicting}} bay2()28*0a6a1f1dSLionel Sambucvoid bay2() {} 29*0a6a1f1dSLionel Sambuc 30*0a6a1f1dSLionel Sambuc __forceinline __attribute__((optnone)) int bax(); // expected-warning{{'__forceinline' attribute ignored}} expected-note{{conflicting}} 31*0a6a1f1dSLionel Sambuc __attribute__((optnone)) __forceinline int qux(); // expected-warning{{'__forceinline' attribute ignored}} expected-note{{conflicting}} 32*0a6a1f1dSLionel Sambuc 33*0a6a1f1dSLionel Sambuc __forceinline int bax2(); // expected-warning{{'__forceinline' attribute ignored}} bax2()34*0a6a1f1dSLionel Sambuc__attribute__((optnone)) int bax2() { return 1; } // expected-note{{conflicting}} 35*0a6a1f1dSLionel Sambuc __attribute__((optnone)) int qux2(); // expected-note{{conflicting}} qux2()36*0a6a1f1dSLionel Sambuc__forceinline int qux2() { return 1; } // expected-warning{{'__forceinline' attribute ignored}} 37*0a6a1f1dSLionel Sambuc 38*0a6a1f1dSLionel Sambuc int globalVar __attribute__((optnone)); // expected-warning{{'optnone' attribute only applies to functions}} 39*0a6a1f1dSLionel Sambuc 40*0a6a1f1dSLionel Sambuc int fubar(int __attribute__((optnone)), int); // expected-warning{{'optnone' attribute only applies to functions}} 41*0a6a1f1dSLionel Sambuc 42*0a6a1f1dSLionel Sambuc struct A { 43*0a6a1f1dSLionel Sambuc int aField __attribute__((optnone)); // expected-warning{{'optnone' attribute only applies to functions}} 44*0a6a1f1dSLionel Sambuc }; 45*0a6a1f1dSLionel Sambuc 46*0a6a1f1dSLionel Sambuc struct B { 47*0a6a1f1dSLionel Sambuc void foo() __attribute__((optnone)); 48*0a6a1f1dSLionel Sambuc static void bar() __attribute__((optnone)); 49*0a6a1f1dSLionel Sambuc }; 50*0a6a1f1dSLionel Sambuc 51*0a6a1f1dSLionel Sambuc // Verify that we can specify the [[clang::optnone]] syntax as well. 52*0a6a1f1dSLionel Sambuc 53*0a6a1f1dSLionel Sambuc [[clang::optnone]] 54*0a6a1f1dSLionel Sambuc int foo2(); 55*0a6a1f1dSLionel Sambuc [[clang::optnone]] 56*0a6a1f1dSLionel Sambuc int bar2() __attribute__((noinline)); 57*0a6a1f1dSLionel Sambuc 58*0a6a1f1dSLionel Sambuc [[clang::optnone]] // expected-note {{conflicting}} 59*0a6a1f1dSLionel Sambuc int baz2() __attribute__((always_inline)); // expected-warning{{'always_inline' attribute ignored}} 60*0a6a1f1dSLionel Sambuc 61*0a6a1f1dSLionel Sambuc [[clang::optnone]] int globalVar2; //expected-warning{{'optnone' attribute only applies to functions}} 62*0a6a1f1dSLionel Sambuc 63*0a6a1f1dSLionel Sambuc struct A2 { 64*0a6a1f1dSLionel Sambuc [[clang::optnone]] int aField; // expected-warning{{'optnone' attribute only applies to functions}} 65*0a6a1f1dSLionel Sambuc }; 66*0a6a1f1dSLionel Sambuc 67*0a6a1f1dSLionel Sambuc struct B2 { 68*0a6a1f1dSLionel Sambuc [[clang::optnone]] 69*0a6a1f1dSLionel Sambuc void foo(); 70*0a6a1f1dSLionel Sambuc [[clang::optnone]] 71*0a6a1f1dSLionel Sambuc static void bar(); 72*0a6a1f1dSLionel Sambuc }; 73*0a6a1f1dSLionel Sambuc 74