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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to