aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorAndrew Sutton <andrew.n.sutton@gmail.com>2017-09-15 21:16:37 +0000
committerJakub Jelinek <jakub@gcc.gnu.org>2017-09-15 23:16:37 +0200
commit026a79f70cf33f836ea5275eda72d4870a3041e5 (patch)
tree2f390353edc0761950168ed8a79be2315be52ac6 /libcpp
parent41dfa93fb8d0cfd3a64ba3e6eba9fbbe1d66090c (diff)
downloadgcc-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 'libcpp')
-rw-r--r--libcpp/ChangeLog8
-rw-r--r--libcpp/include/cpplib.h3
-rw-r--r--libcpp/init.c7
3 files changed, 16 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 3696c76..0621074 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/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.
+ * 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.
+
2017-09-15 Jakub Jelinek <jakub@redhat.com>
* include/cpplib.h (enum c_lang): Rename CLK_GNUCXX1Z
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 8c81f9d..804132a 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -171,7 +171,8 @@ enum cpp_ttype
enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11,
CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC11,
CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11,
- CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX17, CLK_CXX17, CLK_ASM};
+ CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX17, CLK_CXX17,
+ CLK_GNUCXX2A, CLK_CXX2A, CLK_ASM};
/* Payload of a NUMBER, STRING, CHAR or COMMENT token. */
struct GTY(()) cpp_string {
diff --git a/libcpp/init.c b/libcpp/init.c
index 0148586..16ff202 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -110,6 +110,8 @@ static const struct lang_flags lang_defaults[] =
/* CXX14 */ { 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
/* GNUCXX17 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1 },
/* CXX17 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1 },
+ /* GNUCXX2A */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1 },
+ /* CXX2A */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1 },
/* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
@@ -497,7 +499,10 @@ cpp_init_builtins (cpp_reader *pfile, int hosted)
if (CPP_OPTION (pfile, cplusplus))
{
- if (CPP_OPTION (pfile, lang) == CLK_CXX17
+ if (CPP_OPTION (pfile, lang) == CLK_CXX2A
+ || CPP_OPTION (pfile, lang) == CLK_GNUCXX2A)
+ _cpp_define_builtin (pfile, "__cplusplus 201709L");
+ else if (CPP_OPTION (pfile, lang) == CLK_CXX17
|| CPP_OPTION (pfile, lang) == CLK_GNUCXX17)
_cpp_define_builtin (pfile, "__cplusplus 201703L");
else if (CPP_OPTION (pfile, lang) == CLK_CXX14