]> granicus.if.org Git - clang/commitdiff
Give __STDC_VERSION__ the value 201001L when we're in C1x mode. The
authorDouglas Gregor <dgregor@apple.com>
Fri, 28 Oct 2011 23:02:54 +0000 (23:02 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 28 Oct 2011 23:02:54 +0000 (23:02 +0000)
committee hasn't set a value for __STDC_VERSION__ yet, so this is a
placeholder. But at least it's > 199901L.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143245 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/InitPreprocessor.cpp
test/Lexer/has_feature_c1x.c

index 1f2f4256d3b6e9d838ec9a8816e8119e79a17a21..d0a87bd888ed63c5fef991e2093b452b2b9a7782 100644 (file)
@@ -286,7 +286,12 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
     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");
index ca4e9b95ad04b844401a1dd4a688e99a8e42e83f..a502f16ce3ffd21fd374e385f39adba47b5f6e5f 100644 (file)
@@ -27,3 +27,12 @@ int no_alignas();
 
 // 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