]> granicus.if.org Git - clang/commitdiff
Add language standard aliases for -std=c18, -std=gnu18, and -std=iso9899:2018.
authorAaron Ballman <aaron@aaronballman.com>
Thu, 18 Oct 2018 17:42:41 +0000 (17:42 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 18 Oct 2018 17:42:41 +0000 (17:42 +0000)
As described in D40225, the C17 standard was balloted and approved in 2017, but the ISO publication process delayed the actual publication until 2018. WG14 considers the release to be C17 and describes it as such, but users can still be confused by the publication year which is why -std=c18 adds value. These aliases map to c17 and are all supported by GCC 8.x with the same behavior. Note that the value of __STDC_VERSION__ remains at 201710L.

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

include/clang/Frontend/LangStandards.def
test/Driver/unknown-std.c
test/Preprocessor/c17.c

index 1e895d785d15c4ab91e243a0fe99d4c405b771f5..0fdd35f32034eafc3f759fea3a8aec595c9b564e 100644 (file)
@@ -82,9 +82,12 @@ LANGSTANDARD(c17, "c17",
              C, "ISO C 2017",
              LineComment | C99 | C11 | C17 | Digraphs | HexFloat)
 LANGSTANDARD_ALIAS(c17, "iso9899:2017")
+LANGSTANDARD_ALIAS(c17, "c18")
+LANGSTANDARD_ALIAS(c17, "iso9899:2018")
 LANGSTANDARD(gnu17, "gnu17",
              C, "ISO C 2017 with GNU extensions",
              LineComment | C99 | C11 | C17 | Digraphs | GNUMode | HexFloat)
+LANGSTANDARD_ALIAS(gnu17, "gnu18")
 
 // C++ modes
 LANGSTANDARD(cxx98, "c++98",
index 9ef70a4227a6642c547cdb6305e52af2c2574629..86515506511a7e884daf6c8cbf946ddb75172f51 100644 (file)
@@ -14,8 +14,8 @@
 // CHECK-NEXT: note: use 'gnu99' for 'ISO C 1999 with GNU extensions' standard
 // CHECK-NEXT: note: use 'c11' or 'iso9899:2011' for 'ISO C 2011' standard
 // CHECK-NEXT: note: use 'gnu11' for 'ISO C 2011 with GNU extensions' standard
-// CHECK-NEXT: note: use 'c17' or 'iso9899:2017' for 'ISO C 2017' standard
-// CHECK-NEXT: note: use 'gnu17' for 'ISO C 2017 with GNU extensions' standard
+// CHECK-NEXT: note: use 'c17', 'iso9899:2017', 'c18', or 'iso9899:2018' for 'ISO C 2017' standard
+// CHECK-NEXT: note: use 'gnu17' or 'gnu18' for 'ISO C 2017 with GNU extensions' standard
 
 // Make sure that no other output is present.
 // CHECK-NOT: {{^.+$}}
index c610e84f98307b5364fac3ce4893f8e131ec03dd..7031eec11ed546b677c4ee54ca6b3a7dc070ce50 100644 (file)
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c17 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c18 %s
 // expected-no-diagnostics
 
 _Static_assert(__STDC_VERSION__ == 201710L, "Incorrect __STDC_VERSION__");