aboutsummaryrefslogtreecommitdiff
path: root/libcpp/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp/init.c')
-rw-r--r--libcpp/init.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libcpp/init.c b/libcpp/init.c
index a5103c4..ecd3d5b 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -119,6 +119,8 @@ static const struct lang_flags lang_defaults[] =
/* CXX17 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 },
/* GNUCXX20 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0 },
/* CXX20 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0 },
+ /* GNUCXX23 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0 },
+ /* CXX23 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0 },
/* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
@@ -540,7 +542,12 @@ cpp_init_builtins (cpp_reader *pfile, int hosted)
if (CPP_OPTION (pfile, cplusplus))
{
- if (CPP_OPTION (pfile, lang) == CLK_CXX20
+ /* 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
+ || CPP_OPTION (pfile, lang) == CLK_GNUCXX23)
+ _cpp_define_builtin (pfile, "__cplusplus 202100L");
+ else if (CPP_OPTION (pfile, lang) == CLK_CXX20
|| CPP_OPTION (pfile, lang) == CLK_GNUCXX20)
_cpp_define_builtin (pfile, "__cplusplus 202002L");
else if (CPP_OPTION (pfile, lang) == CLK_CXX17