From: Aaron Ballman Date: Thu, 18 Oct 2018 17:42:41 +0000 (+0000) Subject: Add language standard aliases for -std=c18, -std=gnu18, and -std=iso9899:2018. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ed09f041057b6671e0944fbb5b386e10bf8eaeb;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344749 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Frontend/LangStandards.def b/include/clang/Frontend/LangStandards.def index 1e895d785d..0fdd35f320 100644 --- a/include/clang/Frontend/LangStandards.def +++ b/include/clang/Frontend/LangStandards.def @@ -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", diff --git a/test/Driver/unknown-std.c b/test/Driver/unknown-std.c index 9ef70a4227..8651550651 100644 --- a/test/Driver/unknown-std.c +++ b/test/Driver/unknown-std.c @@ -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: {{^.+$}} diff --git a/test/Preprocessor/c17.c b/test/Preprocessor/c17.c index c610e84f98..7031eec11e 100644 --- a/test/Preprocessor/c17.c +++ b/test/Preprocessor/c17.c @@ -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__");