[cfe-commits] r143245 - in /cfe/trunk: lib/Frontend/InitPreprocessor.cpp test/Lexer/has_feature_c1x.c

Douglas Gregor dgregor at apple.com
Fri Oct 28 16:02:54 PDT 2011


Author: dgregor
Date: Fri Oct 28 18:02:54 2011
New Revision: 143245

URL: http://llvm.org/viewvc/llvm-project?rev=143245&view=rev
Log:
Give __STDC_VERSION__ the value 201001L when we're in C1x mode. The
committee hasn't set a value for __STDC_VERSION__ yet, so this is a
placeholder. But at least it's > 199901L.

Modified:
    cfe/trunk/lib/Frontend/InitPreprocessor.cpp
    cfe/trunk/test/Lexer/has_feature_c1x.c

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=143245&r1=143244&r2=143245&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Fri Oct 28 18:02:54 2011
@@ -286,7 +286,12 @@
     Builder.defineMacro("__STDC_HOSTED__");
 
   if (!LangOpts.CPlusPlus) {
-    if (LangOpts.C99)
+    // FIXME: C1x doesn't have a defined version number yet, so pick something
+    // that is the minimum possible according to their placeholder scheme
+    // 201ymmL.
+    if (LangOpts.C1X)
+      Builder.defineMacro("__STDC_VERSION__", "201001L");
+    else if (LangOpts.C99)
       Builder.defineMacro("__STDC_VERSION__", "199901L");
     else if (!LangOpts.GNUMode && LangOpts.Digraphs)
       Builder.defineMacro("__STDC_VERSION__", "199409L");

Modified: cfe/trunk/test/Lexer/has_feature_c1x.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/has_feature_c1x.c?rev=143245&r1=143244&r2=143245&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/has_feature_c1x.c (original)
+++ cfe/trunk/test/Lexer/has_feature_c1x.c Fri Oct 28 18:02:54 2011
@@ -27,3 +27,12 @@
 
 // CHECK-1X: has_alignas
 // CHECK-NO-1X: no_alignas
+
+#if __STDC_VERSION__ > 199901L
+int is_c1x();
+#else
+int is_not_c1x();
+#endif
+
+// CHECK-1X: is_c1x
+// CHECK-NO-1X: is_not_c1x





More information about the cfe-commits mailing list