[commit: ghc] master: Make validate play nice with clang (for Xcode 5 command line tools) (fc4856f)

git at git.haskell.org git at git.haskell.org
Wed Sep 4 07:31:25 CEST 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/fc4856f9e811d9a23ae9212f43a09ddf5ef12b26/ghc

>---------------------------------------------------------------

commit fc4856f9e811d9a23ae9212f43a09ddf5ef12b26
Author: Manuel M T Chakravarty <chak at cse.unsw.edu.au>
Date:   Wed Sep 4 15:29:03 2013 +1000

    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.


>---------------------------------------------------------------

fc4856f9e811d9a23ae9212f43a09ddf5ef12b26
 aclocal.m4              |   14 +++++++++++++-
 mk/config.mk.in         |    1 +
 mk/validate-settings.mk |    9 +++++++++
 utils/hp2ps/Axes.c      |   12 ++++++++----
 4 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 7e55544..151cc2e 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 0c2003b..6402ac5 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 9aa824d..00ce027 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 4c2e4f5..adc3c45 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);





More information about the ghc-commits mailing list