From 624435c49445b6859c6b25c4180849c1fb5928e9 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Fri, 10 Jan 2014 21:06:25 +0100 Subject: [PATCH] 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 --- build/jam/ArchitectureRules | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules index 9d56f6b484..ca620cd057 100644 --- a/build/jam/ArchitectureRules +++ b/build/jam/ArchitectureRules @@ -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 ;