ChenMiaoi wrote:

> This solution feels like a bit of a hack: we implicitly add an attribute that 
> references an argument that doesn’t exist, then complain when we try to get 
> that argument (which we only do because the compiler implicitly added an 
> attribute). The diagnostic is also not great ‘format string is not a string 
> literal’ when there is no argument to begin with is a rather janky.
> 
> Both the `format` and `format_arg` attributes are currently ignored on 
> prototypeless declarations. We should probably just not be implicitly adding 
> attributes that reference parameters in the first place if the function has 
> no prototype.
> 
> A proper fix for this would go in `Sema::AddKnownFunctionAttributes()` I 
> believe.
> 
> Additionally, this still needs a release note

Thanks for the explanation. That makes sense—I'll rework the fix and add a 
release note.

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

Reply via email to