[GHC] #8683: add "cpp program" and "cpp program options" to settings file
GHC
ghc-devs at haskell.org
Wed Jan 22 02:52:37 UTC 2014
#8683: add "cpp program" and "cpp program options" to settings file
-------------------------------------+------------------------------------
Reporter: carter | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: 7.8.1
Component: Compiler | Version: 7.7
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets: #8439
-------------------------------------+------------------------------------
Comment (by carter):
heres my current notes, which sort of restate my prior comment
NOTES
from config.mk.in
{{{
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
}}}
RAWCPP is then used in compiler/ghc.mk to define
{{{
@echo 'cRAWCPP_FLAGS :: String' >>
$@
@echo 'cRAWCPP_FLAGS = "$(RAWCPP_FLAGS)"' >>
$@
}}}
which is then used in compiler/main/SysTools.lhs to do
{{{
234 gcc_prog <- getSetting "C compiler command"
235: gcc_args_str <- getSetting "C compiler flags"
....
let cpp_prog = gcc_prog
289 cpp_args = Option "-E"
290 : map Option (words cRAWCPP_FLAGS)
291: ++ gcc_args
}}}
and then intiizes (still in SysTools)
{{{
sPgm_P = (cpp_prog, cpp_args),
}}}
then in compiler/main/DynFlags.hs
{{{
1807: setPgmP f = let (pgm:args) = words f in alterSettings (\s -> s
{ sPgm_P = (pgm, map Option args)})
}}}
and then still in compiler/main/DynFlags.hs
{{{
2144: , Flag "pgmP" (hasArg setPgmP)
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8683#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list