From 0894aaa7fa348db0fdfce8b0b7fd6435a86086c9 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Wed, 30 Oct 2013 19:46:34 +0000 Subject: [PATCH] Fix strcasecmp defined on Windows, add warnings as errors compile argument, always supress offsetof warnings --- SConscript | 9 ++++++++- src/Config.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/SConscript b/SConscript index 842d6117f..2fc04b97f 100755 --- a/SConscript +++ b/SConscript @@ -78,6 +78,7 @@ AddOption('--x86',dest="x86",action='store_true',default=True,help="Target Intel AddOption('--nofft',dest="nofft", action='store_true',default=False,help="Do not use fftw3f for gravity.") AddOption('--nolua',dest="nolua", action='store_true',default=False,help="Disable all lua scripting features.") +AddOption('--warnings-as-errors', dest="warnings_as_errors", action="store_true", default=False, help="Treat all warnings as errors") AddOption('--debugging', dest="debug", action="store_true", default=False, help="Enable debug options") AddOption('--beta',dest="beta",action='store_true',default=False,help="Beta build.") AddOption('--save-version',dest="save-version",default=False,help="Save version.") @@ -257,6 +258,12 @@ env.Append(CXXFLAGS=['-std=c++98']) env.Append(LIBS=['pthread', 'm']) env.Append(CPPDEFINES=["_GNU_SOURCE", "USE_STDINT", "_POSIX_C_SOURCE=200112L"]) +# set the warnings we want, treat all warnings as errors, and ignore all "offsetof" warnings + +env.Append(CCFLAGS=['-Wno-invalid-offsetof']); +if GetOption('warnings_as_errors'): + env.Append(CCFLAGS=['-Werror']); + # check all enabled libs, and add a define if they are enabled. if not GetOption('nofft'): @@ -287,7 +294,7 @@ if(GetOption('release')): if GetOption('macosx'): env.Append(CCFLAGS=['-O3', '-ftree-vectorize', '-funsafe-math-optimizations', '-ffast-math', '-fomit-frame-pointer']) else: - env.Append(CCFLAGS=['-O3', '-ftree-vectorize', '-funsafe-math-optimizations', '-ffast-math', '-fomit-frame-pointer', '-funsafe-loop-optimizations', '-Wno-invalid-offsetof']) + env.Append(CCFLAGS=['-O3', '-ftree-vectorize', '-funsafe-math-optimizations', '-ffast-math', '-fomit-frame-pointer', '-funsafe-loop-optimizations']) # rpi specific enviroment settings # ++++++++++++++++++++++++++++++++ diff --git a/src/Config.h b/src/Config.h index 35f4bf9ff..19efd36dd 100644 --- a/src/Config.h +++ b/src/Config.h @@ -165,7 +165,7 @@ extern unsigned char ZSIZE; #define GLASS_IOR 1.9 #define GLASS_DISP 0.07 -#ifdef WIN +#if defined(WIN) && !defined(strcasecmp) #define strcasecmp stricmp #endif #if defined(_MSC_VER)