[clang] Warning for incorrect useof 'pure' attribute (PR #78200)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 16 10:46:07 PST 2024


kelbon wrote:

> The changes should also come with a release note so users know about the improved diagnostics.

Dont know how to do it, can you please reference what i need to do?

> How about: '%select{pure|const}0' attribute applied to a function which %select{returns 'void'|has no return value}1; attribute ignored? Then it handles both situations, both attributes, and we don't need to invent a new warning group (it can go under IgnoredAttributes).

-Currennt behavior: silent UB
-I think how this should work in future: valid and special case of [[pure]]
-This PR: warning + UB

But now i dont think it is not a good idea to ignore attribute, because GCC does not ignores it (so, code will work until compiled with GCC and breaks)

Also i will add warning for destructors (i was working and forget about it)

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


More information about the cfe-commits mailing list