if (warn_c11_c2x_compat > 0)
{
if (pedantic && !flag_isoc2x)
- pedwarn (input_location, OPT_Wc11_c2x_compat,
+ pedwarn (input_location, OPT_Wc11_c23_compat,
"non-standard suffix on floating constant "
"before C2X");
else
- warning (OPT_Wc11_c2x_compat,
+ warning (OPT_Wc11_c23_compat,
"non-standard suffix on floating constant "
"before C2X");
}
set_std_c17 (false /* ISO */);
break;
- case OPT_std_c2x:
+ case OPT_std_c23:
if (!preprocessing_asm_p)
set_std_c2x (true /* ISO */);
break;
- case OPT_std_gnu2x:
+ case OPT_std_gnu23:
if (!preprocessing_asm_p)
set_std_c2x (false /* ISO */);
break;
C ObjC C++ ObjC++ CPP(warn_builtin_macro_redefined) CppReason(CPP_W_BUILTIN_MACRO_REDEFINED) Var(cpp_warn_builtin_macro_redefined) Init(1) Warning
Warn when a built-in preprocessor macro is undefined or redefined.
-Wc11-c2x-compat
+Wc11-c23-compat
C ObjC CPP(cpp_warn_c11_c2x_compat) CppReason(CPP_W_C11_C2X_COMPAT) Var(warn_c11_c2x_compat) Init(-1) Warning
-Warn about features not present in ISO C11, but present in ISO C2X.
+Warn about features not present in ISO C11, but present in ISO C23.
+
+Wc11-c2x-compat
+C ObjC Alias(Wc11-c23-compat)
+Deprecated in favor of -Wc11-c23-compat.
Wc90-c99-compat
C ObjC CPP(cpp_warn_c90_c99_compat) CppReason(CPP_W_C90_C99_COMPAT) Var(warn_c90_c99_compat) Init(-1) Warning
C ObjC Alias(std=c17)
Conform to the ISO 2017 C standard (published in 2018).
-std=c2x
+std=c23
C ObjC
-Conform to the ISO 202X C standard draft (experimental and incomplete support).
+Conform to the ISO 2023 C standard draft (expected to be published in 2024) (experimental and incomplete support).
+
+std=c2x
+C ObjC Alias(std=c23)
+Deprecated in favor of -std=c23.
std=c89
C ObjC Alias(std=c90)
C ObjC Alias(std=gnu17)
Conform to the ISO 2017 C standard (published in 2018) with GNU extensions.
-std=gnu2x
+std=gnu23
C ObjC
-Conform to the ISO 202X C standard draft with GNU extensions (experimental and incomplete support).
+Conform to the ISO 2023 C standard draft (expected to be published in 2024) with GNU extensions (experimental and incomplete support).
+
+std=gnu2x
+C ObjC Alias(std=gnu23)
+Deprecated in favor of -std=gnu23.
std=gnu89
C ObjC Alias(std=gnu90)
C ObjC Alias(std=c17)
Conform to the ISO 2017 C standard (published in 2018).
+std=iso9899:2024
+C ObjC Alias(std=c23)
+Conform to the ISO 2023 C standard draft (expected to be published in 2024) (experimental and incomplete support).
+
stdlib=
Driver C++ ObjC++ Common Condition(ENABLE_STDLIB_OPTION) Var(flag_stdlib_kind) Joined Enum(stdlib_kind) RejectNegative Init(1)
-stdlib=[libstdc++|libc++] The standard library to be used for C++ headers
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc,
(pedantic && !flag_isoc2x)
? DK_PEDWARN : DK_WARNING);
- diagnostic.option_index = OPT_Wc11_c2x_compat;
+ diagnostic.option_index = OPT_Wc11_c23_compat;
warned = diagnostic_report_diagnostic (global_dc, &diagnostic);
}
/* -Wno-c11-c2x-compat suppresses even the pedwarns. */
"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");
}
"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,
@code{201710L} signifies the 2017 revision of the C standard (which is
otherwise identical to the 2011 version apart from correction of
defects). An unspecified value larger than @code{201710L} is used for
-the experimental @option{-std=c2x} and @option{-std=gnu2x} modes.
+the experimental @option{-std=c23} and @option{-std=gnu23} modes.
This macro is not defined if the @option{-traditional-cpp} option is
used, nor when compiling C++ or Objective-C@.
syntax was first introduced in the C++11 language standard
(@pxref{Standards}), and is supported by GCC in C++ code with
@option{-std=c++11} or @option{-std=gnu++11} or later. It is also
-part of the C2x language standard and is supported when compiling C
-code with @option{-std=c2x} or @option{-std=gnu17} or later.
+part of the C23 language standard and is supported when compiling C
+code with @option{-std=c23} or @option{-std=gnu17} or later.
When using GNU-specific attributes in the standard syntax, you must
prefix their names with @samp{gnu::}, such as @code{gnu::section}.
-Wbool-compare -Wbool-operation
-Wno-builtin-declaration-mismatch
-Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat
--Wc11-c2x-compat
+-Wc11-c23-compat
-Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat
-Wc++20-compat
-Wno-c++11-extensions -Wno-c++14-extensions -Wno-c++17-extensions
applied with @option{-std=c11}) and a new value of
@code{__STDC_VERSION__}, and so is supported to the same extent as C11.
-@item c2x
-The next version of the ISO C standard, still under development. The
-support for this version is experimental and incomplete.
+@item c23
+@itemx c2x
+@itemx iso9899:2024
+ISO C23, the 2023 revision of the ISO C standard (expected to be
+published in 2024). The support for this version is experimental and
+incomplete. The name @samp{c2x} is deprecated.
@item gnu90
@itemx gnu89
@itemx gnu18
GNU dialect of ISO C17. This is the default for C code.
-@item gnu2x
+@item gnu23
+@itemx gnu2x
The next version of the ISO C standard, still under development, plus
GNU extensions. The support for this version is experimental and
-incomplete.
+incomplete. The name @samp{gnu2x} is deprecated.
@item c++98
@itemx c++03
instead, which disables @code{typeof} but not @code{asm} and
@code{inline}. In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
this switch only affects the @code{asm} and @code{typeof} keywords,
-since @code{inline} is a standard keyword in ISO C99. In C2X mode
-(@option{-std=c2x} or @option{-std=gnu2x}), this switch only affects
+since @code{inline} is a standard keyword in ISO C99. In C23 mode
+(@option{-std=c23} or @option{-std=gnu23}), this switch only affects
the @code{asm} keyword, since @code{typeof} is a standard keyword in
-ISO C2X.
+ISO C23.
@opindex fno-builtin
@opindex fbuiltin
and so on. This option is independent of the standards mode. Warnings are
disabled in the expression that follows @code{__extension__}.
-@opindex Wc11-c2x-compat
-@opindex Wno-c11-c2x-compat
-@item -Wc11-c2x-compat @r{(C and Objective-C only)}
-Warn about features not present in ISO C11, but present in ISO C2X.
+@opindex Wc11-c23-compat
+@opindex Wno-c11-c23-compat
+@item -Wc11-c23-compat @r{(C and Objective-C only)}
+@itemx -Wc11-c2x-compat @r{(C and Objective-C only)}
+Warn about features not present in ISO C11, but present in ISO C23.
For instance, warn about omitting the string in @code{_Static_assert},
use of @samp{[[]]} syntax for attributes, use of decimal
floating-point types, and so on. This option is independent of the
standards mode. Warnings are disabled in the expression that follows
-@code{__extension__}.
+@code{__extension__}. The name @option{-Wc11-c2x-compat} is
+deprecated.
-When not compiling in C2X mode, these warnings are upgraded to errors
+When not compiling in C23 mode, these warnings are upgraded to errors
by @option{-pedantic-errors}.
@opindex Wc++-compat
@cindex C1X
@cindex ISO C17
@cindex C17
+@cindex ISO C23
+@cindex C23
@cindex ISO C2X
@cindex C2X
@cindex Technical Corrigenda
@option{-std=c11}, and the only difference between the options is the
value of @code{__STDC_VERSION__}.
-A further version of the C standard, known as @dfn{C2X}, is under
-development; experimental and incomplete support for this is enabled
-with @option{-std=c2x}.
+A further version of the C standard, known as @dfn{C23}, is under
+development and expected to be published in 2024 as ISO/IEC 9899:2024.
+(While in development, drafts of this standard version were referred
+to as @dfn{C2X}.) Experimental and incomplete support for this is
+enabled with @option{-std=c23} or @option{-std=iso9899:2024}.
By default, GCC provides some extensions to the C language that, on
rare occasions conflict with the C standard. @xref{C
--- /dev/null
+/* Test -std=c23. */
+/* { dg-do compile } */
+/* { dg-options "-std=c23" } */
+
+auto p = nullptr;
--- /dev/null
+/* Test -std=iso9899:2024. */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:2024" } */
+
+auto p = nullptr;
--- /dev/null
+/* Test the deprecated option -std=c2x. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x" } */
+
+auto p = nullptr;
--- /dev/null
+/* Test -Wc11-c23-compat. */
+/* { dg-do compile } */
+/* { dg-options "-std=c23 -Wc11-c23-compat" } */
+
+void *p = nullptr; /* { dg-warning "nullptr" } */
--- /dev/null
+/* Test the deprecated option -Wc11-c2x-compat. */
+/* { dg-do compile } */
+/* { dg-options "-std=c23 -Wc11-c2x-compat" } */
+
+void *p = nullptr; /* { dg-warning "nullptr" } */
--- /dev/null
+/* Test -std=gnu23. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu23" } */
+
+auto p = nullptr;
--- /dev/null
+/* Test the deprecated option -std=gnu2x. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu2x" } */
+
+auto p = nullptr;