1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2*0a6a1f1dSLionel Sambuc 3*0a6a1f1dSLionel Sambuc #pragma clang optimize off 4*0a6a1f1dSLionel Sambuc 5*0a6a1f1dSLionel Sambuc #pragma clang optimize on 6*0a6a1f1dSLionel Sambuc 7*0a6a1f1dSLionel Sambuc // Extra arguments 8*0a6a1f1dSLionel Sambuc #pragma clang optimize on top of spaghetti // expected-error {{unexpected extra argument 'top' to '#pragma clang optimize'}} 9*0a6a1f1dSLionel Sambuc 10*0a6a1f1dSLionel Sambuc // Wrong argument 11*0a6a1f1dSLionel Sambuc #pragma clang optimize something_wrong // expected-error {{unexpected argument 'something_wrong' to '#pragma clang optimize'; expected 'on' or 'off'}} 12*0a6a1f1dSLionel Sambuc 13*0a6a1f1dSLionel Sambuc // No argument 14*0a6a1f1dSLionel Sambuc #pragma clang optimize // expected-error {{missing argument to '#pragma clang optimize'; expected 'on' or 'off'}} 15*0a6a1f1dSLionel Sambuc 16*0a6a1f1dSLionel Sambuc // Check that macros can be used in the pragma 17*0a6a1f1dSLionel Sambuc #define OFF off 18*0a6a1f1dSLionel Sambuc #define ON on 19*0a6a1f1dSLionel Sambuc #pragma clang optimize OFF 20*0a6a1f1dSLionel Sambuc #pragma clang optimize ON 21*0a6a1f1dSLionel Sambuc 22*0a6a1f1dSLionel Sambuc // Check that _Pragma can also be used to address the use case where users want 23*0a6a1f1dSLionel Sambuc // to define optimization control macros to abstract out which compiler they are 24*0a6a1f1dSLionel Sambuc // using. 25*0a6a1f1dSLionel Sambuc #define OPT_OFF _Pragma("clang optimize off") 26*0a6a1f1dSLionel Sambuc #define OPT_ON _Pragma("clang optimize on") 27*0a6a1f1dSLionel Sambuc OPT_OFF 28*0a6a1f1dSLionel Sambuc OPT_ON 29