aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/c-family/ChangeLog11
-rw-r--r--gcc/c-family/c-common.h4
-rw-r--r--gcc/c-family/c-opts.c29
-rw-r--r--gcc/c-family/c.opt8
-rw-r--r--gcc/doc/cpp.texi5
-rw-r--r--gcc/doc/invoke.texi10
-rw-r--r--gcc/testsuite/ChangeLog11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/cplusplus.C4
-rw-r--r--gcc/testsuite/lib/target-supports.exp29
10 files changed, 113 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6535022..1b5176a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-15 Andrew Sutton <andrew.n.sutton@gmail.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ Add support for -std=c++2a.
+ * doc/cpp.texi (__cplusplus): Document value for -std=c++2a
+ or -std=gnu+2a.
+ * doc/invoke.texi: Document -std=c++2a and -std=gnu++2a.
+
2017-09-15 Steve Ellcey <sellcey@cavium.com>
PR target/82066
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index a3f990d..8003fb5 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,14 @@
+2017-09-15 Andrew Sutton <andrew.n.sutton@gmail.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ Add support for -std=c++2a.
+ * c-common.h (cxx_dialect): Add cxx2a as a dialect.
+ * opt.c: Add options for -std=c++2a and -std=gnu++2a.
+ * c-opts.c (set_std_cxx2a): New.
+ (c_common_handle_option): Set options when -std=c++2a is enabled.
+ (c_common_post_options): Adjust comments.
+ (set_std_cxx14, set_std_cxx17): Likewise.
+
2017-09-15 Eric Botcazou <ebotcazou@adacore.com>
* c-pragma.c (handle_pragma_scalar_storage_order): Expand on error
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index d57829b..da6a0be 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -703,7 +703,9 @@ enum cxx_dialect {
/* C++14 */
cxx14,
/* C++17 */
- cxx17
+ cxx17,
+ /* C++2a (C++20?) */
+ cxx2a
};
/* The C++ dialect being used. C++98 is the default. */
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index cdbcd6c..3662aa3 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -111,6 +111,7 @@ static void set_std_cxx98 (int);
static void set_std_cxx11 (int);
static void set_std_cxx14 (int);
static void set_std_cxx17 (int);
+static void set_std_cxx2a (int);
static void set_std_c89 (int, int);
static void set_std_c99 (int);
static void set_std_c11 (int);
@@ -637,6 +638,12 @@ c_common_handle_option (size_t scode, const char *arg, int value,
set_std_cxx17 (code == OPT_std_c__17 /* ISO */);
break;
+ case OPT_std_c__2a:
+ case OPT_std_gnu__2a:
+ if (!preprocessing_asm_p)
+ set_std_cxx2a (code == OPT_std_c__2a /* ISO */);
+ break;
+
case OPT_std_c90:
case OPT_std_iso9899_199409:
if (!preprocessing_asm_p)
@@ -938,7 +945,7 @@ c_common_post_options (const char **pfilename)
warn_narrowing = 1;
/* Unless -f{,no-}ext-numeric-literals has been used explicitly,
- for -std=c++{11,14,17} default to -fno-ext-numeric-literals. */
+ for -std=c++{11,14,17,2a} default to -fno-ext-numeric-literals. */
if (flag_iso && !global_options_set.x_flag_ext_numeric_literals)
cpp_opts->ext_numeric_literals = 0;
}
@@ -1589,7 +1596,7 @@ set_std_cxx14 (int iso)
flag_no_gnu_keywords = iso;
flag_no_nonansi_builtin = iso;
flag_iso = iso;
- /* C++11 includes the C99 standard library. */
+ /* C++14 includes the C99 standard library. */
flag_isoc94 = 1;
flag_isoc99 = 1;
cxx_dialect = cxx14;
@@ -1604,7 +1611,7 @@ set_std_cxx17 (int iso)
flag_no_gnu_keywords = iso;
flag_no_nonansi_builtin = iso;
flag_iso = iso;
- /* C++11 includes the C99 standard library. */
+ /* C++17 includes the C11 standard library. */
flag_isoc94 = 1;
flag_isoc99 = 1;
flag_isoc11 = 1;
@@ -1612,6 +1619,22 @@ set_std_cxx17 (int iso)
lang_hooks.name = "GNU C++17";
}
+/* Set the C++ 202a draft standard (without GNU extensions if ISO). */
+static void
+set_std_cxx2a (int iso)
+{
+ cpp_set_lang (parse_in, iso ? CLK_CXX2A: CLK_GNUCXX2A);
+ flag_no_gnu_keywords = iso;
+ flag_no_nonansi_builtin = iso;
+ flag_iso = iso;
+ /* C++17 includes the C11 standard library. */
+ flag_isoc94 = 1;
+ flag_isoc99 = 1;
+ flag_isoc11 = 1;
+ cxx_dialect = cxx2a;
+ lang_hooks.name = "GNU C++17"; /* Pretend C++17 until standardization. */
+}
+
/* Args to -d specify what to dump. Silently ignore
unrecognized options; they may be aimed at toplev.c. */
static void
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index ed5938f..3c2c107 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1932,6 +1932,10 @@ std=c++17
C++ ObjC++
Conform to the ISO 2017 C++ standard.
+std=c++2a
+C++ ObjC++
+Conform to the ISO 2020(?) C++ draft standard (experimental and incomplete support).
+
std=c11
C ObjC
Conform to the ISO 2011 C standard.
@@ -1990,6 +1994,10 @@ std=gnu++17
C++ ObjC++
Conform to the ISO 2017 C++ standard with GNU extensions.
+std=gnu++2a
+C++ ObjC++
+Conform to the ISO 2020(?) C++ draft standard with GNU extensions (experimental and incomplete support).
+
std=gnu11
C ObjC
Conform to the ISO 2011 C standard with GNU extensions.
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index 8e9cba3..52f2606 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -1877,7 +1877,10 @@ selected, the value of the macro is
@code{199711L} for the 1998 C++ standard,
@code{201103L} for the 2011 C++ standard,
@code{201402L} for the 2014 C++ standard,
-@code{201703L} for the 2017 C++ standard.
+@code{201703L} for the 2017 C++ standard,
+or an unspecified value strictly larger than @code{201703L} for the
+experimental languages enabled by @option{-std=c++2a} and
+@option{-std=gnu++2a}.
@item __OBJC__
This macro is defined, with value 1, when the Objective-C compiler is in
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 60650c8..204c9b7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1880,6 +1880,16 @@ The name @samp{c++1z} is deprecated.
@itemx gnu++1z
GNU dialect of @option{-std=c++17}.
The name @samp{gnu++1z} is deprecated.
+
+@item c++2a
+The next revision of the ISO C++ standard, tentatively planned for
+2020. Support is highly experimental, and will almost certainly
+change in incompatible ways in future releases.
+
+@item gnu++2a
+GNU dialect of @option{-std=c++2a}. Support is highly experimental,
+and will almost certainly change in incompatible ways in future
+releases.
@end table
@item -fgnu89-inline
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b9bb9c6..1a94535 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2017-09-15 Andrew Sutton <andrew.n.sutton@gmail.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ Add support for -std=c++2a.
+ * lib/target-supports.exp (check_effective_target_c++17): Return
+ 1 also if check_effective_target_c++2a.
+ (check_effective_target_c++17_down): New.
+ (check_effective_target_c++2a_only): New.
+ (check_effective_target_c++2a): New.
+ * g++.dg/cpp2a/cplusplus.C: New.
+
2017-09-15 Joseph Myers <joseph@codesourcery.com>
PR c/82071
diff --git a/gcc/testsuite/g++.dg/cpp2a/cplusplus.C b/gcc/testsuite/g++.dg/cpp2a/cplusplus.C
new file mode 100644
index 0000000..614fc52
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/cplusplus.C
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-std=c++2a" }
+
+static_assert(__cplusplus > 201703L);
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index d229485..6ea7122 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -7863,8 +7863,35 @@ proc check_effective_target_c++17_only { } {
}
return 0
}
+
proc check_effective_target_c++17 { } {
- return [check_effective_target_c++17_only]
+ if [check_effective_target_c++17_only] {
+ return 1
+ }
+ return [check_effective_target_c++2a]
+}
+proc check_effective_target_c++17_down { } {
+ if ![check_effective_target_c++] {
+ return 0
+ }
+ return [expr ![check_effective_target_c++2a] ]
+}
+
+proc check_effective_target_c++2a_only { } {
+ global cxx_default
+ if ![check_effective_target_c++] {
+ return 0
+ }
+ if [check-flags { { } { } { -std=c++2a -std=gnu++2a } }] {
+ return 1
+ }
+ if { $cxx_default == "c++20" && [check-flags { { } { } { } { -std=* } }] } {
+ return 1
+ }
+ return 0
+}
+proc check_effective_target_c++2a { } {
+ return [check_effective_target_c++2a_only]
}
# Check for C++ Concepts TS support, i.e. -fconcepts flag.