[LLVMbugs] [Bug 9345] New: Support -Wsign-conversion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 28 10:52:19 PST 2011


           Summary: Support -Wsign-conversion
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: matthewbg at google.com
                CC: llvmbugs at cs.uiuc.edu

Clang's -Wconversion should be more like GCC's with respect to conversions
between signed and unsigned integers.

For reference, here's what gcc(1) has to say:
           Warn for implicit conversions that may alter a value. This includes
           conversions between real and integer, like "abs (x)" when "x" is
           "double"; conversions between signed and unsigned, like "unsigned
           ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
           not warn for explicit casts like "abs ((int) x)" and "ui =
           (unsigned) -1", or if the value is not changed by the conversion
           like in "abs (2.0)".  Warnings about conversions between signed and
           unsigned integers can be disabled by using -Wno-sign-conversion.

           For C++, also warn for conversions between "NULL" and non-pointer
           types; confusing overload resolution for user-defined conversions;
           and conversions that will never use a type conversion operator:
           conversions to "void", the same type, a base class or a reference
           to them. Warnings about conversions between signed and unsigned
           integers are disabled by default in C++ unless -Wsign-conversion is
           explicitly enabled.
           Warn for implicit conversions that may change the sign of an
           integer value, like assigning a signed integer expression to an
           unsigned integer variable. An explicit cast silences the warning.
           In C, this option is enabled also by -Wconversion.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list