clang: re-downgrade implicit int/function declarations to warning only

This reapplies upstream commit c0141f3c300f by Aaron Ballman:

  Downgrade implicit int and implicit function declaration to warning only

  The changes in Clang 15.0.0 which enabled these diagnostics as a
  warning which defaulted to an error caused disruption for people
  working on distributions such as Gentoo. There was an explicit request
  to downgrade these to be warning-only in Clang 15.0.1 with the
  expectation that Clang 16 will default the diagnostics to an error.

  See
  https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213
  for more details on the discussion.

  See https://reviews.llvm.org/D133800 for the public review of these
  changes.

As noted in the upstream discussion, there are many programs that fail
to configure or build correctly, if these warnings are turned into
errors by default.

Note that most affected programs in ports are relatively old, and are
unlikely to be fixed by actually adjusting their declarations, but by
compiling with -std=gnu89, which downgrades the errors back to warning
again. Lots of tedious work for very little gain.
This commit is contained in:
Dimitry Andric 2023-04-25 21:24:04 +02:00
parent 9e7101a856
commit c3450ad127

View File

@ -419,7 +419,7 @@ def warn_implicit_function_decl : Warning<
InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
def ext_implicit_function_decl_c99 : ExtWarn<
"call to undeclared function %0; ISO C99 and later do not support implicit "
"function declarations">, InGroup<ImplicitFunctionDeclare>, DefaultError;
"function declarations">, InGroup<ImplicitFunctionDeclare>;
def note_function_suggestion : Note<"did you mean %0?">;
def err_ellipsis_first_param : Error<
@ -709,7 +709,7 @@ def ext_implicit_lib_function_decl : ExtWarn<
def ext_implicit_lib_function_decl_c99 : ExtWarn<
"call to undeclared library function '%0' with type %1; ISO C99 and later "
"do not support implicit function declarations">,
InGroup<ImplicitFunctionDeclare>, DefaultError;
InGroup<ImplicitFunctionDeclare>;
def note_include_header_or_declare : Note<
"include the header <%0> or explicitly provide a declaration for '%1'">;
def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
@ -4390,7 +4390,7 @@ def err_ident_list_in_fn_declaration : Error<
"a parameter list without types is only allowed in a function definition">;
def ext_param_not_declared : ExtWarn<
"parameter %0 was not declared, defaults to 'int'; ISO C99 and later do not "
"support implicit int">, InGroup<ImplicitInt>, DefaultError;
"support implicit int">, InGroup<ImplicitInt>;
def err_param_default_argument : Error<
"C does not support default arguments">;
def err_param_default_argument_redefinition : Error<
@ -10104,7 +10104,7 @@ def warn_receiver_forward_class : Warning<
def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
def ext_missing_type_specifier : ExtWarn<
"type specifier missing, defaults to 'int'; ISO C99 and later do not support "
"implicit int">, InGroup<ImplicitInt>, DefaultError;
"implicit int">, InGroup<ImplicitInt>;
def err_missing_type_specifier : Error<
"a type specifier is required for all declarations">;
def err_decimal_unsupported : Error<