diff --git a/aclocal.m4 b/aclocal.m4 index 7e555446a1f1c8f424d83c2fb110be52adbc6b97..151cc2ea2c0d791762c0de9c2937266df1c02e73 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 0c2003b68058eee5d071de3529b32378f0827aec..6402ac5680349dcd255dc1f57059867ecb488d9e 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 9aa824d5bc6da3d9d289cb8d114aa5ac495d02f7..00ce02748e426d0a9a3f3529e144c793796f23bf 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 4c2e4f5e95350847326769f9c33ed1abbc27ba3d..adc3c45146394ca0d3d07a8500290921dfb8f2ba 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);