Commit fc4856f9 authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.

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.
parent 62d3fdeb
......@@ -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)
])
......
......@@ -490,6 +490,7 @@ endif
TargetPlatformFull = @TargetPlatformFull@
GccLT34 = @GccLT34@
GccLT46 = @GccLT46@
GccIsClang = @GccIsClang@
CC = $(WhatGccIsCalled)
CC_STAGE0 = @CC_STAGE0@
......
......@@ -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
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment