[PATCH] D157572: [clang] Add `[[clang::library_extension]]` attribute

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 24 10:56:46 PDT 2023


cjdb added a comment.

In D157572#4613622 <https://reviews.llvm.org/D157572#4613622>, @aaron.ballman wrote:

> In D157572#4612141 <https://reviews.llvm.org/D157572#4612141>, @cjdb wrote:
>
>> I don't dislike it, but I am a bit concerned about misuse being noisy.
>
> So you're concerned that a library author uses `diagnose_if` to add a diagnostic to a warning group that makes the diagnostic seem too chatty, so the user disables the group and loses the compiler's diagnostics? Or are there other kinds of misuse you're worried about?

More or less the former. I don't know if it'll actually manifest in practice though, I don't see many `diagnose_if` diagnostics to begin with.

>> As much as I hate suppressing diagnostics, I think there needs to be a way to suppress the `diagnose_if` forms of warning without suppressing something that the compiler would otherwise generate. Something like:
>>
>> - `-Wno-deprecated`: suppresses anything that `-Wdeprecated` would turn on.
>> - `-Wno-deprecated=diagnose_if`: just the ones flagged by `diagnose_if`.
>> - `-Wno-deprecated=non-diagnose_if`: complement to #2.
>>
>> (and similarly for `-Wno-error=`.)
>>
>> I'm not sure about the system header knob though: `[[deprecated]]` and `[[nodiscard]]` still show up even when the declaration is in a system header?
>
> Correct, those will still show up when the declaration is in a system header but not when the use is in a system header: https://godbolt.org/z/PjqKbGsrr

Right, my question was more "what is this knob doing?"

> We currently have `-Wuser-defined-warnings` as the warning group for `diagnose_if` warning diagnostics, so I wonder if it would make sense to allow `-Wno-deprecated` suppresses anything that `-Wdeprecated` would turn on, while `-Wdeprecated -Wno-user-defined-warnings` would turn on only the compiler-generated deprecation warnings and not the diagnose_if-generated ones?

Oh neat, this simplifies things a lot!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157572/new/

https://reviews.llvm.org/D157572



More information about the cfe-commits mailing list