]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add -std=c18 etc. option aliases.
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Nov 2017 22:23:30 +0000 (22:23 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Nov 2017 22:23:30 +0000 (22:23 +0000)
ISO C17 won't go to ballot until December, meaning publication of the
standard won't be until 2018, leaving ambiguity as to whether people
will end up referring to the standard as C17, as it's currently known
and which corresponds to the __STDC_VERSION__ value, or C18 based on
the publication date.

In case people end up referring to this standard as C18, this patch
adds corresponding option aliases -std=c18, -std=iso9899:2018,
-std=gnu18 so people can use those names based on publication date if
they wish.  The "expected to be" explanations in help texts and the
manual can be removed as and when the standard is published, hopefully
before GCC 8 is out.

Bootstrapped with no regressions on x86_64-pc-linux-gnu.

gcc:
* doc/invoke.texi (-std=c17): Refer to 2018 expected publication
date of C17.
(-std=c18, -std=iso9899:2018, -std=gnu18): Document option
aliases.

gcc/c-family:
* c.opt (-std=c17, std=gnu17, -std=iso9899:2017): Refer to 2018
expected publication date of C17.
(-std=c18, -std=gnu18, -std=iso9899:2018): New option aliases.

gcc/testsuite:
* gcc.dg/c18-version-1.c, gcc.dg/c18-version-2.c: New tests.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254847 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/c18-version-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c18-version-2.c [new file with mode: 0644]

index 00b4172c8f7966ff361742f0e3a902284a44db8e..4e7f0af54faa19070cbd703d0d657f4ab38f0778 100644 (file)
@@ -1,3 +1,10 @@
+2017-11-16  Joseph Myers  <joseph@codesourcery.com>
+
+       * doc/invoke.texi (-std=c17): Refer to 2018 expected publication
+       date of C17.
+       (-std=c18, -std=iso9899:2018, -std=gnu18): Document option
+       aliases.
+
 2017-11-16  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR bootstrap/82856
index 3127635056ca7c83ba380dd178dd5e4b86341cd0..990cd6163bc2dc385125b519f364eb575ba9344b 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-16  Joseph Myers  <joseph@codesourcery.com>
+
+       * c.opt (-std=c17, std=gnu17, -std=iso9899:2017): Refer to 2018
+       expected publication date of C17.
+       (-std=c18, -std=gnu18, -std=iso9899:2018): New option aliases.
+
 2017-11-15  Joseph Myers  <joseph@codesourcery.com>
 
        PR c/81156
index 479ae63bb0e1bf197532a5b63844cf016a2c2c1b..d857dfc379295f699f68038a7208cdd1f458473b 100644 (file)
@@ -1950,7 +1950,11 @@ Deprecated in favor of -std=c11.
 
 std=c17
 C ObjC
-Conform to the ISO 2017 C standard.
+Conform to the ISO 2017 C standard (expected to be published in 2018).
+
+std=c18
+C ObjC Alias(std=c17)
+Conform to the ISO 2017 C standard (expected to be published in 2018).
 
 std=c89
 C ObjC Alias(std=c90)
@@ -2016,7 +2020,11 @@ Deprecated in favor of -std=gnu11.
 
 std=gnu17
 C ObjC
-Conform to the ISO 2017 C standard with GNU extensions.
+Conform to the ISO 2017 C standard (expected to be published in 2018) with GNU extensions.
+
+std=gnu18
+C ObjC Alias(std=gnu17)
+Conform to the ISO 2017 C standard (expected to be published in 2018) with GNU extensions.
 
 std=gnu89
 C ObjC Alias(std=gnu90)
@@ -2056,7 +2064,11 @@ Conform to the ISO 2011 C standard.
 
 std=iso9899:2017
 C ObjC Alias(std=c17)
-Conform to the ISO 2017 C standard.
+Conform to the ISO 2017 C standard (expected to be published in 2018).
+
+std=iso9899:2018
+C ObjC Alias(std=c17)
+Conform to the ISO 2017 C standard (expected to be published in 2018).
 
 traditional
 Driver
index 6384bc62a1318dc572cf7ce00f9207331b5e21ea..1e2b869885bed3070d80042ac0730b9e62f64025 100644 (file)
@@ -1832,8 +1832,11 @@ Annexes F and G) and the optional Annexes K (Bounds-checking
 interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
 
 @item c17
+@itemx c18
 @itemx iso9899:2017
-ISO C17, the 2017 revision of the ISO C standard.  This standard is
+@itemx iso9899:2018
+ISO C17, the 2017 revision of the ISO C standard (expected to be
+published in 2018).  This standard is
 same as C11 except for corrections of defects (all of which are also
 applied with @option{-std=c11}) and a new value of
 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
@@ -1852,6 +1855,7 @@ GNU dialect of ISO C11.
 The name @samp{gnu1x} is deprecated.
 
 @item gnu17
+@itemx gnu18
 GNU dialect of ISO C17.  This is the default for C code.
 
 @item c++98
index 180f4db0cdc59f1931b131239d3a015499d73518..f9221894efd569a161d156edaf45bd7730bf0364 100644 (file)
@@ -1,3 +1,7 @@
+2017-11-16  Joseph Myers  <joseph@codesourcery.com>
+
+       * gcc.dg/c18-version-1.c, gcc.dg/c18-version-2.c: New tests.
+
 2017-11-15  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * gcc.target/powerpc/bfp/bfp.exp: Look for *.c files, not *.c*
diff --git a/gcc/testsuite/gcc.dg/c18-version-1.c b/gcc/testsuite/gcc.dg/c18-version-1.c
new file mode 100644 (file)
index 0000000..9acd024
--- /dev/null
@@ -0,0 +1,9 @@
+/* Test __STDC_VERSION__ for C17.  Test -std=c18.  */
+/* { dg-do compile } */
+/* { dg-options "-std=c18 -pedantic-errors" } */
+
+#if __STDC_VERSION__ == 201710L
+int i;
+#else
+#error "Bad __STDC_VERSION__."
+#endif
diff --git a/gcc/testsuite/gcc.dg/c18-version-2.c b/gcc/testsuite/gcc.dg/c18-version-2.c
new file mode 100644 (file)
index 0000000..8786402
--- /dev/null
@@ -0,0 +1,9 @@
+/* Test __STDC_VERSION__ for C17.  Test -std=iso9899:2018.  */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:2018 -pedantic-errors" } */
+
+#if __STDC_VERSION__ == 201710L
+int i;
+#else
+#error "Bad __STDC_VERSION__."
+#endif