r344749 - Add language standard aliases for -std=c18, -std=gnu18, and -std=iso9899:2018.
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 18 10:42:41 PDT 2018
Author: aaronballman
Date: Thu Oct 18 10:42:41 2018
New Revision: 344749
URL: http://llvm.org/viewvc/llvm-project?rev=344749&view=rev
Log:
Add language standard aliases for -std=c18, -std=gnu18, and -std=iso9899:2018.
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.
Modified:
cfe/trunk/include/clang/Frontend/LangStandards.def
cfe/trunk/test/Driver/unknown-std.c
cfe/trunk/test/Preprocessor/c17.c
Modified: cfe/trunk/include/clang/Frontend/LangStandards.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandards.def?rev=344749&r1=344748&r2=344749&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandards.def (original)
+++ cfe/trunk/include/clang/Frontend/LangStandards.def Thu Oct 18 10:42:41 2018
@@ -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",
Modified: cfe/trunk/test/Driver/unknown-std.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/unknown-std.c?rev=344749&r1=344748&r2=344749&view=diff
==============================================================================
--- cfe/trunk/test/Driver/unknown-std.c (original)
+++ cfe/trunk/test/Driver/unknown-std.c Thu Oct 18 10:42:41 2018
@@ -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: {{^.+$}}
Modified: cfe/trunk/test/Preprocessor/c17.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/c17.c?rev=344749&r1=344748&r2=344749&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/c17.c (original)
+++ cfe/trunk/test/Preprocessor/c17.c Thu Oct 18 10:42:41 2018
@@ -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__");
More information about the cfe-commits
mailing list