================
@@ -7061,6 +7140,16 @@ bool Sema::CheckFormatArguments(ArrayRef<const Expr *> 
Args,
       SourceMgr.isInSystemMacro(FormatLoc))
     return false;
 
+  const LangOptions &LO = getLangOpts();
+  if (CallerParamIdx && (LO.GNUMode || LO.C23 || LO.CPlusPlus11))
----------------
apple-fcloutier wrote:

There are portable ways to annotate your functions, it's just that you can't 
offer them as fixits for a variety of reasons (for instance, create a macro 
that adds the format attribute based on a `__has_attribute` test); in fact, 
even when a language-defined syntax is available, it might not be the preferred 
way to add the attribute in any given project.

But even then, I disagree that the only value (or even the main value) of _any_ 
diagnostic is the fixit. Clang doesn't only diagnose situations that it knows 
how to fix. For a codebase that _truly_ can't do anything about missing format 
attributes, the solution is to not take the intentional step of enabling the 
diagnostic.

https://github.com/llvm/llvm-project/pull/166738
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to