summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2014-12-01 08:37:09 +0100
committerHerbert Valerio Riedel <hvr@gnu.org>2014-12-01 08:40:13 +0100
commit0511c0ab09f705c3012b405781c9398a143b0e38 (patch)
treebc8f4dc47da37c285adafa5735b6c34f7f98548a
parent7ad384604652b87b68d32bdaff4ef7f94daf9d35 (diff)
downloadhaskell-0511c0ab09f705c3012b405781c9398a143b0e38.tar.gz
Revert "Remove RAWCPP_FLAGS"
This reverts commit 460eebec65811c6a7bbe11645df322dda868e80d. Thomas requested to revert the commit with the words: > Please revert this commit, it is horribly wrong. I'll have a proper look > later, but not supplying `-traditional` to the C preprocessor is the cause > of #9828. the reverted commit was related to #9094
-rw-r--r--compiler/ghc.mk4
-rw-r--r--mk/config.mk.in9
-rw-r--r--rules/manual-package-config.mk4
3 files changed, 13 insertions, 4 deletions
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index 640bf75a26..c1b168e8d6 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -269,10 +269,10 @@ compiler_CPP_OPTS += ${GhcCppOpts}
define preprocessCompilerFiles
# $0 = stage
compiler/stage$1/build/Parser.y: compiler/parser/Parser.y.pp
- $$(CPP) -P $$(compiler_CPP_OPTS) -x c $$< | grep -v '^#pragma GCC' > $$@
+ $$(CPP) $$(RAWCPP_FLAGS) -P $$(compiler_CPP_OPTS) -x c $$< | grep -v '^#pragma GCC' > $$@
compiler/stage$1/build/primops.txt: compiler/prelude/primops.txt.pp compiler/stage$1/$$(PLATFORM_H)
- $$(CPP) -P $$(compiler_CPP_OPTS) -Icompiler/stage$1 -x c $$< | grep -v '^#pragma GCC' > $$@
+ $$(CPP) $$(RAWCPP_FLAGS) -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/mk/config.mk.in b/mk/config.mk.in
index 4f22c56cc5..0f5820f620 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -626,6 +626,15 @@ 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
FIND = @FindCmd@
diff --git a/rules/manual-package-config.mk b/rules/manual-package-config.mk
index 56eea700ac..10629aaa2f 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) -P \
+ $$(CPP) $$(RAWCPP_FLAGS) -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) -P \
+ $$(CPP) $$(RAWCPP_FLAGS) -P \
-DINSTALLING \
-DLIB_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))"' \
-DINCLUDE_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))/include"' \