aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/cpp.texi
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2023-06-22 16:56:26 -0400
committerMarek Polacek <polacek@redhat.com>2023-06-23 16:46:29 -0400
commit5388a43f6a3f348929292998bd6d0c1da6f006de (patch)
treedcc504a25f4e8ac3aedc9274918abc05d37f6984 /gcc/doc/cpp.texi
parentb7fc0a3be52f78100a270b63e7555fde078fd2e3 (diff)
downloadgcc-5388a43f6a3f348929292998bd6d0c1da6f006de.zip
gcc-5388a43f6a3f348929292998bd6d0c1da6f006de.tar.gz
gcc-5388a43f6a3f348929292998bd6d0c1da6f006de.tar.bz2
c++: Add support for -std={c,gnu}++2{c,6}
It seems prudent to add C++26 now that the first C++26 papers have been approved. I followed commit r11-6920 as well as r8-3237. Since C++23 is essentially finished and its __cplusplus value has settled to 202302L, I've updated cpp_init_builtins and marked -std=c++2b Undocumented and made -std=c++23 no longer Undocumented. As for __cplusplus, I've chosen 202400L: $ xg++ -std=c++26 -dM -E -x c++ - < /dev/null | grep cplusplus #define __cplusplus 202400L I've verified the patch with a simple test, exercising the new directives. Don't forget to update your GXX_TESTSUITE_STDS! This patch does not add -Wc++26-extensions. gcc/c-family/ChangeLog: * c-common.h (cxx_dialect): Add cxx26 as a dialect. * c-opts.cc (set_std_cxx26): New. (c_common_handle_option): Set options when -std={c,gnu}++2{c,6} is enabled. (c_common_post_options): Adjust comments. * c.opt: Add options for -std=c++26, std=c++2c, -std=gnu++26, and -std=gnu++2c. (std=c++2b): Mark as Undocumented. (std=c++23): No longer Undocumented. gcc/ChangeLog: * doc/cpp.texi (__cplusplus): Document value for -std=c++26 and -std=gnu++26. Document that for C++23, its value is 202302L. * doc/invoke.texi: Document -std=c++26 and -std=gnu++26. * dwarf2out.cc (highest_c_language): Handle GNU C++26. (gen_compile_unit_die): Likewise. libcpp/ChangeLog: * include/cpplib.h (c_lang): Add CXX26 and GNUCXX26. * init.cc (lang_defaults): Add rows for CXX26 and GNUCXX26. (cpp_init_builtins): Set __cplusplus to 202400L for C++26. Set __cplusplus to 202302L for C++23. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_c++23): Return 1 also if check_effective_target_c++26. (check_effective_target_c++23_down): New. (check_effective_target_c++26_only): New. (check_effective_target_c++26): New. * g++.dg/cpp23/cplusplus.C: Adjust expected value. * g++.dg/cpp26/cplusplus.C: New test.
Diffstat (limited to 'gcc/doc/cpp.texi')
-rw-r--r--gcc/doc/cpp.texi7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index b0a2ce3..3f492b3 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -1908,9 +1908,10 @@ selected, the value of the macro is
@code{201402L} for the 2014 C++ standard,
@code{201703L} for the 2017 C++ standard,
@code{202002L} for the 2020 C++ standard,
-or an unspecified value strictly larger than @code{202002L} for the
-experimental languages enabled by @option{-std=c++23} and
-@option{-std=gnu++23}.
+@code{202302L} for the 2023 C++ standard,
+or an unspecified value strictly larger than @code{202302L} for the
+experimental languages enabled by @option{-std=c++26} and
+@option{-std=gnu++26}.
@item __OBJC__
This macro is defined, with value 1, when the Objective-C compiler is in