[clang] [Clang] raise extension warning for unknown namespaced attributes (PR #120925)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 24 06:34:30 PST 2025


erichkeane wrote:

> Thanks for this patch.
> 
> Sorry I did not see this sooner.
> 
> I am not convinced this the best way to resolve #120875 - and I suspect in practice it would be a bit difficult to use/be under used. 

I'm not convinced here?  I think a flag that says "warn me about unknown namespaces" is particularly useful, but the effect of "don't warn me about unknown namespaces, but warn me about attributes in known namespaces" _IS_ also particularly useful.  (that is, if you don't know the namespace, shush, else tell me about it).

>I think the general desire is for users to have a way (maybe a file) where they can list all the attributes they want the implementation to ignore when unknown (with their namespaces). 

If anything, a list on a command line as an extension to this (that is, don't warn me about THIS LIST of unknown namespaces) would be incredibly useful, something like: `-Wno-unknown-namespace-attributes=my_static_analysis_tool,my_annotation`.  But I think this is independently useful without it .

>Additionally this should be used to typo correct. I am not convinced that the current subset that just allows a list of namespace hidden in a warning flag is sufficient / worth it.

THAT is the downside unfortunately to our diagnostics system in general, and I'm particularly upset in this case that we don't have a way of differentiating between 'typo' and 'intentionally ignored.  Which is why the flag you propose I believe is a REALLY good idea, but I'm hesitent to make it required in this patch.
> 
> I think we should definitely display the namespace name in the current diagnostic, but for the opt-out mechanism, i think we should have a better sense of a solution that covers all the use cases and then implement that.
> 
> Note that I haven't chatted to @AaronBallman and @erichkeane yet, but I think that's worth discussing before proceeding.
> 
> P.S: Please offer a description in your non-trivial changes, explaining your design choices and so forth. thanks a lot



https://github.com/llvm/llvm-project/pull/120925


More information about the cfe-commits mailing list