r174986 - Removing a signed/unsigned mismatch warning triggered in MSVC 11.

Aaron Ballman aaron at aaronballman.com
Tue Feb 12 11:19:19 PST 2013


It does, though it kind of bugs me to take something inherently
unsigned and make it signed to appease MSVC.  Then again, it bugs me
to use static_cast, so I guess I'll be bugged either way.  I'll commit
it as signed instead.  Thanks!

~Aaron

On Tue, Feb 12, 2013 at 1:52 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Tue, Feb 12, 2013 at 8:39 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> Author: aaronballman
>> Date: Tue Feb 12 12:39:15 2013
>> New Revision: 174986
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=174986&view=rev
>> Log:
>> Removing a signed/unsigned mismatch warning triggered in MSVC 11.
>>
>> Modified:
>>     cfe/trunk/lib/Format/TokenAnnotator.cpp
>>
>> Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=174986&r1=174985&r2=174986&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
>> +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue Feb 12 12:39:15 2013
>> @@ -729,7 +729,7 @@ public:
>>        // found, insert fake parenthesis and return.
>>        if (Current == NULL || Current->is(tok::semi) || closesScope(*Current) ||
>>            ((Current->Type == TT_BinaryOperator || Current->is(tok::comma)) &&
>> -           getPrecedence(*Current) < Precedence)) {
>> +           getPrecedence(*Current) < static_cast<prec::Level>(Precedence))) {
>
> There is a better fix: just change the type of Precedence.  Does it
> work for MSVC?
>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list