[clang] Improve clarity of the implicit declaration diagnostic (PR #149314)
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 17 07:47:05 PDT 2025
================
@@ -816,11 +816,12 @@ def warn_unreachable_association : Warning<
/// Built-in functions.
def ext_implicit_lib_function_decl : ExtWarn<
- "implicitly declaring library function '%0' with type %1">,
- InGroup<ImplicitFunctionDeclare>;
+ "implicitly declaring library function '%0' with%select{| standards-mandated}2 "
+ "type %1">, InGroup<ImplicitFunctionDeclare>;
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">,
+ "call to undeclared library function '%0', will assume it exists with"
+ "%select{| standards-mandated}2 type %1; ISO C99 and later do not support "
+ "implicit function declarations">,
InGroup<ImplicitFunctionDeclare>, DefaultError;
----------------
cor3ntin wrote:
A way to simplify (ie, get rid of `isDeclaredInStandardHeader`)
would be to say " will assume it exists with type %1 as if header <%2>" had been included"
(where %2 is ` Context.BuiltinInfo.getName(ID)`)
WDYT?
https://github.com/llvm/llvm-project/pull/149314
More information about the cfe-commits
mailing list