[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Compilation warnings in Lua 5.2.1 (size_t to unsigned int conversion)
- From: William Sumner <prestonsumner@...>
- Date: Thu, 27 Sep 2012 19:43:16 -0600
On Sep 27, 2012, at 6:09 PM, William Ahern <william@25thandClement.com> wrote:
> On Thu, Sep 27, 2012 at 05:02:06PM -0600, William Sumner wrote:
>> On Sep 27, 2012, at 4:24 PM, William Ahern <william@25thandClement.com> wrote:
>>> On Wed, Sep 26, 2012 at 03:17:41PM +0200, jean-luc@zenocloud.eu wrote:
>>>> Hi,
>>>>
>>>> I migrated from Lua 5.2.0 to Lua 5.2.1 this morning. It went really smoothly but with some compiler warnings, hence this message.
>>>>
>>>> So, compiling Lua 5.2.1 on OS X (x86_64) with LLVM compiler 4.1 produces these 2 warnings:
>>>>
>>>> - lstring.c:52:25: warning: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int'
> <snip>
>>> Sorry for beating a dead horse, but I was actually trying to track down the
>>> issue in the clang source code. However, I can't reproduce this warning with
>>> clang 4.1. What flags are you using? I can't get it with -Wall -Wextra.
>>
>> Try -Wconversion or, more specifically, -Wshorten-64-to-32.
>
> Ah, thanks.
>
> The Lua source explodes with warnings on -Wconversion. So it must've been
> -Wshorten-64-to-32, which isn't even close to being a default warning.
>
>> From the original report it sounded like this was a default or common
> diagnostic switch.
>
-Wshorten-64-to-32 is enabled by default for Xcode projects, I believe as a result of Apple's 64-bit portability strategy (e.g., NSInteger). I think the point of the report was just to let Lua developers know that Apple platform developers will be seeing the two warnings. As said before, developers can add explicit casts, or disable the warning on a per-file basis or project-wide if they desire.