Remove RAWCPP_FLAGS (Task #9094)
authorThomas Miedema <thomasmiedema@gmail.com>
Tue, 17 Feb 2015 14:36:56 +0000 (08:36 -0600)
committerAustin Seipp <austin@well-typed.com>
Tue, 17 Feb 2015 15:06:11 +0000 (09:06 -0600)
Reviewers: carter, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D648

GHC Trac Issues: #9094

aclocal.m4
compiler/ghc.mk
configure.ac
distrib/configure.ac.in
mk/config.mk.in
rules/manual-package-config.mk

index 6933e6f..cb4aa83 100644 (file)
@@ -2146,7 +2146,7 @@ dnl ** what cpp to use?
 dnl --------------------------------------------------------------
 AC_ARG_WITH(hs-cpp,
 [AC_HELP_STRING([--with-hs-cpp=ARG],
 dnl --------------------------------------------------------------
 AC_ARG_WITH(hs-cpp,
 [AC_HELP_STRING([--with-hs-cpp=ARG],
-        [Use ARG as the path to cpp [default=autodetect]])],
+      [Path to the (C) preprocessor for Haskell files [default=autodetect]])],
 [
     if test "$HostOS" = "mingw32"
     then
 [
     if test "$HostOS" = "mingw32"
     then
@@ -2157,6 +2157,8 @@ AC_ARG_WITH(hs-cpp,
 ],
 [
 
 ],
 [
 
+    # We can't use $CPP here, since HS_CPP_CMD is expected to be a single
+    # command (no flags), and AC_PROG_CPP defines CPP as "/usr/bin/gcc -E".
     HS_CPP_CMD=$WhatGccIsCalled
 
     SOLARIS_GCC_CPP_BROKEN=NO
     HS_CPP_CMD=$WhatGccIsCalled
 
     SOLARIS_GCC_CPP_BROKEN=NO
@@ -2198,7 +2200,7 @@ dnl ** what cpp flags to use?
 dnl -----------------------------------------------------------
 AC_ARG_WITH(hs-cpp-flags,
   [AC_HELP_STRING([--with-hs-cpp-flags=ARG],
 dnl -----------------------------------------------------------
 AC_ARG_WITH(hs-cpp-flags,
   [AC_HELP_STRING([--with-hs-cpp-flags=ARG],
-          [Use ARG as the path to hs cpp [default=autodetect]])],
+      [Flags to the (C) preprocessor for Haskell files [default=autodetect]])],
   [
       if test "$HostOS" = "mingw32"
       then
   [
       if test "$HostOS" = "mingw32"
       then
@@ -2210,11 +2212,11 @@ AC_ARG_WITH(hs-cpp-flags,
 [
   $HS_CPP_CMD -x c /dev/null -dM -E > conftest.txt 2>&1
   if grep "__clang__" conftest.txt >/dev/null 2>&1; then
 [
   $HS_CPP_CMD -x c /dev/null -dM -E > conftest.txt 2>&1
   if grep "__clang__" conftest.txt >/dev/null 2>&1; then
-    HS_CPP_ARGS="-E -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs "
+    HS_CPP_ARGS="-E -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs"
   else
       $HS_CPP_CMD  -v > conftest.txt 2>&1
       if  grep "gcc" conftest.txt >/dev/null 2>&1; then
   else
       $HS_CPP_CMD  -v > conftest.txt 2>&1
       if  grep "gcc" conftest.txt >/dev/null 2>&1; then
-          HS_CPP_ARGS="-E -undef -traditional "
+          HS_CPP_ARGS="-E -undef -traditional"
         else
           $HS_CPP_CMD  --version > conftest.txt 2>&1
           if grep "cpphs" conftest.txt >/dev/null 2>&1; then
         else
           $HS_CPP_CMD  --version > conftest.txt 2>&1
           if grep "cpphs" conftest.txt >/dev/null 2>&1; then
index 200ec8f..07f5ec5 100644 (file)
@@ -269,7 +269,7 @@ compiler_CPP_OPTS += ${GhcCppOpts}
 define preprocessCompilerFiles
 # $0 = stage
 compiler/stage$1/build/primops.txt: compiler/prelude/primops.txt.pp compiler/stage$1/$$(PLATFORM_H)
 define preprocessCompilerFiles
 # $0 = stage
 compiler/stage$1/build/primops.txt: compiler/prelude/primops.txt.pp compiler/stage$1/$$(PLATFORM_H)
-       $$(CPP) $$(RAWCPP_FLAGS) -P $$(compiler_CPP_OPTS) -Icompiler/stage$1 -x c $$< | grep -v '^#pragma GCC' > $$@
+       $$(HS_CPP) -P $$(compiler_CPP_OPTS) -Icompiler/stage$1 -x c $$< | grep -v '^#pragma GCC' > $$@
 
 compiler/stage$1/build/primop-data-decl.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
        "$$(genprimopcode_INPLACE)" --data-decl          < $$< > $$@
 
 compiler/stage$1/build/primop-data-decl.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
        "$$(genprimopcode_INPLACE)" --data-decl          < $$< > $$@
index 16d1605..9740e15 100644 (file)
@@ -426,8 +426,13 @@ export CC
 MAYBE_OVERRIDE_STAGE0([gcc],[CC_STAGE0])
 MAYBE_OVERRIDE_STAGE0([ar],[AR_STAGE0])
 
 MAYBE_OVERRIDE_STAGE0([gcc],[CC_STAGE0])
 MAYBE_OVERRIDE_STAGE0([ar],[AR_STAGE0])
 
+dnl ** figure out how to invoke the C preprocessor (i.e. `gcc -E`)
+AC_PROG_CPP
+
 # --with-hs-cpp/--with-hs-cpp-flags
 FP_CPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs)
 # --with-hs-cpp/--with-hs-cpp-flags
 FP_CPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs)
+AC_SUBST([HaskellCPPCmd])
+AC_SUBST([HaskellCPPArgs])
 
 dnl ** Which ld to use?
 dnl --------------------------------------------------------------
 
 dnl ** Which ld to use?
 dnl --------------------------------------------------------------
@@ -596,9 +601,6 @@ FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAG
 
 FP_GCC_EXTRA_FLAGS
 
 
 FP_GCC_EXTRA_FLAGS
 
-dnl ** figure out how to invoke cpp directly (gcc -E is no good)
-AC_PROG_CPP
-
 AC_SUBST(CONF_CC_OPTS_STAGE0)
 AC_SUBST(CONF_CC_OPTS_STAGE1)
 AC_SUBST(CONF_CC_OPTS_STAGE2)
 AC_SUBST(CONF_CC_OPTS_STAGE0)
 AC_SUBST(CONF_CC_OPTS_STAGE1)
 AC_SUBST(CONF_CC_OPTS_STAGE2)
@@ -1031,14 +1033,14 @@ echo ["\
    Using $CompilerName       : $WhatGccIsCalled
       which is version       : $GccVersion
    Building a cross compiler : $CrossCompiling
    Using $CompilerName       : $WhatGccIsCalled
       which is version       : $GccVersion
    Building a cross compiler : $CrossCompiling
-   cpp       : $HaskellCPPCmd
-   cpp-flags : $HaskellCPPArgs
-   ld        : $LdCmd
-   Happy     : $HappyCmd ($HappyVersion)
-   Alex      : $AlexCmd ($AlexVersion)
-   Perl      : $PerlCmd
-   dblatex   : $DblatexCmd
-   xsltproc  : $XsltprocCmd
+   hs-cpp       : $HaskellCPPCmd
+   hs-cpp-flags : $HaskellCPPArgs
+   ld           : $LdCmd
+   Happy        : $HappyCmd ($HappyVersion)
+   Alex         : $AlexCmd ($AlexVersion)
+   Perl         : $PerlCmd
+   dblatex      : $DblatexCmd
+   xsltproc     : $XsltprocCmd
 
    Using LLVM tools
       llc   : $LlcCmd
 
    Using LLVM tools
       llc   : $LlcCmd
index 2ae0072..ab5c299 100644 (file)
@@ -65,6 +65,8 @@ export CC
 
 # --with-hs-cpp/--with-hs-cpp-flags
 FP_CPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs)
 
 # --with-hs-cpp/--with-hs-cpp-flags
 FP_CPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs)
+AC_SUBST([HaskellCPPCmd])
+AC_SUBST([HaskellCPPArgs])
 
 dnl ** Which ld to use?
 dnl --------------------------------------------------------------
 
 dnl ** Which ld to use?
 dnl --------------------------------------------------------------
index 40c66d9..dfe8c2b 100644 (file)
@@ -623,18 +623,11 @@ ArSupportsAtFile_STAGE3 = $(ArSupportsAtFile)
 
 CONTEXT_DIFF           = @ContextDiffCmd@
 CP                     = cp
 
 CONTEXT_DIFF           = @ContextDiffCmd@
 CP                     = cp
+
 # It's not easy to separate the CPP program from its flags, as
 # AC_PROG_CPP defines CPP as "/usr/bin/gcc -E"
 CPP                    = @CPP@ @CPPFLAGS@
 # It's not easy to separate the CPP program from its flags, as
 # AC_PROG_CPP defines CPP as "/usr/bin/gcc -E"
 CPP                    = @CPP@ @CPPFLAGS@
-#
-# RAWCPP_FLAGS are the flags to give to cpp (viz, gcc -E) to persuade it to
-# behave plausibly on Haskell sources.
-#
-# Clang in particular is a bit more annoying, so we suppress some warnings.
-RAWCPP_FLAGS            = -undef -traditional
-ifeq "$(CC_CLANG_BACKEND)" "1"
-RAWCPP_FLAGS           += -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs
-endif
+HS_CPP                 = @HaskellCPPCmd@ @HaskellCPPArgs@
 
 FIND                   = @FindCmd@
 
 
 FIND                   = @FindCmd@
 
index 10629aa..fe3a5e3 100644 (file)
@@ -16,7 +16,7 @@ $(call trace, manual-package-config($1))
 $(call profStart, manual-package-config($1))
 
 $1/dist/package.conf.inplace : $1/package.conf.in $$$$(ghc-pkg_INPLACE) | $$$$(dir $$$$@)/.
 $(call profStart, manual-package-config($1))
 
 $1/dist/package.conf.inplace : $1/package.conf.in $$$$(ghc-pkg_INPLACE) | $$$$(dir $$$$@)/.
-       $$(CPP) $$(RAWCPP_FLAGS) -P \
+       $$(HS_CPP) -P \
                -DTOP='"$$(TOP)"' \
                $$($1_PACKAGE_CPP_OPTS) \
                -x c $$(addprefix -I,$$(GHC_INCLUDE_DIRS)) $$< -o $$@.raw
                -DTOP='"$$(TOP)"' \
                $$($1_PACKAGE_CPP_OPTS) \
                -x c $$(addprefix -I,$$(GHC_INCLUDE_DIRS)) $$< -o $$@.raw
@@ -29,7 +29,7 @@ $1/dist/package.conf.inplace : $1/package.conf.in $$$$(ghc-pkg_INPLACE) | $$$$(d
 # "make install", so we declare it as phony
 .PHONY: $1/dist/package.conf.install
 $1/dist/package.conf.install: | $$$$(dir $$$$@)/.
 # "make install", so we declare it as phony
 .PHONY: $1/dist/package.conf.install
 $1/dist/package.conf.install: | $$$$(dir $$$$@)/.
-       $$(CPP) $$(RAWCPP_FLAGS) -P \
+       $$(HS_CPP) -P \
                -DINSTALLING \
                -DLIB_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))"' \
                -DINCLUDE_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))/include"' \
                -DINSTALLING \
                -DLIB_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))"' \
                -DINCLUDE_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))/include"' \