[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Compiling a project with '-ansi'
- From: "Liam Devine" <liamdevine@...>
- Date: Thu, 01 Sep 2016 22:55:27 +0100
> Thanks for the advise!
> I ended up using "-Wc90-c99-compat -Wno-long-long".
> Here are my findings:
> 0. The problem pertains to Lua 5.3 only. (Earlier ones don't support
> integers, so the "long long" issue doesn't exist there, IIUC.)
> 1. We can't use -ansi (or -std=c90) because this eventually triggers
> the #error line in 'luaconf.h'. At least in the stock Lua package that
> comes with Ubuntu.
> 2. So instead we have to use warnings: -Wc90-c99-compat.
> 2.a. Unfortunately, while the -Wc90-c99-compat switch exists in gcc, I
> don't know of equivalent clang switch.
> 3. We also need to add -Wno-long-long so that the Lua headers work.
As an alternative, both clang and gcc accept the "__extension__" prefix
where long long is valid. The more correct way, is to check for the
presence and the values of a concoction of POSIX macros and then use