[extra-cmake-modules] kde-modules: Drop -ansi from the default CXXFLAGS.

Raphael Kubo da Costa rakuco at FreeBSD.org
Fri Aug 17 10:18:22 UTC 2012


Git commit f866e32ecca3e7dddc87afcab4706cf90fcb694d by Raphael Kubo da Costa.
Committed on 17/08/2012 at 12:11.
Pushed by rkcosta into branch 'master'.

Drop -ansi from the default CXXFLAGS.

In preparation for making having the default CXXFLAGS available on all
systems using GCC instead of only Linux/Hurd, remove -ansi from the
CXXFLAGS.

strtoll(3), used, for example, in kdelibs, is part of C99; -ansi means
GCC will switch to C89 and C++98, which breaks things on systems such
as FreeBSD. It worked on glibc-based systems because libstdc++ always
defines _GNU_SOURCE on Linux, which ends up enabling additional
features.

This change should not break existing code, as dropping -ansi actually
means being less strict than before.

Discussed in the kde-buildsystem mailing list [1].

[1] http://lists.kde.org/?t=134482883000001&r=1&w=2

CCMAIL: kde-buildsystem at kde.org

M  +1    -1    kde-modules/KDECompilerSettings.cmake

http://commits.kde.org/extra-cmake-modules/f866e32ecca3e7dddc87afcab4706cf90fcb694d

diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake
index 1b38a1f..12bd1e3 100644
--- a/kde-modules/KDECompilerSettings.cmake
+++ b/kde-modules/KDECompilerSettings.cmake
@@ -325,7 +325,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
    if (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU)
      set ( CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
      # As off Qt 4.6.x we need to override the new exception macros if we want compile with -fno-exceptions
-     set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-check-new -fno-common")
+     set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-check-new -fno-common")
 # TODO: the following line was added by Dirk in 2007 to make snprintf() available. But this should not be necessary, since
 #       _BSD_SOURCE is already added to _KDE4_PLATFORM_DEFINITIONS (http://quickgit.kde.org/index.php?p=kdelibs.git&a=commitdiff&h=4a44862b2d178c1d2e1eb4da90010d19a1e4a42c&hp=6531561cb4ed978ff86b8d840dcafc9705af5527)
 #     add_definitions (-D_BSD_SOURCE)



More information about the Kde-buildsystem mailing list