[llvm] r233004 - Refactor: Simplify boolean expressions in llvm Support
David Blaikie
dblaikie at gmail.com
Mon Mar 23 15:46:49 PDT 2015
On Mon, Mar 23, 2015 at 3:44 PM, Kaylor, Andrew <andrew.kaylor at intel.com>
wrote:
> When I compile this with Visual Studio at /W4 I get this warning:
>
> llvm\lib\Support\APFloat.cpp(1433): warning C4805: '^=' : unsafe mix of
> type 'bool' and type 'unsigned int' in operation
>
Is this worth warning on (Clang doesn't, for example) - should we just
disable the MSVC warning, then?
>
> According to the documentation this is a level 1 warning, so it probably
> appears with all builds. I just happen to have been working on a change to
> enable W4 warnings on Windows.
>
> -Andy
>
>
> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:
> llvm-commits-bounces at cs.uiuc.edu] On Behalf Of David Blaikie
> Sent: Monday, March 23, 2015 12:46 PM
> To: llvm-commits at cs.uiuc.edu
> Subject: [llvm] r233004 - Refactor: Simplify boolean expressions in llvm
> Support
>
> Author: dblaikie
> Date: Mon Mar 23 14:45:40 2015
> New Revision: 233004
>
> URL: http://llvm.org/viewvc/llvm-project?rev=233004&view=rev
> Log:
> Refactor: Simplify boolean expressions in llvm Support
>
> Simplify boolean expressions using `true` and `false` with `clang-tidy`
>
> Patch by Richard Thomson - I dropped the parens and != 0 test, for
> consistency with other patches/tests like this, but I'm open to the notion
> that we should add the explicit non-zero test in all these sort of cases
> (non-bool assigned to a bool).
>
> Differential Revision: http://reviews.llvm.org/D8526
>
> Modified:
> llvm/trunk/lib/Support/APFloat.cpp
>
> Modified: llvm/trunk/lib/Support/APFloat.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=233004&r1=233003&r2=233004&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Support/APFloat.cpp (original)
> +++ llvm/trunk/lib/Support/APFloat.cpp Mon Mar 23 14:45:40 2015
> @@ -1430,7 +1430,7 @@ APFloat::addOrSubtractSignificand(const
>
> /* Determine if the operation on the absolute values is effectively
> an addition or subtraction. */
> - subtract ^= (sign ^ rhs.sign) ? true : false;
> + subtract ^= sign ^ rhs.sign;
>
> /* Are we bigger exponent-wise than the RHS? */
> bits = exponent - rhs.exponent;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150323/b66bd0c8/attachment.html>
More information about the llvm-commits
mailing list