[llvm] r215888 - Silencing an MSVC warning about loop variable conflicting with a variable from an outer scope. NFC.

Aaron Ballman aaron at aaronballman.com
Mon Aug 18 08:04:45 PDT 2014


On Mon, Aug 18, 2014 at 11:02 AM, David Blaikie <dblaikie at gmail.com> wrote:
> On Mon, Aug 18, 2014 at 7:55 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> On Mon, Aug 18, 2014 at 10:46 AM, David Blaikie <dblaikie at gmail.com> wrote:
>>> On Mon, Aug 18, 2014 at 7:33 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
>>>> On Mon, Aug 18, 2014 at 10:18 AM, David Blaikie <dblaikie at gmail.com> wrote:
>>>>> On Mon, Aug 18, 2014 at 4:51 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
>>>>>> Author: aaronballman
>>>>>> Date: Mon Aug 18 06:51:41 2014
>>>>>> New Revision: 215888
>>>>>>
>>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=215888&view=rev
>>>>>> Log:
>>>>>> Silencing an MSVC warning about loop variable conflicting with a variable from an outer scope. NFC.
>>>>>
>>>>> Sorry if this gets a bit repetitious (I ask this about every non-clang
>>>>> warning we make code fixes for) - should we just disable this MSVC
>>>>> warning in LLVM's build system?
>>>>
>>>> I don't think we should; MSVC only seems to warn on code that is truly
>>>> strange. In this case, the loop variable was unsigned, but the
>>>> outer-scope variable of type SDNode * was being used within the loop.
>>>
>>> I'm not sure I follow - there's no mention of "N" inside the loop that
>>> would appear to be using the outer-scope variable (how could it -
>>> scoping rules would pick the closest scoped "N")?
>>
>> Sorry, I misspoke (oye...Monday).
>>
>> You're right, N is not inside of that loop. This is a much less
>> helpful instance of that warning. It's complaining about a usage of N
>> immediately *after* the loop.
>
> Oh, and I'll bet this is warning for when MSVC used to use the
> old/wrong scoping rules for for-loop variables (or perhaps just
> warning in case you brought your code from some other compiler that
> had the wrong scoping) - where a for-loop-variable would leak into the
> enclosing scope.
>
> Given that all compilers we care about don't have that wrongness, I
> think we'll be fine.

Yes, that's my understanding as well.

I've disabled in r215895

~Aaron



More information about the llvm-commits mailing list