1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 #pragma clang optimize off 4 5 #pragma clang optimize on 6 7 // Extra arguments 8 #pragma clang optimize on top of spaghetti // expected-error {{unexpected extra argument 'top' to '#pragma clang optimize'}} 9 10 // Wrong argument 11 #pragma clang optimize something_wrong // expected-error {{unexpected argument 'something_wrong' to '#pragma clang optimize'; expected 'on' or 'off'}} 12 13 // No argument 14 #pragma clang optimize // expected-error {{missing argument to '#pragma clang optimize'; expected 'on' or 'off'}} 15 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 21 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 29