[GHC] #8683: add "cpp program" and "cpp program options" to settings file
GHC
ghc-devs at haskell.org
Tue Jan 21 05:49:48 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):
Ok, i've started digging into this, with the idea of having the settings
file have the "Haskell CPP Command" and "Haskell CPP Flags" fields.
the idea being that the settings file would determine the CPP and flags
unless pgmp and optp are set.
soo, some of the CPP stuff is welded into certain config and other steps
currently
eg in mk/config.mk.in
{{{
# 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
}}}
which then in
compiler/ghc.mk as part of the Config module has the line
{{{
@echo 'cRAWCPP_FLAGS :: String'
>> $@
@echo 'cRAWCPP_FLAGS = "$(RAWCPP_FLAGS)"'
>> $@
}}}
and then in
compiler/main/SysTools.lhs we have
{{{
let cpp_prog = gcc_prog
cpp_args = Option "-E"
: map Option (words cRAWCPP_FLAGS)
++ gcc_args
}}}
Interestingly, the -pgmP flag corresponds to
{{{
sPgm_P = (cpp_prog, cpp_args),
}}}
and the optP flag is by default empty!
{{{
sOpt_P = []
}}}
so optP is meant for adding *additional* flags to cpp, but shouldn't be
part of the default config,
AND pgmP should be used to specify the full "cpp program and the prefix of
args?"
also currently it looks like cpp_args also passes in applicable gcc_args.
(are there some examples of when thats used?!)
theres probably some other things i'm overlooking, but thats the obvious
stuff.
I think I now understand enough to be able to cook up a strawman patch for
this stuff, including the config time settings.in stuff, the piece that
currently goes into the magic Config.hs hack that now should move into
settings, and some of the dynflags / settings stuff.
I'll try to hack it out tomorrow late afternoon. (though if someone beats
me to it, they're welcome, i've never messed with autoconf before, though
I think i can cargo cult write the correct changes there,)
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8683#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list