Skip to content

Commit

Permalink
[C23] Rename C2x->C23 in diagnostics
Browse files Browse the repository at this point in the history
This renames C2x to C23 in diagnostic identifiers and messages. The
changes were made mechanically.
  • Loading branch information
AaronBallman committed Aug 11, 2023
1 parent 12e1a9b commit 9c4ade0
Show file tree
Hide file tree
Showing 64 changed files with 287 additions and 281 deletions.
20 changes: 10 additions & 10 deletions clang/include/clang/Basic/DiagnosticCommonKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ def warn_missing_type_specifier : Warning<
InGroup<ImplicitInt>, DefaultIgnore;

def ext_c_empty_initializer : Extension<
"use of an empty initializer is a C2x extension">, InGroup<C2x>;
def warn_c2x_compat_empty_initializer : Warning<
"use of an empty initializer is incompatible with C standards before C2x">,
InGroup<CPre2xCompat>, DefaultIgnore;
"use of an empty initializer is a C23 extension">, InGroup<C23>;
def warn_c23_compat_empty_initializer : Warning<
"use of an empty initializer is incompatible with C standards before C23">,
InGroup<CPre23Compat>, DefaultIgnore;
}

let CategoryName = "Nullability Issue" in {
Expand Down Expand Up @@ -223,12 +223,12 @@ def err_cxx23_size_t_suffix: Error<
def err_size_t_literal_too_large: Error<
"%select{signed |}0'size_t' literal is out of range of possible "
"%select{signed |}0'size_t' values">;
def ext_c2x_bitint_suffix : ExtWarn<
"'_BitInt' suffix for literals is a C2x extension">,
InGroup<C2x>;
def warn_c2x_compat_bitint_suffix : Warning<
"'_BitInt' suffix for literals is incompatible with C standards before C2x">,
InGroup<CPre2xCompat>, DefaultIgnore;
def ext_c23_bitint_suffix : ExtWarn<
"'_BitInt' suffix for literals is a C23 extension">,
InGroup<C23>;
def warn_c23_compat_bitint_suffix : Warning<
"'_BitInt' suffix for literals is incompatible with C standards before C23">,
InGroup<CPre23Compat>, DefaultIgnore;
def err_integer_literal_too_large : Error<
"integer literal is too large to be represented in any %select{signed |}0"
"integer type">;
Expand Down
18 changes: 12 additions & 6 deletions clang/include/clang/Basic/DiagnosticGroups.td
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ def MacroRedefined : DiagGroup<"macro-redefined">;
def BuiltinMacroRedefined : DiagGroup<"builtin-macro-redefined">;
def BuiltinRequiresHeader : DiagGroup<"builtin-requires-header">;
def C99Compat : DiagGroup<"c99-compat">;
def C2xCompat : DiagGroup<"c2x-compat">;
def C23Compat : DiagGroup<"c23-compat">;
def : DiagGroup<"c2x-compat", [C23Compat]>;

def CXXCompat: DiagGroup<"c++-compat">;
def ExternCCompat : DiagGroup<"extern-c-compat">;
def KeywordCompat : DiagGroup<"keyword-compat">;
Expand Down Expand Up @@ -287,9 +289,11 @@ def : DiagGroup<"c++1z-compat-mangling", [CXX17CompatMangling]>;
def NoexceptType : DiagGroup<"noexcept-type", [CXX17CompatMangling]>;

// Warnings for C code which is not compatible with previous C standards.
def CPre2xCompat : DiagGroup<"pre-c2x-compat">;
def CPre2xCompatPedantic : DiagGroup<"pre-c2x-compat-pedantic",
[CPre2xCompat]>;
def CPre23Compat : DiagGroup<"pre-c23-compat">;
def CPre23CompatPedantic : DiagGroup<"pre-c23-compat-pedantic",
[CPre23Compat]>;
def : DiagGroup<"pre-c2x-compat", [CPre23Compat]>;
def : DiagGroup<"pre-c2x-compat-pedantic", [CPre23CompatPedantic]>;

// Warnings for C++ code which is not compatible with previous C++ standards.
def CXXPre14Compat : DiagGroup<"pre-c++14-compat">;
Expand Down Expand Up @@ -1143,8 +1147,10 @@ def C11 : DiagGroup<"c11-extensions">;
// A warning group for warnings about using C99 features as extensions.
def C99 : DiagGroup<"c99-extensions", [C99Designator]>;

// A warning group for warnings about using C2x features as extensions.
def C2x : DiagGroup<"c2x-extensions">;
// A warning group for warnings about using C23 features as extensions.
def C23 : DiagGroup<"c23-extensions">;

def : DiagGroup<"c2x-extensions", [C23]>;

// A warning group for warnings about GCC extensions.
def GNU : DiagGroup<"gnu", [GNUAlignofExpression, GNUAnonymousStruct,
Expand Down
42 changes: 21 additions & 21 deletions clang/include/clang/Basic/DiagnosticLexKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def warn_cxx20_keyword : Warning<"'%0' is a keyword in C++20">,
InGroup<CXX20Compat>, DefaultIgnore;
def warn_c99_keyword : Warning<"'%0' is a keyword in C99">,
InGroup<C99Compat>, DefaultIgnore;
def warn_c2x_keyword : Warning<"'%0' is a keyword in C2x">,
InGroup<C2xCompat>, DefaultIgnore;
def warn_c23_keyword : Warning<"'%0' is a keyword in C23">,
InGroup<C23Compat>, DefaultIgnore;

def ext_unterminated_char_or_string : ExtWarn<
"missing terminating %select{'|'\"'}0 character">, InGroup<InvalidPPToken>;
Expand Down Expand Up @@ -197,14 +197,14 @@ def warn_cxx98_compat_literal_ucn_escape_basic_scs : Warning<
def warn_cxx98_compat_literal_ucn_control_character : Warning<
"universal character name referring to a control character "
"is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
def warn_c2x_compat_literal_ucn_escape_basic_scs : Warning<
def warn_c23_compat_literal_ucn_escape_basic_scs : Warning<
"specifying character '%0' with a universal character name is "
"incompatible with C standards before C2x">,
InGroup<CPre2xCompat>, DefaultIgnore;
def warn_c2x_compat_literal_ucn_control_character : Warning<
"incompatible with C standards before C23">,
InGroup<CPre23Compat>, DefaultIgnore;
def warn_c23_compat_literal_ucn_control_character : Warning<
"universal character name referring to a control character "
"is incompatible with C standards before C2x">,
InGroup<CPre2xCompat>, DefaultIgnore;
"is incompatible with C standards before C23">,
InGroup<CPre23Compat>, DefaultIgnore;
def warn_ucn_not_valid_in_c89 : Warning<
"universal character names are only valid in C99 or C++; "
"treating as '\\' followed by identifier">, InGroup<Unicode>;
Expand All @@ -224,9 +224,9 @@ def err_invalid_suffix_constant : Error<
def warn_cxx11_compat_digit_separator : Warning<
"digit separators are incompatible with C++ standards before C++14">,
InGroup<CXXPre14Compat>, DefaultIgnore;
def warn_c2x_compat_digit_separator : Warning<
"digit separators are incompatible with C standards before C2x">,
InGroup<CPre2xCompat>, DefaultIgnore;
def warn_c23_compat_digit_separator : Warning<
"digit separators are incompatible with C standards before C23">,
InGroup<CPre23Compat>, DefaultIgnore;
def err_digit_separator_not_between_digits : Error<
"digit separator cannot appear at %select{start|end}0 of digit sequence">;
def warn_char_constant_too_large : Warning<
Expand Down Expand Up @@ -415,13 +415,13 @@ def ext_pp_include_next_directive : Extension<
"#include_next is a language extension">, InGroup<GNUIncludeNext>;

def ext_pp_warning_directive : Extension<
"#warning is a %select{C2x|C++23}0 extension">;
"#warning is a %select{C23|C++23}0 extension">;
def warn_cxx23_compat_warning_directive : Warning<
"#warning is incompatible with C++ standards before C++23">,
InGroup<CXXPre23Compat>, DefaultIgnore;
def warn_c2x_compat_warning_directive : Warning<
"#warning is incompatible with C standards before C2x">,
InGroup<CPre2xCompat>, DefaultIgnore;
def warn_c23_compat_warning_directive : Warning<
"#warning is incompatible with C standards before C23">,
InGroup<CPre23Compat>, DefaultIgnore;

def ext_pp_extra_tokens_at_eol : ExtWarn<
"extra tokens at end of #%0 directive">, InGroup<ExtraTokens>;
Expand Down Expand Up @@ -750,14 +750,14 @@ def warn_cxx98_compat_pp_line_too_big : Warning<
"#line number greater than 32767 is incompatible with C++98">,
InGroup<CXX98CompatPedantic>, DefaultIgnore;

def warn_c2x_compat_pp_directive : Warning<
def warn_c23_compat_pp_directive : Warning<
"use of a '#%select{<BUG IF SEEN>|elifdef|elifndef}0' directive "
"is incompatible with C standards before C2x">,
InGroup<CPre2xCompat>, DefaultIgnore;
def ext_c2x_pp_directive : ExtWarn<
"is incompatible with C standards before C23">,
InGroup<CPre23Compat>, DefaultIgnore;
def ext_c23_pp_directive : ExtWarn<
"use of a '#%select{<BUG IF SEEN>|elifdef|elifndef}0' directive "
"is a C2x extension">,
InGroup<C2x>;
"is a C23 extension">,
InGroup<C23>;
def warn_cxx23_compat_pp_directive : Warning<
"use of a '#%select{<BUG IF SEEN>|elifdef|elifndef}0' directive "
"is incompatible with C++ standards before C++23">,
Expand Down
36 changes: 18 additions & 18 deletions clang/include/clang/Basic/DiagnosticParseKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ def ext_c99_feature : Extension<
"'%0' is a C99 extension">, InGroup<C99>;
def ext_c11_feature : Extension<
"'%0' is a C11 extension">, InGroup<C11>;
def warn_c2x_compat_keyword : Warning<
"'%0' is incompatible with C standards before C2x">,
InGroup<CPre2xCompat>, DefaultIgnore;
def warn_c23_compat_keyword : Warning<
"'%0' is incompatible with C standards before C23">,
InGroup<CPre23Compat>, DefaultIgnore;

def err_c11_noreturn_misplaced : Error<
"'_Noreturn' keyword must precede function declarator">;
Expand Down Expand Up @@ -300,14 +300,14 @@ def note_force_empty_selector_name : Note<
"or insert whitespace before ':' to use %0 as parameter name "
"and have an empty entry in the selector">;
def ext_c_label_end_of_compound_statement : ExtWarn<
"label at end of compound statement is a C2x extension">,
InGroup<C2x>;
"label at end of compound statement is a C23 extension">,
InGroup<C23>;
def ext_cxx_label_end_of_compound_statement : ExtWarn<
"label at end of compound statement is a C++23 extension">,
InGroup<CXX23>;
def warn_c2x_compat_label_end_of_compound_statement : Warning<
"label at end of compound statement is incompatible with C standards before C2x">,
InGroup<CPre2xCompat>, DefaultIgnore;
def warn_c23_compat_label_end_of_compound_statement : Warning<
"label at end of compound statement is incompatible with C standards before C23">,
InGroup<CPre23Compat>, DefaultIgnore;
def warn_cxx20_compat_label_end_of_compound_statement : Warning<
"label at end of compound statement is incompatible with C++ standards before C++23">,
InGroup<CXXPre23Compat>, DefaultIgnore;
Expand Down Expand Up @@ -447,15 +447,15 @@ def ext_ms_static_assert : ExtWarn<
def ext_cxx_static_assert_no_message : ExtWarn<
"'static_assert' with no message is a C++17 extension">, InGroup<CXX17>;
def ext_c_static_assert_no_message : ExtWarn<
"'_Static_assert' with no message is a C2x extension">, InGroup<C2x>;
"'_Static_assert' with no message is a C23 extension">, InGroup<C23>;
def warn_cxx14_compat_static_assert_no_message : Warning<
"'static_assert' with no message is incompatible with C++ standards before "
"C++17">,
DefaultIgnore, InGroup<CXXPre17Compat>;
def warn_c17_compat_static_assert_no_message : Warning<
"'_Static_assert' with no message is incompatible with C standards before "
"C2x">,
DefaultIgnore, InGroup<CPre2xCompat>;
"C23">,
DefaultIgnore, InGroup<CPre23Compat>;
def err_function_definition_not_allowed : Error<
"function definition is not allowed here">;
def err_expected_end_of_enumerator : Error<
Expand Down Expand Up @@ -704,7 +704,7 @@ def warn_cxx98_compat_noexcept_expr : Warning<
def warn_cxx98_compat_nullptr : Warning<
"'nullptr' is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
def ext_c_nullptr : Extension<
"'nullptr' is a C2x extension">, InGroup<C2x>;
"'nullptr' is a C23 extension">, InGroup<C23>;

def warn_wrong_clang_attr_namespace : Warning<
"'__clang__' is a predefined macro name, not an attribute scope specifier; "
Expand All @@ -724,12 +724,12 @@ def warn_cxx98_compat_attribute : Warning<
def warn_ext_cxx11_attributes : Extension<
"[[]] attributes are a C++11 extension">,
InGroup<CXX11>;
def warn_pre_c2x_compat_attributes : Warning<
"[[]] attributes are incompatible with C standards before C2x">,
DefaultIgnore, InGroup<CPre2xCompat>;
def warn_ext_c2x_attributes : Extension<
"[[]] attributes are a C2x extension">,
InGroup<C2x>;
def warn_pre_c23_compat_attributes : Warning<
"[[]] attributes are incompatible with C standards before C23">,
DefaultIgnore, InGroup<CPre23Compat>;
def warn_ext_c23_attributes : Extension<
"[[]] attributes are a C23 extension">,
InGroup<C23>;
def err_cxx11_attribute_forbids_arguments : Error<
"attribute %0 cannot have an argument list">;
def err_attribute_requires_arguments : Error<
Expand Down
16 changes: 8 additions & 8 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ def err_bad_parameter_name : Error<
"%0 cannot be the name of a parameter">;
def err_bad_parameter_name_template_id : Error<
"parameter name cannot have template arguments">;
def ext_parameter_name_omitted_c2x : ExtWarn<
"omitting the parameter name in a function definition is a C2x extension">,
InGroup<C2x>;
def ext_parameter_name_omitted_c23 : ExtWarn<
"omitting the parameter name in a function definition is a C23 extension">,
InGroup<C23>;
def err_anyx86_interrupt_attribute : Error<
"%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
"have %select{a 'void' return type|"
Expand Down Expand Up @@ -4182,7 +4182,7 @@ def warn_vector_mode_deprecated : Warning<
"use the 'vector_size' attribute instead">,
InGroup<DeprecatedAttributes>;
def warn_deprecated_noreturn_spelling : Warning<
"the '[[_Noreturn]]' attribute spelling is deprecated in C2x; use "
"the '[[_Noreturn]]' attribute spelling is deprecated in C23; use "
"'[[noreturn]]' instead">, InGroup<DeprecatedAttributes>;
def err_complex_mode_vector_type : Error<
"type of machine mode does not support base vector types">;
Expand Down Expand Up @@ -5715,7 +5715,7 @@ def note_sentinel_here : Note<
"%select{function|method|block}0 has been explicitly marked sentinel here">;
def warn_strict_uses_without_prototype : Warning<
"passing arguments to %select{a function|%1}0 without a prototype is "
"deprecated in all versions of C and is not supported in C2x">,
"deprecated in all versions of C and is not supported in C23">,
InGroup<DeprecatedNonPrototype>;
def warn_missing_prototype : Warning<
"no previous prototype for function %0">,
Expand All @@ -5730,8 +5730,8 @@ def warn_strict_prototypes : Extension<
"%select{in all versions of C|}0">, InGroup<StrictPrototypes>;
def warn_non_prototype_changes_behavior : Warning<
"a function %select{declaration|definition}0 without a prototype is "
"deprecated in all versions of C %select{and is not supported in C2x|and is "
"treated as a zero-parameter prototype in C2x, conflicting with a "
"deprecated in all versions of C %select{and is not supported in C23|and is "
"treated as a zero-parameter prototype in C23, conflicting with a "
"%select{previous|subsequent}2 %select{declaration|definition}3}1">,
InGroup<DeprecatedNonPrototype>;
def note_conflicting_prototype : Note<"conflicting prototype is here">;
Expand Down Expand Up @@ -9992,7 +9992,7 @@ def warn_second_arg_of_va_start_not_last_named_param : Warning<
InGroup<Varargs>;
def warn_c17_compat_ellipsis_only_parameter : Warning<
"'...' as the only parameter of a function is incompatible with C standards "
"before C2x">, DefaultIgnore, InGroup<CPre2xCompat>;
"before C23">, DefaultIgnore, InGroup<CPre23Compat>;
def warn_va_start_type_is_undefined : Warning<
"passing %select{an object that undergoes default argument promotion|"
"an object of reference type|a parameter declared with the 'register' "
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Basic/IdentifierTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ IdentifierTable::getFutureCompatDiagKind(const IdentifierInfo &II,
if ((Flags & KEYC99) == KEYC99)
return diag::warn_c99_keyword;
if ((Flags & KEYC23) == KEYC23)
return diag::warn_c2x_keyword;
return diag::warn_c23_keyword;
}

llvm_unreachable(
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Lex/Lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1959,7 +1959,7 @@ bool Lexer::LexNumericConstant(Token &Result, const char *CurPtr) {
if (!isLexingRawMode())
Diag(CurPtr, LangOpts.CPlusPlus
? diag::warn_cxx11_compat_digit_separator
: diag::warn_c2x_compat_digit_separator);
: diag::warn_c23_compat_digit_separator);
CurPtr = ConsumeChar(CurPtr, Size, Result);
CurPtr = ConsumeChar(CurPtr, NextSize, Result);
return LexNumericConstant(Result, CurPtr);
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Lex/LiteralSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,14 +689,14 @@ static bool ProcessUCNEscape(const char *ThisTokBegin, const char *&ThisTokBuf,
IsError ? diag::err_ucn_escape_basic_scs
: Features.CPlusPlus
? diag::warn_cxx98_compat_literal_ucn_escape_basic_scs
: diag::warn_c2x_compat_literal_ucn_escape_basic_scs)
: diag::warn_c23_compat_literal_ucn_escape_basic_scs)
<< StringRef(&BasicSCSChar, 1);
else
Diag(Diags, Features, Loc, ThisTokBegin, UcnBegin, ThisTokBuf,
IsError ? diag::err_ucn_control_character
: Features.CPlusPlus
? diag::warn_cxx98_compat_literal_ucn_control_character
: diag::warn_c2x_compat_literal_ucn_control_character);
: diag::warn_c23_compat_literal_ucn_control_character);
}
if (IsError)
return false;
Expand Down
10 changes: 5 additions & 5 deletions clang/lib/Lex/PPDirectives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,8 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation HashTokenLoc,
DiagID = LangOpts.CPlusPlus23 ? diag::warn_cxx23_compat_pp_directive
: diag::ext_cxx23_pp_directive;
else
DiagID = LangOpts.C23 ? diag::warn_c2x_compat_pp_directive
: diag::ext_c2x_pp_directive;
DiagID = LangOpts.C23 ? diag::warn_c23_compat_pp_directive
: diag::ext_c23_pp_directive;
Diag(Tok, DiagID) << (IsElifDef ? PED_Elifdef : PED_Elifndef);

// If this is a #elif with a #else before it, report the error.
Expand Down Expand Up @@ -1277,7 +1277,7 @@ void Preprocessor::HandleDirective(Token &Result) {
: diag::ext_pp_warning_directive)
<< /*C++23*/ 1;
else
Diag(Result, LangOpts.C23 ? diag::warn_c2x_compat_warning_directive
Diag(Result, LangOpts.C23 ? diag::warn_c23_compat_warning_directive
: diag::ext_pp_warning_directive)
<< /*C23*/ 0;

Expand Down Expand Up @@ -3453,8 +3453,8 @@ void Preprocessor::HandleElifFamilyDirective(Token &ElifToken,
DiagID = LangOpts.CPlusPlus23 ? diag::warn_cxx23_compat_pp_directive
: diag::ext_cxx23_pp_directive;
else
DiagID = LangOpts.C23 ? diag::warn_c2x_compat_pp_directive
: diag::ext_c2x_pp_directive;
DiagID = LangOpts.C23 ? diag::warn_c23_compat_pp_directive
: diag::ext_c23_pp_directive;
Diag(ElifToken, DiagID) << DirKind;
break;
default:
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Lex/PPExpressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
// to a library type may be more appropriate there.
if (Literal.isBitInt)
PP.Diag(PeekTok, PP.getLangOpts().C23
? diag::warn_c2x_compat_bitint_suffix
: diag::ext_c2x_bitint_suffix);
? diag::warn_c23_compat_bitint_suffix
: diag::ext_c23_bitint_suffix);

// Parse the integer literal into Result.
if (Literal.GetIntegerValue(Result.Val)) {
Expand Down

0 comments on commit 9c4ade0

Please sign in to comment.