blob: eaa50004047c4098de4dc6eab47ad5d8e1d953e2 [file] [log] [blame]
Stephen Hines651f13c2014-04-23 16:59:28 -07001// RUN: %clang_cc1 -std=c++11 -fms-compatibility -fsyntax-only -verify %s
2
3int foo() __attribute__((optnone));
4int bar() __attribute__((optnone)) __attribute__((noinline));
5
6int baz() __attribute__((always_inline)) __attribute__((optnone)); // expected-error{{'always_inline' and 'optnone' attributes are not compatible}}
7int quz() __attribute__((optnone)) __attribute__((always_inline)); // expected-error{{'optnone' and 'always_inline' attributes are not compatible}}
8
9__forceinline __attribute__((optnone)) int bax(); // expected-error{{'__forceinline' and 'optnone' attributes are not compatible}}
10__attribute__((optnone)) __forceinline int qux(); // expected-error{{'optnone' and '__forceinline' attributes are not compatible}}
11
12int globalVar __attribute__((optnone)); // expected-warning{{'optnone' attribute only applies to functions}}
13
14int fubar(int __attribute__((optnone)), int); // expected-warning{{'optnone' attribute only applies to functions}}
15
16struct A {
17 int aField __attribute__((optnone)); // expected-warning{{'optnone' attribute only applies to functions}}
18};
19
20struct B {
21 void foo() __attribute__((optnone));
22 static void bar() __attribute__((optnone));
23};
24
25// Verify that we can specify the [[clang::optnone]] syntax as well.
26
27[[clang::optnone]]
28int foo2();
29[[clang::optnone]]
30int bar2() __attribute__((noinline));
31
32[[clang::optnone]]
33int baz2() __attribute__((always_inline)); // expected-error{{'always_inline' and 'optnone' attributes are not compatible}}
34
35[[clang::optnone]] int globalVar2; //expected-warning{{'optnone' attribute only applies to functions}}
36
37struct A2 {
38 [[clang::optnone]] int aField; // expected-warning{{'optnone' attribute only applies to functions}}
39};
40
41struct B2 {
42 [[clang::optnone]]
43 void foo();
44 [[clang::optnone]]
45 static void bar();
46};
47