[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 10 08:52:19 PDT 2024
================
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 %s -verify -fno-builtin -Werror=comment -Wno-error=abi -Wfatal-errors=assume -Wno-fatal-errors=assume
+
+#define diagnose_if(...) __attribute__((diagnose_if(__VA_ARGS__)))
+
+template <bool b>
+void diagnose_if_wcomma() diagnose_if(b, "oh no", "warning", "comma") {}
+
+template <bool b>
+void diagnose_if_wcomment() diagnose_if(b, "oh no", "warning", "comment") {}
+
+void bougus_warning() diagnose_if(true, "oh no", "warning", "bougus warning") {} // expected-error {{unknown warning group}}
----------------
AaronBallman wrote:
Perhaps `unknown warning group 'bogus warning'` instead? Mostly just because it may be hard to remember which one is the warning group, esp once we allow passing extra args for `%select` fields, etc.
https://github.com/llvm/llvm-project/pull/70976
More information about the cfe-commits
mailing list