Add flags needed for Clang to the build system.

This uses a variable CLANG that should be set to the Clang version. For
now, this has to be done manually (e.g. when invoking jam using jam
-sCLANG=34), but later, this will be auto-detected.

Work towards bug #10396
This commit is contained in:
Jonathan Schleifer
2014-01-11 17:33:36 -06:00
committed by Alexander von Gluck IV
parent 4f357bc071
commit 624435c494
+19 -3
View File
@@ -28,7 +28,10 @@ rule ArchitectureSetup architecture
# our gcc4 compiler. See this discussion on some issues:
# http://www.freelists.org/post/haiku-development/hrev45320-Yet-another-nonobvious-effect-of-ftreevrp-optimization
if $(gccVersion[1]) >= 3 {
gccBaseFlags += -fno-strict-aliasing -fno-tree-vrp ;
gccBaseFlags += -fno-strict-aliasing ;
if ! $(CLANG) {
gccBaseFlags += -fno-tree-vrp ;
}
}
# disable array bounds warnings on gcc 4.6 or newer since they trigger
@@ -473,8 +476,12 @@ rule ArchitectureSetupWarnings architecture
HAIKU_WERROR_ARCH = $(architecture) ;
rule EnableWerror dirTokens : scope {
SetConfigVar WARNINGS : HAIKU_TOP $(dirTokens) : treatAsErrors
: $(scope) ;
# Clang gives way more warnings than GCC, so that code won't compile
# -Werror when using Clang.
if ! $(CLANG) {
SetConfigVar WARNINGS : HAIKU_TOP $(dirTokens) : treatAsErrors
: $(scope) ;
}
}
# Work-around for GCC 2 problem -- despite -Wno-multichar it reports
@@ -486,6 +493,15 @@ rule ArchitectureSetupWarnings architecture
WARNINGS on $(file) = $(WARNINGS) ;
}
if $(CLANG) {
# We need -integrated-as, as otherwise Clang uses GCC as assembler and
# passes -fheinous-gnu-extensions to GCC, which GCC does not understand
# then errors out.
AppendToConfigVar CCFLAGS :
HAIKU_TOP src system libroot posix glibc :
-integrated-as -fgnu89-inline -fheinous-gnu-extensions : global ;
}
EnableWerror src add-ons accelerants 3dfx ;
EnableWerror src add-ons accelerants ati ;
EnableWerror src add-ons accelerants common ;