[clang] [clang][Sema] Add diagnostic note for reference of function-like macros requiring without parentheses (PR #123495)

via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 19 15:51:56 PST 2025


================
@@ -134,6 +134,7 @@ void test_NE() {
 // CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{110:32-110:32}:")"
 
 #define INIT(var, init) Foo var = init; // expected-note 3{{defined here}}
+// expected-note at -1 2{{'INIT' exists, but as a function-like macro; perhaps, did you forget the parentheses?}}
----------------
Sirraide wrote:

Er, this note being emitted here is ... not great because we *are* using it (or at least trying to use it) as a function-like macro below—to be fair though, putting an init list in a function-like macro currently already leads to a flood of errors because we can’t recover from it too well, so if this is the only case that causes a false positive then it’s not *that* much of an issue imo.

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


More information about the cfe-commits mailing list