From 175b3ff633ead4aed3a31475968ae81f855a877a Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sun, 19 Dec 2010 12:46:14 +0000 Subject: Improved gcc version checking, disabled some warnings for gcc 4.0.1 git-svn-id: http://pugixml.googlecode.com/svn/trunk@802 99668b35-9821-0410-8761-19e4c4f06640 --- Jamrules.jam | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'Jamrules.jam') diff --git a/Jamrules.jam b/Jamrules.jam index dc7ba35..389a6ad 100644 --- a/Jamrules.jam +++ b/Jamrules.jam @@ -30,18 +30,39 @@ if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) ) LDFLAGS += $(ARCH) ; } + rule MatchVersion MAJOR : MINOR + { + local REGEX = "(gcc|mingw)"$(MAJOR)"\\.?"$(MINOR) ; + + if ( $(toolset:I=$(REGEX)) ) + { + return 1 ; + } + else + { + return 0 ; + } + } + rule GetCFlags CONFIG : DEFINES { local RESULT = -D$(DEFINES) ; RESULT += -W -Wall -Wextra -pedantic -Werror ; - RESULT += -Wabi -Wctor-dtor-privacy -Wno-non-template-friend -Wold-style-cast -Wcast-qual -Wcast-align ; - RESULT += -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo -Wformat=2 -Winit-self -Wswitch-default ; + RESULT += -Wabi -Wno-non-template-friend -Wcast-qual -Wcast-align ; + RESULT += -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo -Wformat=2 -Winit-self ; RESULT += -Wunused -Wstrict-aliasing=2 -Wundef -Wshadow -Wredundant-decls ; - local REG_GCC44_PLUS = "(gcc|mingw)4.?[4-9]" ; + # gcc 4.0 has some warning regressions + if ( [ MatchVersion 4 : 0 ] = 0 ) + { + RESULT += -Wold-style-cast ; # gives warnings for fpclassify() on gcc 4.0.1 + RESULT += -Wswitch-default ; # gives false-positives for couple of switches on template argument on gcc 4.0.1 + RESULT += -Wctor-dtor-privacy ; # gives false-positives for structs on gcc 4.0.1 + } - if ( $(toolset:I=$(REG_GCC44_PLUS)) ) + # these warnings are supported on newer GCC versions only + if ( [ MatchVersion 4 : "[4-9]" ] = 1 ) { RESULT += -Wstrict-null-sentinel -Wlogical-op -Wmissing-declarations ; } -- cgit v1.2.3