Use assembler-with-cpp mode when running CPP.

This is needed because Clang is very strict about C99 macro rules, which
dictate that '#' in a body must have a token immediately following it for
string-ification. In practice we break this all the time, because we do
very weird stuff like:

    #define FOOBAR(xyz) \
    {-# SOME PRAGMA #-} \
    baz :: (xyz) \
    baz = ...

where the leading '#' in in the macro body clearly breaks this rule.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
(cherry picked from commit 7b0695a887c13a431f898d89938e127faa3f4585)
Signed-off-by: Darin Morrison <darinmorrison+git@gmail.com>
Suppress some more warnings from Clang.

It likes to think lambdas a la:

    foo $ \u -> ...

represent a kind of unicode extended literal.

It also gets confused when you have things like:

    ... thing ... {- comment ... (???) -}

where the (???) is mistaken as a trigraph.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
(cherry picked from commit 232737a0260a04c6c274a4a619589aa078145416)
Signed-off-by: Darin Morrison <darinmorrison+git@gmail.com>
Fix many ASSERT uses under Clang.

Clang doesn't like whitespace between macro and arguments.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
(cherry picked from commit d8ee2b06f3a47ed08239e4f52cec8aa8e49b6ef6)
Signed-off-by: Darin Morrison <darinmorrison+git@gmail.com>
Fix rts/packages.conf.in ld-options for clang.

Technically, '-u' is an ld option, not a compiler option,
and clang considers this argument unused. Hence, we must
explicitly forward this to the linker.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
(cherry picked from commit 991f285e681e8541632502d05d8a46de2d44b7bd)
Signed-off-by: Darin Morrison <darinmorrison+git@gmail.com>
Fix typo in header guard.

Spotted by Clang.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
(cherry picked from commit e140837575e4142b476489d3e50eb62b063e07f4)
Signed-off-by: Darin Morrison <darinmorrison+git@gmail.com>
Initialize ptr to NULL to silence Clang warning.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
(cherry picked from commit 88e97d9a418e8b830ba1d3259aef351b7fb53e6d)
Signed-off-by: Darin Morrison <darinmorrison+git@gmail.com>
Don't use -finline-limit with Clang.

It's unsupported.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
(cherry picked from commit eeeec4f2c34d7bc7ca2882550a181bf80368d32d)
Signed-off-by: Darin Morrison <darinmorrison+git@gmail.com>
Ensure gc_thread->wakeup is of type StgWord8.

rtsBool is defined to only have two inhabitants, which are true (1) and
false (0)

But the wakeup flag is set to 4 possible values, outside the range of
rtsBool. This leads Clang to warn about tautological comparisons.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
(cherry picked from commit fe6db466ec0ae56d33d0fdecc4694d63fed61fa8)
Signed-off-by: Darin Morrison <darinmorrison+git@gmail.com>
Make sure -fcmm-sink is passed to Parser properly

Parser.hs needs to be compiled with -fcmm-sink on x86 platforms, so the
register allocator doesn't run out of stack slots. Previously, we had to
do some CPP hacks in order to emit an #ifdef into the file - this is
because we preprocess it once up front, and run the preprocessor again
when we compile it.

There's two cases: the boostrap compiler is > 7.8, and the stage1 parser
needs the flag, or the stage1 compiler is compiling the stage2
Parser.hs, and needs the flag..

The previous approach was super fragile with Clang. The more principled
fix is to instead do this through the build system.

This fixes #8182.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
(cherry picked from commit 9e133b9dccec0553c6ec302d6ca0d3bc5eea06c4)
Signed-off-by: Darin Morrison <darinmorrison+git@gmail.com>
Fix mkdirhier.sh on OS X 10.9 (#8139)

Mac OS X 10.9 mkdir is apparently stricter than the Mac OS X 10.8
mkdir about which paths are considered valid arguments. For example,
in a typical build on Mac OS X 10.9, the first of the following
invocations of mkdirhier.sh will succeed but the second will fail:

"inplace/bin/mkdirhier"   utils/ghc-cabal/dist/build/tmp//.  # WORKS
"inplace/bin/mkdirhier"   bootstrapping/.                    # FAILS

Simply prefixing the path arguments with "./" causes both to succeed:

"inplace/bin/mkdirhier" ./utils/ghc-cabal/dist/build/tmp//.  # WORKS
"inplace/bin/mkdirhier" ./bootstrapping/.                    # WORKS

Testing indicates failure on paths satisfying all of these criteria:

- path is suffixed with "/."
- path is only 1 level deep (e.g., "foo/."; _not_ "foo/bar/.")
- path is _not_ prefixed with "./"

This workaround prefixes "./" to the path argument passed to mkdir.
Fix building RtsProbes.d on Mac OS X 10.9 (#8139)