ghc -cpp on Mac OS X

Ashley Yakeley ashley at semantic.org
Tue Nov 11 15:18:57 EST 2003


The cpp compiler on Mac OS X has an annoying tendency to emit a pragma:

$ echo hello | cpp -P
#pragma GCC set_debug_pwd "/Users/ashley"
hello

You can turn this off by telling it that the input file is not C:

$ echo hello | cpp -P -xassembler-with-cpp
hello

Unfortunately, when GHC uses cpp, it passes "-x c" to gcc, and then 
chokes on the #pragma line. I've tried working around it with "-optP-x 
-optPassembler-with-cpp", but GHC adds its "-x c" option after mine, 
overriding it.

Probably the best thing to do would be for GHC to pass "-x 
assembler-with-cpp" instead of "-x c", on all platforms, on the 
assumption that the C preprocessor might be less likely to muck about if 
it knows it's not C.

$ cpp --version
cpp (GCC) 3.3 20030304 (Apple Computer, Inc. build 1493)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is 
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.

-- 
Ashley Yakeley, Seattle WA



More information about the Glasgow-haskell-bugs mailing list