Fix #5682. Now, '(:) parses.

(cherry picked from commit 473f12a3be27a00b035f1fdc7050a0ff31bf12ff)
Fix #8773.

To make a role annotation on a class asserting a role other than
nominal, you now need -XIncoherentInstances. See the ticket for
more information as to why this is a good idea.

(cherry picked from commit 138297585f88351352e0ed878b25f26e1d6edfef)
Fix --enable-unregistered by passing NOSMP to .hc compiler (#8748)

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit 68f0a6a6cd5bf3374fbc4a4fb09df4cbda97b61c)
Fix --enable-unregistered by declaring missing RTS functions (#8748)

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit 4bb50ed0c6246e2d45e22e79f5658db1fa8a58b3)
rts/Capability.c: fix crash in -threaded mode on UNREG build

UNREG mode has quite nasty invariant to maintain:
    capabilities[0] == &MainCapability

and it's a non-heap memory, while other
capabilities are dynamically allocated.

Issue #8748

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit ebace6969f0ec85b1caa0fea265a5f9990a23b2e)
includes/Stg.h: add declarations for hs_popcnt and frinds

This fixes most of implicit function declarations emitted
C codegen in UNREG mode. Found by adding the following to
mk/build.mk:

    SRC_CC_OPTS += -Werror=implicit-function-declaration
    SRC_HC_OPTS += -optc-Werror=implicit-function-declaration

Issue #8748

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit 858a807d5522145e8ede9148a15bb65a0d851c00)
rts/package.conf.in: fix UNREG on --with-system-libffi when include-dir is passed explicitely

Issue #8748

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit 2d0fa9aee78e5bfffb9a4580954825025a651be5)
mk/config.mk.in: lower -O2 optimization down to -O1 on UNREG

Disable -O2 optimization. Otherwise amount of generated C code makes
things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.lhs')

And sometimes not compile at all (powerpc64 overflows something
on 'compiler/hsSyn/HsExpr.lhs').

Issue #8748

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit 2d5372cfdc2236a77ec49df249f3379b93224e06)
Fix installation of hpc (#8735)

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit a365eabd465a1700f479f78ad99fc1a31915e639)
Fix check for TLS support in Storage.c

This should have manifested earlier, but for some reason it only seemed
to trigger on Mavericks.

Signed-off-by: Austin Seipp <austin@well-typed.com>

(cherry picked from commit c83eabf37b884398d911609e46707df771c3fde9)
Fix #8745 - GND is now -XSafe compatible.

As discussed in the ticket, after the landing of #8773, GND is now
-XSafe compatible.

This fixes the test fallout as well. In particular SafeLang07 was
removed following in the steps of SafeLang06, since it no longer failed
from GND, but failed due to roles and was thus invalid.

The other tests were tweaked to use TemplateHaskell instead of GND in
order to trigger safety warnings.

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit a8a01e742434df11b830ab99af12d9045dfcbc4b)
Fix #8770

As usual, Mac OS X is extremely annoying (or the software is, anyway),
because not only does it load dynamic libraries with the .dylib
extension, but also the .so extension. For whatever reason. At least
it's easy to fix.

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit dc080915597065087b3821b3ded0a621a7e2fae7)