[clang] [AIX] Turn on `#pragma mc_func` check by default (PR #101336)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 9 08:34:01 PDT 2024


AaronBallman wrote:

> I have relayed the comments internally and we are discussing it. I will let you know as soon as possible.

Thank you!

> No we were not aware of other use cases. But -Wunknown-pragmas=<pragma-name> sounds like a good idea! Do you think this can be useful in other cases? How do we envision this warning/error to work with the existing unknown-pragmas warning if they are both present? I will draft a discourse RFC if this is sufficiently general/useful.

I think this would be useful for both pragmas and attributes (with `-Wunknown-attribute=` as well), but it might be somewhat more involved to implement because IIRC we have to treat those warnings as command line options directly (in Options.td) in order to get the correct behavior.

I would imagine that we'd want last-flag-wins behavior for cases like `-Wunknown-pragmas=foo -Wno-unknown-pragmas` (silences all pragma warnings) or `-Wno-unknown-pragmas -Wunknown-pragmas=foo` (silences all pragma warnings except for `#pragma foo`). Similar for attributes. We probably also want to support a delimited list of pragmas/attributes to ignore, like `-Wno-unknown-attributes=foo,bar,baz`. I don't think we need to care about the syntax used for the attribute (`__attribute__` vs `[[]]` vs `__declspec`), just the attribute name. But it does mean we have to think about cases where the same attribute name is under different prefixes, like `clang::builtin_alias` and `clang_builtin_alias` or `clang::no_stack_protector` and `gnu::no_stack_protector`.

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


More information about the cfe-commits mailing list