diff options
author | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2013-09-04 15:29:03 +1000 |
---|---|---|
committer | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2013-09-04 15:29:03 +1000 |
commit | fc4856f9e811d9a23ae9212f43a09ddf5ef12b26 (patch) | |
tree | be25695f2b816016314e912f512a40d5cdf43c22 | |
parent | 62d3fdeb9edfcfdeb661a6b8551ac2fc45b8595c (diff) | |
download | haskell-fc4856f9e811d9a23ae9212f43a09ddf5ef12b26.tar.gz |
Make validate play nice with clang (for Xcode 5 command line tools)
* This partially fixes #8148. However, --with-ghc-4.8 will still not work given the rather dubious m4 macros and the failures in the test suite due to '-nodefaultlibs' still need to be fixed.
-rw-r--r-- | aclocal.m4 | 14 | ||||
-rw-r--r-- | mk/config.mk.in | 1 | ||||
-rw-r--r-- | mk/validate-settings.mk | 9 | ||||
-rw-r--r-- | utils/hp2ps/Axes.c | 12 |
4 files changed, 31 insertions, 5 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 7e555446a1..151cc2ea2c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1184,6 +1184,7 @@ AC_SUBST(GccLT46) dnl Check to see if the C compiler is clang or llvm-gcc dnl +GccIsClang=NO AC_DEFUN([FP_CC_LLVM_BACKEND], [AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING([whether C compiler is clang]) @@ -1191,6 +1192,7 @@ $CC -x c /dev/null -dM -E > conftest.txt 2>&1 if grep "__clang__" conftest.txt >/dev/null 2>&1; then AC_SUBST([CC_CLANG_BACKEND], [1]) AC_SUBST([CC_LLVM_BACKEND], [1]) + GccIsClang=YES AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) @@ -1205,6 +1207,7 @@ else AC_MSG_RESULT([no]) fi fi +AC_SUBST(GccIsClang) rm -f conftest.txt ]) @@ -2049,7 +2052,16 @@ AC_DEFUN([FIND_GCC],[ then $1="$CC" else - FP_ARG_WITH_PATH_GNU_PROG([$1], [$2], [$3]) + FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([$1], [$2], [$3]) + # From Xcode 5 on, OS X command line tools do not include gcc anymore. Use clang. + if test -z "$$1" + then + FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([$1], [clang], [clang]) + fi + if test -z "$$1" + then + AC_MSG_ERROR([cannot find $3 nor clang in your PATH]) + fi fi AC_SUBST($1) ]) diff --git a/mk/config.mk.in b/mk/config.mk.in index 0c2003b680..6402ac5680 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -490,6 +490,7 @@ endif TargetPlatformFull = @TargetPlatformFull@ GccLT34 = @GccLT34@ GccLT46 = @GccLT46@ +GccIsClang = @GccIsClang@ CC = $(WhatGccIsCalled) CC_STAGE0 = @CC_STAGE0@ diff --git a/mk/validate-settings.mk b/mk/validate-settings.mk index 9aa824d5bc..00ce02748e 100644 --- a/mk/validate-settings.mk +++ b/mk/validate-settings.mk @@ -10,6 +10,8 @@ HADDOCK_DOCS = YES ##################### # Warnings +ifeq "$(GccIsClang)" "NO" + # Debian doesn't turn -Werror=unused-but-set-variable on by default, so # we turn it on explicitly for consistency with other users ifeq "$(GccLT46)" "NO" @@ -18,6 +20,13 @@ SRC_CC_WARNING_OPTS += -Werror=unused-but-set-variable SRC_CC_WARNING_OPTS += -Wno-error=inline endif +else + +# Don't warn about unknown GCC pragmas when using clang +SRC_CC_WARNING_OPTS += -Wno-unknown-pragmas + +endif + SRC_CC_OPTS += $(WERROR) -Wall SRC_HC_OPTS += $(WERROR) -Wall diff --git a/utils/hp2ps/Axes.c b/utils/hp2ps/Axes.c index 4c2e4f5e95..adc3c45146 100644 --- a/utils/hp2ps/Axes.c +++ b/utils/hp2ps/Axes.c @@ -203,14 +203,18 @@ Round(floatish y) int i; if (y > 10.0) { - for (i = 0; y > 10.0; y /= 10.0, i++) ; + for (i = 0; y > 10.0; y /= 10.0, i++) + ; y = OneTwoFive(y); - for ( ; i > 0; y = y * 10.0, i--) ; + for ( ; i > 0; y = y * 10.0, i--) + ; } else if (y < 1.0) { - for (i = 0; y < 1.0; y *= 10.0, i++) ; + for (i = 0; y < 1.0; y *= 10.0, i++) + ; y = OneTwoFive(y); - for ( ; i > 0; y = y / 10.0, i--) ; + for ( ; i > 0; y = y / 10.0, i--) + ; } else { y = OneTwoFive(y); |