aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-typeck.cc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2023-11-06 15:01:22 +0000
committerJoseph Myers <joseph@codesourcery.com>2023-11-06 15:01:22 +0000
commitfad61bf73b3158157a136bf4d9373fc3d9afe319 (patch)
tree9f15256a6102bdba4a2cfe594a7f4931c660d2b8 /gcc/c/c-typeck.cc
parent9837f62f066db532c9db6df38ccf2653d0c3a960 (diff)
downloadgcc-fad61bf73b3158157a136bf4d9373fc3d9afe319.zip
gcc-fad61bf73b3158157a136bf4d9373fc3d9afe319.tar.gz
gcc-fad61bf73b3158157a136bf4d9373fc3d9afe319.tar.bz2
c: Add -std=c23, -std=gnu23, -Wc11-c23-compat options [PR107954]
At the June WG14 meeting, WG14 decided it preferred to keep C23 as the informal name for the next revision of the C standard, despite publication not being before 2024 (publication is due in 2024 whether or not technical changes at the January meeting result in an FDIS ballot being needed). At the Cauldron I raised the question of whether we should thus now add option names such as -std=c23 to GCC, and there was support for doing so. Add -std=c23, making -std=c2x a deprecated alias; also add the alias -std=iso9899:2024. Likewise, add -std=gnu23, making -std=gnu2x a deprecated alias, and add -Wc11-c23-compat, making -Wc11-c2x-compat a deprecated alias. Here, I'm generally just adding the new options and making the minimum changes required to do so, with documentation changed to refer to C23 instead of C2X only where directly associated with documentation of these options. It's intended that future changes will update documentation, diagnostics, comments, variable names, testcase names, etc. to refer consistently to C23. When such changes are made, the new tests c23-opts-3.c, c23-opts-5.c and gnu23-opts-2.c are intended to keep using the old option names they are specifically testing, while other tests would start using the c23/gnu23 versions of the names (as well as the tests themselves being renamed). Updating option names is independent of updating to the final __STDC_VERSION__ value. There, the question is whether we should update the value now or wait for the remaining significant features to be implemented first. (I intend to review Martin's tag compatibility patches for GCC 14. I'm not aware of anyone working on #embed - or on the [[unsequenced]] and [[reproducible]] attributes, though support for standard attributes is optional.) Bootstrapped with no regressions for x86_64-pc-linux-gnu. PR c/107954 gcc/ * doc/cpp.texi (__STDC_VERSION__): Refer to -std=c23 and -std=gnu23 instead of -std=c2x and -std=gnu2x. * doc/extend.texi (Attribute Syntax): Refer to C23 and -std=c23 instead of C2x and -std=c2x. * doc/invoke.texi (-Wc11-c23-compat, -std=c23, -std=gnu23) (-std=iso9899:2024): Document, with -Wc11-c2x-compat, -std=c2x and -std=gnu2x as deprecated aliases. Update descriptions of C23. * doc/standards.texi (Standards): Describe C23 with C2X as an old name. gcc/c-family/ * c.opt (Wc11-c2x-compat): Rename to Wc11-c23-compat and make into a deprecated alias of Wc11-c23-compat. (std=c2x): Rename to std=c23 and make into a deprecated alias of std=c23. (std=gnu2x): Rename to std=gnu23 and make into a deprecated alias of std=gnu23. (std=iso9899:2024): New option. Alias of std=c23. * c-lex.cc (interpret_float): Use OPT_Wc11_c23_compat instead of OPT_Wc11_c2x_compat. * c-opts.cc (c_common_handle_option): Use OPT_std_c23 instead of OPT_std_c2x and OPT_std_gnu23 instead of OPT_std_gnu2x. gcc/c/ * c-errors.cc (pedwarn_c11): Use OPT_Wc11_c23_compat instead of OPT_Wc11_c2x_compat. * c-typeck.cc (build_conditional_expr, convert_for_assignment): Use OPT_Wc11_c23_compat instead of OPT_Wc11_c2x_compat. gcc/testsuite/ * gcc.dg/c23-opts-1.c, gcc.dg/c23-opts-2.c, gcc.dg/c23-opts-3.c, gcc.dg/c23-opts-4.c, gcc.dg/c23-opts-5.c, gcc.dg/gnu23-opts-1.c, gcc.dg/gnu23-opts-2.c: New tests.
Diffstat (limited to 'gcc/c/c-typeck.cc')
-rw-r--r--gcc/c/c-typeck.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index bdd57aa..dd39cec 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -5545,7 +5545,7 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
"pointer to array loses qualifier "
"in conditional expression");
else if (warn_c11_c2x_compat > 0)
- warning_at (colon_loc, OPT_Wc11_c2x_compat,
+ warning_at (colon_loc, OPT_Wc11_c23_compat,
"pointer to array loses qualifier "
"in conditional expression in ISO C before C2X");
}
@@ -7603,7 +7603,7 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
"pointer target type"),
TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl));
else if (warn_quals_ped)
- pedwarn_c11 (location, OPT_Wc11_c2x_compat,
+ pedwarn_c11 (location, OPT_Wc11_c23_compat,
"array with qualifier on the element is not qualified before C2X");
/* If this is not a case of ignoring a mismatch in signedness,