diff options
author | Joseph Myers <josmyers@redhat.com> | 2024-06-11 23:00:04 +0000 |
---|---|---|
committer | Joseph Myers <josmyers@redhat.com> | 2024-06-11 23:00:04 +0000 |
commit | 0cf68222d2df3af7fefad28a82fcd51d8b40a192 (patch) | |
tree | 701b30abd2d7acb11f081f6f9de304ef119189cf /gcc/config/rl78 | |
parent | 6bc26cceb243c6f359f65a1afa5515f911f3327d (diff) | |
download | gcc-0cf68222d2df3af7fefad28a82fcd51d8b40a192.zip gcc-0cf68222d2df3af7fefad28a82fcd51d8b40a192.tar.gz gcc-0cf68222d2df3af7fefad28a82fcd51d8b40a192.tar.bz2 |
c: Add -std=c2y, -std=gnu2y, -Wc23-c2y-compat, C2Y _Generic with type operand
The first new C2Y feature, _Generic where the controlling operand is a
type name rather than an expression (as defined in N3260), was voted
into C2Y today. (In particular, this form of _Generic allows
distinguishing qualified and unqualified versions of a type.) This
feature also includes allowing the generic associations to specify
incomplete and function types.
Add this feature to GCC, along with the -std=c2y, -std=gnu2y and
-Wc23-c2y-compat options to control when and how it is diagnosed. As
usual, the feature is allowed by default in older standards modes,
subject to diagnosis with -pedantic, -pedantic-errors or
-Wc23-c2y-compat.
Bootstrapped with no regressions on x86_64-pc-linux-gnu.
gcc/
* doc/cpp.texi (__STDC_VERSION__): Document C2Y handling.
* doc/invoke.texi (-Wc23-c2y-compat, -std=c2y, -std=gnu2y):
Document options.
(-std=gnu23): Update documentation.
* doc/standards.texi (C Language): Document C2Y. Update C23
description.
* config/rl78/rl78.cc (rl78_option_override): Handle "GNU C2Y"
language name.
* dwarf2out.cc (highest_c_language, gen_compile_unit_die):
Likewise.
gcc/c-family/
* c-common.cc (flag_isoc2y): New.
(flag_isoc99, flag_isoc11, flag_isoc23): Update comments.
* c-common.h (flag_isoc2y): New.
(clk_c, flag_isoc23): Update comments.
* c-opts.cc (set_std_c2y): New.
(c_common_handle_option): Handle OPT_std_c2y and OPT_std_gnu2y.
(set_std_c89, set_std_c99, set_std_c11, set_std_c17, set_std_c23):
Set flag_isoc2y.
(set_std_c23): Update comment.
* c.opt (Wc23-c2y-compat, std=c2y, std=gnu2y): New.
* c.opt.urls: Regenerate.
gcc/c/
* c-errors.cc (pedwarn_c23): New.
* c-parser.cc (disable_extension_diagnostics)
(restore_extension_diagnostics): Save and restore
warn_c23_c2y_compat.
(c_parser_generic_selection): Handle type name as controlling
operand. Allow incomplete and function types subject to
pedwarn_c23 calls.
* c-tree.h (pedwarn_c23): New.
gcc/testsuite/
* gcc.dg/c23-generic-1.c, gcc.dg/c23-generic-2.c,
gcc.dg/c23-generic-3.c, gcc.dg/c23-generic-4.c,
gcc.dg/c2y-generic-1.c, gcc.dg/c2y-generic-2.c,
gcc.dg/c2y-generic-3.c, gcc.dg/gnu2y-generic-1.c: New tests.
* gcc.dg/c23-tag-6.c: Use -pedantic-errors.
libcpp/
* include/cpplib.h (CLK_GNUC2Y, CLK_STDC2Y): New.
* init.cc (lang_defaults): Add GNUC2Y and STDC2Y entries.
(cpp_init_builtins): Define __STDC_VERSION__ to 202500L for GNUC2Y
and STDC2Y.
Diffstat (limited to 'gcc/config/rl78')
-rw-r--r-- | gcc/config/rl78/rl78.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/config/rl78/rl78.cc b/gcc/config/rl78/rl78.cc index e5345bf..b4bb145 100644 --- a/gcc/config/rl78/rl78.cc +++ b/gcc/config/rl78/rl78.cc @@ -367,6 +367,7 @@ rl78_option_override (void) && strcmp (lang_hooks.name, "GNU C11") && strcmp (lang_hooks.name, "GNU C17") && strcmp (lang_hooks.name, "GNU C23") + && strcmp (lang_hooks.name, "GNU C2Y") && strcmp (lang_hooks.name, "GNU C89") && strcmp (lang_hooks.name, "GNU C99") /* Compiling with -flto results in a language of GNU GIMPLE being used... */ |