[clang] [Sema] -Wpointer-bool-conversion: suppress lambda function pointer conversion diagnostic during instantiation (PR #83497)
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 1 12:36:59 PST 2024
MaskRay wrote:
> Presumably similar things might show up in macros? But can cross that bridge when we come to it.
>
> Perhaps we have some/could use some generic utility for this sort of contextual warning "if these things are literally written next to each other, warn, but if they came to be via template instantiation, macro, (something else?) then don't" because that sort of situation shows up pretty regularly in diagnostics, I think...
I modeled the template instantiation suppression after `diagnoseTautologicalComparison`.
While some macro uses suppress `diagnoseTautologicalComparison` diagnostics, e.g.
```
// Don't issue a warning when either the left or right side of the comparison
// results from a macro expansion.
#define R8435950_A i
#define R8435950_B i
int R8435950(int i) {
if (R8435950_A == R8435950_B) // no-warning
return 0;
return 1;
}
```
some have diagnostics (e.g. https://reviews.llvm.org/D70624). Yes, we can cross that bridge when we come to it.
https://github.com/llvm/llvm-project/pull/83497
More information about the cfe-commits
mailing list