Ticket #10396: 0001-Add-flags-needed-for-Clang-to-the-build-system.patch

File 0001-Add-flags-needed-for-Clang-to-the-build-system.patch, 2.3 KB (added by js, 6 years ago)
  • build/jam/ArchitectureRules

    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  
    2828    #       our gcc4 compiler. See this discussion on some issues:
    2929    # http://www.freelists.org/post/haiku-development/hrev45320-Yet-another-nonobvious-effect-of-ftreevrp-optimization
    3030    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        }
    3235    }
    3336
    3437    # disable array bounds warnings on gcc 4.6 or newer since they trigger
    rule ArchitectureSetupWarnings architecture  
    473476    HAIKU_WERROR_ARCH = $(architecture) ;
    474477
    475478    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        }
    478485    }
    479486
    480487    # Work-around for GCC 2 problem -- despite -Wno-multichar it reports
    rule ArchitectureSetupWarnings architecture  
    486493        WARNINGS on $(file) = $(WARNINGS) ;
    487494    }
    488495
     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
    489505    EnableWerror src add-ons accelerants 3dfx ;
    490506    EnableWerror src add-ons accelerants ati ;
    491507    EnableWerror src add-ons accelerants common ;