nikhgupt added a comment.

In https://reviews.llvm.org/D24411#545381, @zaks.anna wrote:

> It is not clear to me that we've reached a consensus on cfe-dev list that 
> suppressing with comments and printing the checker name is the way to go.


I'm new to the LLVM upstreaming process and have not been a part of the 
previous threads discussing this. It is my understanding that false positive 
suppression is of importance to the community. What is the common consensus on 
implementing Analyzer suppressions?

While suppressing with the use of comments is debatable, my findings indicate 
that a blind suppression statement for a line of code (ie: without the use of a 
checker name) can lead to some confusion with developers. For instance, the 
(simplified) code example below emits two analyzer warnings on the last line: A 
dead-code warning for 'y' as well as a division-by-zero warning for the 
arithmetic operation. A blind suppression by a developer who assumes that this 
would only emit a false positive deadcode warning, will unintentionally 
suppress the crucial division by zero warning.

  void dummyFunc(){
    int a=5;
    int b=0;
    volatile int c = a/b;
  }

By annotating the warnings they intend on suppressing we can ensure that 
developers are aware of any other bugs that can emerge from that line.

ie:

  void dummyFunc(){
    int a=5;
    int b=0;
    volatile int c = a/b; //clang_sa_ignore[deadcode,core.DivideZero]
  }

In order to do so, we will have to make the specific warning checker name 
visible to the user.


https://reviews.llvm.org/D24411



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

Reply via email to