[cfe-commits] [Patch] Extend -Wliteral-conversion to warn on string literals to bool conversion

Richard Trieu rtrieu at google.com
Fri Sep 9 19:27:59 PDT 2011


Running this new warning over LLVM and Clang has found seven broken asserts.
They were in the form of:
  assert("error message");
instead of:
  assert(0 && "error message");
These have been since corrected.  Six of them were straight replacement.
Eli Friedman fixed the seventh case by correcting the surrounding code.

Relevant changes are in revisions are in the range of 139449-139461

On Fri, Sep 9, 2011 at 4:13 PM, Richard Trieu <rtrieu at google.com> wrote:
> Add a new warning and bundle it into -Wliteral-conversion.  This
> warning triggers on cases where a string literal is implicitly
> converted to a bool.  For the common case of:
>
> assert(condition && "Error text");
>
> an exception for string literals in logical operations has also been included.
>




More information about the cfe-commits mailing list