danielmarjamaki added a comment.

In http://reviews.llvm.org/D12359#236334, @aaron.ballman wrote:

> I have concerns about this being a frontend warning. The true positive rate 
> seems rather high given the benign nature of the diagnostic, and the false 
> negative rate is quite high. This seems like it would make more sense as a 
> path-sensitive static analyzer warning instead of a frontend warning, as that 
> would justify the slightly high true positive rate, and rectify quite a bit 
> of the false negative rate.


I don't understand. The checker is path sensitive, isn't it? Do you see some 
problem that I don't?

It will warn if there is no write anywhere in the function. Except as I wrote, 
for some cases where #ifdef is used, but moving it to static analysis won't 
help.

> Have you tried running this over the Clang and LLVM code bases? How many 
> diagnostics does it produce?


Not yet. I'll do that.


================
Comment at: test/Sema/warn-nonconst-parameter.c:8
@@ +7,3 @@
+//
+// It does not warn about pointers to records or function pointers.
+
----------------
aaron.ballman wrote:
> How does it handle cases like:
> 
> void g(int);
> void f(volatile int *p) {
>   int j = *p; // Should not warn
>   int i = p[0]; // Should not warn
>   g(*p); // Should not warn
> }
> 
> void h(int *p) {
>   int i = p ? *p : 0; // Should warn
> }
> 
ok interesting. I have never seen a volatile pointer argument before. but 
technically I believe we should warn about f(). the function only reads p. 
maybe for stylistic reasons it would look weird to say that it's both volatile 
and const, is that why we should not warn?


http://reviews.llvm.org/D12359



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to