etienneb added a comment.

As pointed by Eugene,

The following code seems to produce multiple errors.

  int foo() {
    if (strcmp(A, "a") == true)
      return 0;
    return 1;
  }

Results:

  /home/etienneb/examples/test.cc:56:7: warning: function 'strcmp' is compared 
to a suspicious constant [misc-suspicious-string-compare]
    if (strcmp(A, "a") == true)
        ^
  /home/etienneb/examples/test.cc:56:25: warning: implicit cast bool -> 'int' 
[readability-implicit-bool-cast]
    if (strcmp(A, "a") == true)
                          ^
  /home/etienneb/examples/test.cc:56:25: warning: redundant boolean literal 
supplied to boolean operator [readability-simplify-boolean-expr]
    if (strcmp(A, "a") == true)
                          ^
        static_cast<bool>(strcmp(A, "a"))

On my side, I'm not against to keep it that way.
The //implicit cast bool -> 'int'// warning is often too noisy and is often 
ignored by programmers.
The other message sounds more specific and may ring a bell.

WDYT?


http://reviews.llvm.org/D18703



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

Reply via email to