lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 26 September 2012 18:44, William Sumner <prestonsumner@me.com> wrote:
> On Sep 26, 2012, at 11:34 AM, William Ahern <william@25thandClement.com> wrote:
>
>> On Wed, Sep 26, 2012 at 10:50:20AM -0300, Luiz Henrique de Figueiredo wrote:
>>>> So, compiling Lua 5.2.1 on OS X (x86_64) with LLVM compiler 4.1 produces
>>>> these 2 warnings:
>>>
>>> I get no warnings with the default gcc in my machine (10.7.4 with Xcode
>>> command line tools for Lion, sure which version, probably the March 2012 one):
>>>
>>> % gcc --version
>>> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
>>>
>>> I get no warnings with CC=cc, which is:
>>>
>>> % cc --version
>>> Apple clang version 3.1 (tags/Apple/clang-318.0.54) (based on LLVM 3.1svn)
>>> Target: x86_64-apple-darwin11.4.0
>>
>> That's because clang and GCC are competing to add the most obnoxious
>> diagnostics, and the newest version of clang is usually a step or two ahead.
>> Just give it one or two releases, and GCC will fall into line.
>>
>> Eventually they'll both just immediately exit with the diagnostic, "just use
>> C++ already if you want to cast so much", and then everybody's heads will
>> explode.
>>
>
> Is a default warning about a loss of integer precision that out of line? At any rate, adding explicit casts to my local copy of Lua's source resolves the issue.
>
> Preston
>

No I do not think so and it is nice when libraries compile without
warnings so as not to clutter the output. Although I do wonder why
luai_makeseed even exists[1] as this is the only place I can see it in
the codebase, it causes a cast to size_t and then a truncation to
unsigned int. I would therefore think if any cast is added then it is
done so to the luai_makeseed macro or in place and removing the macro.

[1] Although Lua does like to use macros even when they are not
needed, another example is vmdispatch

Liam