From 555eef1d0fb5a7fd07971c1201b3c520f01125d4 Mon Sep 17 00:00:00 2001 From: Thomas Miedema Date: Tue, 17 Feb 2015 08:36:56 -0600 Subject: Remove RAWCPP_FLAGS (Task #9094) Reviewers: carter, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D648 GHC Trac Issues: #9094 --- aclocal.m4 | 10 ++++++---- compiler/ghc.mk | 2 +- configure.ac | 24 +++++++++++++----------- distrib/configure.ac.in | 2 ++ mk/config.mk.in | 11 ++--------- rules/manual-package-config.mk | 4 ++-- 6 files changed, 26 insertions(+), 27 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 6933e6f647..cb4aa83ec3 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2146,7 +2146,7 @@ dnl ** what cpp to use? 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 @@ -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 @@ -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], - [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 @@ -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_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 - 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 diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 200ec8fdd6..07f5ec5a92 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -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) - $$(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 < $$< > $$@ diff --git a/configure.ac b/configure.ac index 16d160518e..9740e1524b 100644 --- a/configure.ac +++ b/configure.ac @@ -426,8 +426,13 @@ export CC 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) +AC_SUBST([HaskellCPPCmd]) +AC_SUBST([HaskellCPPArgs]) 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 -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) @@ -1031,14 +1033,14 @@ echo ["\ 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 diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 2ae007240a..ab5c29933a 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -65,6 +65,8 @@ export CC # --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 -------------------------------------------------------------- diff --git a/mk/config.mk.in b/mk/config.mk.in index 40c66d97c0..dfe8c2b445 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -623,18 +623,11 @@ ArSupportsAtFile_STAGE3 = $(ArSupportsAtFile) 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@ -# -# 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@ diff --git a/rules/manual-package-config.mk b/rules/manual-package-config.mk index 10629aaa2f..fe3a5e3b08 100644 --- a/rules/manual-package-config.mk +++ b/rules/manual-package-config.mk @@ -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 $$$$@)/. - $$(CPP) $$(RAWCPP_FLAGS) -P \ + $$(HS_CPP) -P \ -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 $$$$@)/. - $$(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"' \ -- cgit v1.2.1