================
@@ -0,0 +1,65 @@
+// RUN: %clang_analyze_cc1 -xc %s \
+// RUN:   -analyzer-checker=core,debug.ExprInspection,deadcode.DeadStores \
+// RUN:   -verify
+// RUN: %clang_analyze_cc1 -xc++ %s \
+// RUN:   -analyzer-checker=core,debug.ExprInspection,deadcode.DeadStores \
+// RUN:   -verify -w
----------------
NagyDonat wrote:

> > I'm still interested of why are suppressing warnings.
> 
> These are frontend warnings, not related to the changes in this PR. So I 
> think it would be unnecessary to check them.

I support this approach -- I think focused tests that only `expect` warning of 
a certain concrete type are easier to understand. They are also more modular 
and easier to maintain: they don't need updates when the "other" incidentally 
checked warnings are changed.

Of course the ideal situation is when the test code doesn't trigger other kinds 
of warnings; but when that is unavoidable (usually because a compiler warning 
can catch the simple cases of the bug that is checked by a static analyzer 
checker), then suppressing the other warning is a good solution. (I also did 
this in the tests of the checker security.ArrayBound.)

However, perhaps it is better to use single `-Wno-whatever` flags are instead 
of blanket disabling all warnings. (Although the current solution is also 
acceptable IMO.) 

https://github.com/llvm/llvm-project/pull/187530
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to