diff options
author | Andrew Sutton <andrew.n.sutton@gmail.com> | 2017-09-15 21:16:37 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-09-15 23:16:37 +0200 |
commit | 026a79f70cf33f836ea5275eda72d4870a3041e5 (patch) | |
tree | 2f390353edc0761950168ed8a79be2315be52ac6 /gcc/c-family/c-opts.c | |
parent | 41dfa93fb8d0cfd3a64ba3e6eba9fbbe1d66090c (diff) | |
download | gcc-026a79f70cf33f836ea5275eda72d4870a3041e5.zip gcc-026a79f70cf33f836ea5275eda72d4870a3041e5.tar.gz gcc-026a79f70cf33f836ea5275eda72d4870a3041e5.tar.bz2 |
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.
* 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.
* 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.
* include/cpplib.h (c_lang): Add CXX2A and GNUCXX2A.
* init.c (lang_defaults): Add rows for CXX2A and GNUCXX2A.
(cpp_init_builtins): Set __cplusplus to 201709L for C++2a.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r252850
Diffstat (limited to 'gcc/c-family/c-opts.c')
-rw-r--r-- | gcc/c-family/c-opts.c | 29 |
1 files changed, 26 insertions, 3 deletions
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 |