Ticket #6389: haiku-clang.patch

File haiku-clang.patch, 4.9 KB (added by kaliber, 11 years ago)
  • build/jam/BuildSetup

     
    382382        += HAIKU_INCLUDE_PATENTED_CODE=$(HAIKU_INCLUDE_PATENTED_CODE) ;
    383383}
    384384
     385# common flags for clang compiler
     386CLANG_COMMON_FLAGS = -fheinous-gnu-extensions -Wno-unknown-pragmas
     387    -Wno-gnu-designator -Wno-mismatched-tags
     388    -Wno-unused-variable -Wno-unused-value -Wno-sign-compare
     389    -Wno-format-security -Wno-empty-body -Wno-switch-enum
     390    -Wno-#warnings -Wno-pointer-sign ;
     391CLANG_CFLAGS = $(CLANG_COMMON_FLAGS) -std=gnu89 ;
     392CLANG_C++FLAGS = $(CLANG_COMMON_FLAGS) -std=gnu++98 ;
     393
    385394# warning flags
    386395HAIKU_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes
    387396    -Wpointer-arith -Wcast-align -Wsign-compare -Wno-multichar ;
     397if $(HAIKU_USE_CLANG) = 1 {
     398    HAIKU_WARNING_CCFLAGS += $(CLANG_CFLAGS) ;
     399}
    388400HAIKU_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy
    389401    -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare
    390402    -Wno-multichar ;
     403if $(HAIKU_USE_CLANG) = 1 {
     404    HAIKU_WARNING_C++FLAGS += $(CLANG_C++FLAGS) ;
     405}
    391406
    392407HAIKU_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes
    393408    -Wno-multichar ;
     409if $(HAIKU_USE_CLANG) = 1 {
     410    HAIKU_KERNEL_WARNING_CCFLAGS += $(CLANG_CFLAGS) ;
     411}
    394412HAIKU_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-multichar ;
     413if $(HAIKU_USE_CLANG) = 1 {
     414    HAIKU_KERNEL_WARNING_C++FLAGS += $(CLANG_C++FLAGS) ;
     415}
    395416
    396417# debug flags
    397418HAIKU_DEBUG_FLAGS ?= -ggdb ;
  • configure

     
    8282                              emulation. Warning: Make sure your file system
    8383                              supports sufficient attribute sizes (4 KB per
    8484                              file for all attributes won't suffice).
     85  --use-clang
     86                              Use clang compiler instead of gcc
    8587
    8688environment variables:
    8789  HAIKU_AR                    The static library archiver. Defaults to "ar".
    8890  HAIKU_CC                    The compiler. Defaults to "gcc".
     91  HAIKU_GCC                   The gcc compiler. Defaults to "gcc".
    8992  HAIKU_LD                    The linker. Defaults to "ld".
    9093  HAIKU_OBJCOPY               The objcopy to be used. Defaults to "objcopy".
    9194  HAIKU_RANLIB                The static library indexer. Defaults to "ranlib".
     
    153156    fi
    154157
    155158    # PLATFORM_LINKLIBS
    156     gcclib=`$HAIKU_CC -print-libgcc-file-name`
     159    gcclib=`$HAIKU_GCC -print-libgcc-file-name`
    157160    gccdir=`dirname ${gcclib}`
    158161
    159     HAIKU_GCC_RAW_VERSION=`$HAIKU_CC -dumpversion`
    160     HAIKU_GCC_MACHINE=`$HAIKU_CC -dumpmachine`
     162    HAIKU_GCC_RAW_VERSION=`$HAIKU_GCC -dumpversion`
     163    HAIKU_GCC_MACHINE=`$HAIKU_GCC -dumpmachine`
    161164
    162165    HAIKU_GCC_LIB_DIR=${gccdir}
    163166    HAIKU_GCC_LIBGCC=${gccdir}/libgcc.a
     
    172175        4.*)
    173176            # for gcc 4 we use the libstdc++ and libsupc++ that come with the
    174177            # compiler
    175             HAIKU_STATIC_LIBSTDCXX=`$HAIKU_CC -print-file-name=libstdc++.a`
    176             HAIKU_SHARED_LIBSTDCXX=`$HAIKU_CC -print-file-name=libstdc++.so`
    177             HAIKU_STATIC_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.a`
    178             HAIKU_SHARED_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.so`
     178            HAIKU_STATIC_LIBSTDCXX=`$HAIKU_GCC -print-file-name=libstdc++.a`
     179            HAIKU_SHARED_LIBSTDCXX=`$HAIKU_GCC -print-file-name=libstdc++.so`
     180            HAIKU_STATIC_LIBSUPCXX=`$HAIKU_GCC -print-file-name=libsupc++.a`
     181            HAIKU_SHARED_LIBSUPCXX=`$HAIKU_GCC -print-file-name=libsupc++.so`
    179182
    180183            local headers
    181184            if [ -d $gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION ]; then
     
    309312HAIKU_USE_GCC_PIPE=0
    310313HAIKU_HOST_USE_32BIT=0
    311314HAIKU_HOST_USE_XATTR=0
     315HAIKU_USE_CLANG=0
    312316HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR=
    313317HAIKU_ADD_ALTERNATIVE_GCC_LIBS=0
    314318HOST_GCC_LD=`gcc -print-prog-name=ld`
     
    322326
    323327set_default_value HAIKU_AR          ar
    324328set_default_value HAIKU_CC          gcc
     329set_default_value HAIKU_GCC         gcc
    325330set_default_value HAIKU_LD          ld
    326331set_default_value HAIKU_OBJCOPY     objcopy
    327332set_default_value HAIKU_RANLIB      ranlib
     
    421426        --use-gcc-pipe) HAIKU_USE_GCC_PIPE=1; shift 1;;
    422427        --use-32bit)    HAIKU_HOST_USE_32BIT=1; shift 1;;
    423428        --use-xattr)    HAIKU_HOST_USE_XATTR=1; shift 1;;
     429        --use-clang)    HAIKU_USE_CLANG=1; HAIKU_CC=clang; shift 1;;
    424430        *)              echo Invalid argument: \`$1\'; exit 1;;
    425431    esac
    426432done
     
    546552HAIKU_USE_GCC_PIPE                  ?= "${HAIKU_USE_GCC_PIPE}" ;
    547553HAIKU_HOST_USE_32BIT                ?= "${HAIKU_HOST_USE_32BIT}" ;
    548554HAIKU_HOST_USE_XATTR                ?= "${HAIKU_HOST_USE_XATTR}" ;
     555HAIKU_USE_CLANG             ?= "${HAIKU_USE_CLANG}" ;
    549556HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR    ?= ${HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR} ;
    550557HAIKU_ADD_ALTERNATIVE_GCC_LIBS      ?= ${HAIKU_ADD_ALTERNATIVE_GCC_LIBS} ;
    551558
     
    565572
    566573HAIKU_AR                    ?= ${HAIKU_AR} ;
    567574HAIKU_CC                    ?= ${HAIKU_CC} ;
     575HAIKU_GCC                   ?= ${HAIKU_GCC} ;
    568576HAIKU_LD                    ?= ${HAIKU_LD} ;
    569577HAIKU_OBJCOPY               ?= ${HAIKU_OBJCOPY} ;
    570578HAIKU_RANLIB                ?= ${HAIKU_RANLIB} ;