/* C++20 */
cxx20,
/* C++23 */
- cxx23
+ cxx23,
+ /* C++26 */
+ cxx26
};
/* The C++ dialect being used. C++98 is the default. */
static void set_std_cxx17 (int);
static void set_std_cxx20 (int);
static void set_std_cxx23 (int);
+static void set_std_cxx26 (int);
static void set_std_c89 (int, int);
static void set_std_c99 (int);
static void set_std_c11 (int);
set_std_cxx23 (code == OPT_std_c__23 /* ISO */);
break;
+ case OPT_std_c__26:
+ case OPT_std_gnu__26:
+ if (!preprocessing_asm_p)
+ set_std_cxx26 (code == OPT_std_c__26 /* ISO */);
+ break;
+
case OPT_std_c90:
case OPT_std_iso9899_199409:
if (!preprocessing_asm_p)
warn_narrowing = 1;
/* Unless -f{,no-}ext-numeric-literals has been used explicitly,
- for -std=c++{11,14,17,20,23} default to -fno-ext-numeric-literals. */
+ for -std=c++{11,14,17,20,23,26} default to
+ -fno-ext-numeric-literals. */
if (flag_iso && !OPTION_SET_P (flag_ext_numeric_literals))
cpp_opts->ext_numeric_literals = 0;
}
lang_hooks.name = "GNU C++23";
}
+/* Set the C++ 2026 standard (without GNU extensions if ISO). */
+static void
+set_std_cxx26 (int iso)
+{
+ cpp_set_lang (parse_in, iso ? CLK_CXX26: CLK_GNUCXX26);
+ flag_no_gnu_keywords = iso;
+ flag_no_nonansi_builtin = iso;
+ flag_iso = iso;
+ /* C++26 includes the C11 standard library. */
+ flag_isoc94 = 1;
+ flag_isoc99 = 1;
+ flag_isoc11 = 1;
+ /* C++26 includes coroutines. */
+ flag_coroutines = true;
+ cxx_dialect = cxx26;
+ lang_hooks.name = "GNU C++26";
+}
+
/* Args to -d specify what to dump. Silently ignore
unrecognized options; they may be aimed at toplev.cc. */
static void
Conform to the ISO 2020 C++ standard (experimental and incomplete support).
std=c++2b
-C++ ObjC++ Alias(std=c++23)
+C++ ObjC++ Alias(std=c++23) Undocumented
Conform to the ISO 2023 C++ draft standard (experimental and incomplete support).
std=c++23
-C++ ObjC++ Undocumented
+C++ ObjC++
Conform to the ISO 2023 C++ draft standard (experimental and incomplete support).
+std=c++2c
+C++ ObjC++ Alias(std=c++26)
+Conform to the ISO 2026 C++ draft standard (experimental and incomplete support).
+
+std=c++26
+C++ ObjC++ Undocumented
+Conform to the ISO 2026 C++ draft standard (experimental and incomplete support).
+
std=c11
C ObjC
Conform to the ISO 2011 C standard.
Conform to the ISO 2020 C++ standard with GNU extensions (experimental and incomplete support).
std=gnu++2b
-C++ ObjC++ Alias(std=gnu++23)
+C++ ObjC++ Alias(std=gnu++23) Undocumented
Conform to the ISO 2023 C++ draft standard with GNU extensions (experimental and incomplete support).
std=gnu++23
-C++ ObjC++ Undocumented
+C++ ObjC++
Conform to the ISO 2023 C++ draft standard with GNU extensions (experimental and incomplete support).
+std=gnu++2c
+C++ ObjC++ Alias(std=gnu++26)
+Conform to the ISO 2026 C++ draft standard with GNU extensions (experimental and incomplete support).
+
+std=gnu++26
+C++ ObjC++ Undocumented
+Conform to the ISO 2026 C++ draft standard with GNU extensions (experimental and incomplete support).
+
std=gnu11
C ObjC
Conform to the ISO 2011 C standard with GNU extensions.
@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
GNU dialect of @option{-std=c++2b}. Support is highly experimental,
and will almost certainly change in incompatible ways in future
releases.
+
+@item c++2c
+@itemx c++26
+The next revision of the ISO C++ standard, planned for
+2026. Support is highly experimental, and will almost certainly
+change in incompatible ways in future releases.
+
+@item gnu++2c
+@itemx gnu++26
+GNU dialect of @option{-std=c++2c}. Support is highly experimental,
+and will almost certainly change in incompatible ways in future
+releases.
@end table
@opindex aux-info
static const char *
highest_c_language (const char *lang1, const char *lang2)
{
+ if (strcmp ("GNU C++26", lang1) == 0 || strcmp ("GNU C++26", lang2) == 0)
+ return "GNU C++26";
if (strcmp ("GNU C++23", lang1) == 0 || strcmp ("GNU C++23", lang2) == 0)
return "GNU C++23";
if (strcmp ("GNU C++20", lang1) == 0 || strcmp ("GNU C++20", lang2) == 0)
language = DW_LANG_C_plus_plus_14;
else if (strcmp (language_string, "GNU C++17") == 0
|| strcmp (language_string, "GNU C++20") == 0
- || strcmp (language_string, "GNU C++23") == 0)
+ || strcmp (language_string, "GNU C++23") == 0
+ || strcmp (language_string, "GNU C++26") == 0)
/* For now. */
language = DW_LANG_C_plus_plus_14;
}
// { dg-do compile }
// { dg-options "-std=c++23" }
-static_assert(__cplusplus > 202002L);
+static_assert(__cplusplus == 202302L);
--- /dev/null
+// { dg-do compile { target c++26_only } }
+
+static_assert(__cplusplus > 202302L);
return 0
}
proc check_effective_target_c++23 { } {
- return [check_effective_target_c++23_only]
+ if [check_effective_target_c++23_only] {
+ return 1
+ }
+ return [check_effective_target_c++26]
+}
+
+proc check_effective_target_c++23_down { } {
+ if ![check_effective_target_c++] {
+ return 0
+ }
+ return [expr ![check_effective_target_c++26] ]
+}
+
+proc check_effective_target_c++26_only { } {
+ global cxx_default
+ if ![check_effective_target_c++] {
+ return 0
+ }
+ if [check-flags { { } { } { -std=c++26 -std=gnu++26 -std=c++2c -std=gnu++2c } }] {
+ return 1
+ }
+ if { $cxx_default == "c++26" && [check-flags { { } { } { } { -std=* } }] } {
+ return 1
+ }
+ return 0
+}
+
+proc check_effective_target_c++26 { } {
+ return [check_effective_target_c++26_only]
}
# Check for C++ Concepts support, i.e. -fconcepts flag.
CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11,
CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX17, CLK_CXX17,
CLK_GNUCXX20, CLK_CXX20, CLK_GNUCXX23, CLK_CXX23,
- CLK_ASM};
+ CLK_GNUCXX26, CLK_CXX26, CLK_ASM};
/* Payload of a NUMBER, STRING, CHAR or COMMENT token. */
struct GTY(()) cpp_string {
/* CXX20 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1 },
/* GNUCXX23 */ { 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1 },
/* CXX23 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1 },
+ /* GNUCXX26 */ { 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1 },
+ /* CXX26 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1 },
/* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
if (CPP_OPTION (pfile, cplusplus))
{
- /* C++23 is not yet a standard. For now, use an invalid
- * year/month, 202100L, which is larger than 202002L. */
- if (CPP_OPTION (pfile, lang) == CLK_CXX23
+ /* C++26 is not yet a standard. For now, use an invalid
+ year/month, 202400L, which is larger than 202302L. */
+ if (CPP_OPTION (pfile, lang) == CLK_CXX26
+ || CPP_OPTION (pfile, lang) == CLK_GNUCXX26)
+ _cpp_define_builtin (pfile, "__cplusplus 202400L");
+ else if (CPP_OPTION (pfile, lang) == CLK_CXX23
|| CPP_OPTION (pfile, lang) == CLK_GNUCXX23)
- _cpp_define_builtin (pfile, "__cplusplus 202100L");
+ _cpp_define_builtin (pfile, "__cplusplus 202302L");
else if (CPP_OPTION (pfile, lang) == CLK_CXX20
|| CPP_OPTION (pfile, lang) == CLK_GNUCXX20)
_cpp_define_builtin (pfile, "__cplusplus 202002L");