[cfe-commits] r69556 - in /cfe/trunk: include/clang/Basic/DiagnosticLexKinds.td lib/Lex/Pragma.cpp test/Preprocessor/pragma_unknown.c

Chris Lattner sabre at nondot.org
Sun Apr 19 14:55:32 PDT 2009


Author: lattner
Date: Sun Apr 19 16:55:32 2009
New Revision: 69556

URL: http://llvm.org/viewvc/llvm-project?rev=69556&view=rev
Log:
Warn about uses of #pragma STDC FENV_ACCESS ON, since we don't 
support it.  I don't know what evaluation method we use for complex
arithmetic, so I don't know whether/if we should warn about use of
CX_LIMITED_RANGE.

This concludes my planned hacking on STDC pragmas, flame away :)

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
    cfe/trunk/lib/Lex/Pragma.cpp
    cfe/trunk/test/Preprocessor/pragma_unknown.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=69556&r1=69555&r2=69556&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Sun Apr 19 16:55:32 2009
@@ -214,6 +214,10 @@
 def ext_stdc_pragma_syntax_eom :
    ExtWarn<"expected end of macro in STDC pragma">,
    InGroup<UnknownPragmas>;
+def warn_stdc_fenv_access_not_supported :
+   ExtWarn<"pragma STDC FENV_ACCESS ON is not supported, ignoring pragma">,
+   InGroup<UnknownPragmas>;
+
 def err_pragma_comment_unknown_kind : Error<"unknown kind of pragma comment">;
 def err_defined_macro_name : Error<"'defined' cannot be used as a macro name">;
 def err_paste_at_start : Error<

Modified: cfe/trunk/lib/Lex/Pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Pragma.cpp?rev=69556&r1=69555&r2=69556&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Pragma.cpp (original)
+++ cfe/trunk/lib/Lex/Pragma.cpp Sun Apr 19 16:55:32 2009
@@ -560,7 +560,8 @@
 struct PragmaSTDC_FENV_ACCESSHandler : public PragmaHandler {
   PragmaSTDC_FENV_ACCESSHandler(const IdentifierInfo *ID) : PragmaHandler(ID) {}
   virtual void HandlePragma(Preprocessor &PP, Token &Tok) {
-    LexOnOffSwitch(PP);
+    if (LexOnOffSwitch(PP) == STDC_ON)
+      PP.Diag(Tok, diag::warn_stdc_fenv_access_not_supported);
   }
 };
   

Modified: cfe/trunk/test/Preprocessor/pragma_unknown.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/pragma_unknown.c?rev=69556&r1=69555&r2=69556&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/pragma_unknown.c (original)
+++ cfe/trunk/test/Preprocessor/pragma_unknown.c Sun Apr 19 16:55:32 2009
@@ -10,7 +10,7 @@
 #pragma STDC FP_CONTRACT DEFAULT
 #pragma STDC FP_CONTRACT IN_BETWEEN  // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}
 
-#pragma STDC FENV_ACCESS ON
+#pragma STDC FENV_ACCESS ON          // expected-warning {{pragma STDC FENV_ACCESS ON is not supported, ignoring pragma}}
 #pragma STDC FENV_ACCESS OFF
 #pragma STDC FENV_ACCESS DEFAULT
 #pragma STDC FENV_ACCESS IN_BETWEEN   // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}





More information about the cfe-commits mailing list