[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Parser / pragma-optimize-diagnostics.cpp
blobaf11a4ef8153bd031b2e92a0e1931a821d905d2b
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 #pragma clang optimize off
5 #pragma clang optimize on
7 // Extra arguments
8 #pragma clang optimize on top of spaghetti // expected-error {{unexpected extra argument 'top' to '#pragma clang optimize'}}
10 // Wrong argument
11 #pragma clang optimize something_wrong // expected-error {{unexpected argument 'something_wrong' to '#pragma clang optimize'; expected 'on' or 'off'}}
13 // No argument
14 #pragma clang optimize // expected-error {{missing argument to '#pragma clang optimize'; expected 'on' or 'off'}}
16 // Check that macros can be used in the pragma
17 #define OFF off
18 #define ON on
19 #pragma clang optimize OFF
20 #pragma clang optimize ON
22 // Check that _Pragma can also be used to address the use case where users want
23 // to define optimization control macros to abstract out which compiler they are
24 // using.
25 #define OPT_OFF _Pragma("clang optimize off")
26 #define OPT_ON _Pragma("clang optimize on")
27 OPT_OFF
28 OPT_ON