-ansi and the default CXX flags (was Re: [PATCH 1/3] Pass additional gcc compiler flags regardless of the OS.)
Raphael Kubo da Costa
rakuco at FreeBSD.org
Mon Aug 13 03:25:47 UTC 2012
Alexander Neundorf <neundorf at kde.org> writes:
> On Monday 30 July 2012, Raphael Kubo da Costa wrote:
>> Raphael Kubo da Costa <rakuco at FreeBSD.org> writes:
>> > Building picmi on FreeBSD was failing because of -Wlong-long, which
>> > should have been disabled by default via _KDE4_PLATFORM_DEFINITIONS.
>> >
>> > However, commit 4e0bbaee43ecf3fe8c880212da8ad6ca96978c2a made the
>> > additional gcc flags be passed only when building on Linux (commit
>> > 9986ec68bbbd55a0b7ad589752a0ed0d03ece639 extended that to GNU Hurd)
>> > for no apparent reason.
>> >
>> > Thus sort of restore the behavior present in commit
>> > 4d1789f40ed1cc6e34e55b9edc119ee6389e1368, with the difference that the
>> > flags are passed even on Windows and other systems.
>>
>> Any comments on this one?
>
> I trust your judgement on this.
Sometimes it is good to let a patch cook for a little longer :-)
Today I felt like doing some archeology work, and it looks like this
separation between the Linux/non-Linux case was added in SVN r501434
[1], when FindKDE4.cmake was still in kdesdk. At the time, strtoll(3)
failed on FreeBSD when -ansi was passed, and the behavior remains the
same to this day. It looks correct to me: to gcc, -ansi means C90 for C
files and C++98 for C++ files, strtoll is part of C99 and is only
available on Linux with -ansi because gcc/libstdc++ define _GNU_SOURCE
by default.
Looking even further back in time, -ansi seems to have been originally
added by coolo to acinclude.m4.in in r50947 [2] only for glibc and when
building in debug mode.
I see two options here: either go back to adding -ansi only for Linux
(and making all the other flags common to all systems using gcc), or
just dropping -ansi altogether and using the same flags for all systems.
Thoughts?
[1] http://websvn.kde.org/?view=revision&revision=501434
[2] http://websvn.kde.org/?view=revision&revision=50947
More information about the Kde-buildsystem
mailing list