From 82dcbc04c02bd96118e1718b6e4d9eda77ed5eda Mon Sep 17 00:00:00 2001
From: Jonathan Schleifer <js@webkeks.org>
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.
---
build/jam/ArchitectureRules | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 9d56f6b..ca620cd 100644
a
|
b
|
rule ArchitectureSetup architecture
|
28 | 28 | # our gcc4 compiler. See this discussion on some issues: |
29 | 29 | # http://www.freelists.org/post/haiku-development/hrev45320-Yet-another-nonobvious-effect-of-ftreevrp-optimization |
30 | 30 | if $(gccVersion[1]) >= 3 { |
31 | | gccBaseFlags += -fno-strict-aliasing -fno-tree-vrp ; |
| 31 | gccBaseFlags += -fno-strict-aliasing ; |
| 32 | if ! $(CLANG) { |
| 33 | gccBaseFlags += -fno-tree-vrp ; |
| 34 | } |
32 | 35 | } |
33 | 36 | |
34 | 37 | # disable array bounds warnings on gcc 4.6 or newer since they trigger |
… |
… |
rule ArchitectureSetupWarnings architecture
|
473 | 476 | HAIKU_WERROR_ARCH = $(architecture) ; |
474 | 477 | |
475 | 478 | rule EnableWerror dirTokens : scope { |
476 | | SetConfigVar WARNINGS : HAIKU_TOP $(dirTokens) : treatAsErrors |
477 | | : $(scope) ; |
| 479 | # Clang gives way more warnings than GCC, so that code won't compile |
| 480 | # -Werror when using Clang. |
| 481 | if ! $(CLANG) { |
| 482 | SetConfigVar WARNINGS : HAIKU_TOP $(dirTokens) : treatAsErrors |
| 483 | : $(scope) ; |
| 484 | } |
478 | 485 | } |
479 | 486 | |
480 | 487 | # Work-around for GCC 2 problem -- despite -Wno-multichar it reports |
… |
… |
rule ArchitectureSetupWarnings architecture
|
486 | 493 | WARNINGS on $(file) = $(WARNINGS) ; |
487 | 494 | } |
488 | 495 | |
| 496 | if $(CLANG) { |
| 497 | # We need -integrated-as, as otherwise Clang uses GCC as assembler and |
| 498 | # passes -fheinous-gnu-extensions to GCC, which GCC does not understand |
| 499 | # then errors out. |
| 500 | AppendToConfigVar CCFLAGS : |
| 501 | HAIKU_TOP src system libroot posix glibc : |
| 502 | -integrated-as -fgnu89-inline -fheinous-gnu-extensions : global ; |
| 503 | } |
| 504 | |
489 | 505 | EnableWerror src add-ons accelerants 3dfx ; |
490 | 506 | EnableWerror src add-ons accelerants ati ; |
491 | 507 | EnableWerror src add-ons accelerants common ; |