CPP usage in GHC.
karel.gardas at centrum.cz
Mon Aug 11 12:32:57 UTC 2014
On 08/11/14 01:27 AM, Carter Schonwald wrote:
> I could be wrong, but I think assembler-with-cpp came up only as part of
> certain clang work arounds,
> it should suffice to use any GCC like traditional mode CPP (like the
> CPPHS tool).
This is interesting, but it looks like -x assembler-with-cpp is
hard-coded into DriverPipeline.hs in doCpp function and either
assembler-with-cpp or assembler is used in runPhase as and this is
completely independent from target cpp even when configure with
> note that the configure script tries to detect what the CPP program you
> specify using --with-hs-cpp IS, and it only has logic for modern
> GCC/Clang/CPPHS, so you should specify a suitable set of flags if you're
> picking something different (theres a flag like --with-hs-cpp-flags you
> can set explicitly)
Hmm, seeing CPPHS give me an idea about either
- prioritizing CPPHS usage, when configure detects CPPHS availability it
is then set as with --with-hs-cpp option and used as a preprocessor
- integrate CPPHS directly into GHC as it seems it provides some library
Sidenote: builders are testing ghc binary dist installed into the
"install dir" directory and it looks like this process of installation
completely forgot about original --with-hs-cpp option. And seeing
Solaris builder test_bindist output it looks like not only
--with-hs-cpp option is forgotten but every option of original configure
run is forgotten...
> On Sun, Aug 10, 2014 at 5:06 PM, Karel Gardas <karel.gardas at centrum.cz
> <mailto:karel.gardas at centrum.cz>> wrote:
> in my attempt to lower number of failing tests on Solaris I've found
> several tests which fail on just difference in file name report. My
> ghc reports warning/error in /tmp/ghc<something>/<some different
> thing> while expected is clear T<something>.hs.
> and search for T7145b as an example of this behavior.
> The reason why this happen is that Solaris GNU C 4.x does not emit
> line markers in preprocessed file when it's preprocessed with -x
> assembler-with-cpp. The reason behind this is documented in this
> thread on GCC mailing list. Simply speaking Sun's assembler in
> the past chokes on some linemarkers generated. This was apparently
> case of as on older Solaris then 10 version and perhaps this will be
> fixed in future major GCC release as Solaris 9 is not supported
> anymore. Anyway, we still do have a case with GNU C compilers
> provided by Solaris 10 and Solaris 11. FYI: Solaris' 10 GNU C 3.4.x
> is OK, Solaris 11's GNU C 4.5.2 is broken and with this all more
> modern 4.x releases so probably also all 4.x release provided by
> Solaris 11.1/11.2.
> So far I've solved the issue of those failing tests by passing
> --with-hs-cpp=/usr/sfw/bin/gcc -- so configured this way GHC will
> use old not-buggy GNU C 3.4.x on my Solaris 11 builder as CPP and
> otherwise it'll use /usr/bin/gcc (GNU C 4.5.2) and everything will
> pass fine hopefully.
> Anyway, the thread also contains a question which also rings in
> my head and that is: why we use -x assembler-with-cpp at all? Isn't
> simple -E enough. Or isn't simple usage of system provided CPP
> enough /usr/lib/cpp on Solaris)? Or what will happen if we for
> example change -x assembler-with-cpp to -x c or -x c-header or
> something like that? Please note that the testcase is OK with -x
> c/c-header even using this "buggy" GNU C 4.5.2 since the
> compiler/cpp is really buggy just for the case of -x assembler-with-cpp.
> : https://gcc.gnu.org/ml/gcc/__2014-08/msg00114.html
> ghc-devs mailing list
> ghc-devs at haskell.org <mailto:ghc-devs at haskell.org>
More information about the ghc-devs