Drop `template-haskell`'s build-dep on `containers`

This is an attempt to address

  https://github.com/haskell/cabal/issues/1811

by replicating the less than 100 lines of code actually used from the
containers package into an internal non-exposed `template-haskell` module.

Moreover, `template-haskell` does not expose the `Map` type, so this change
should have no visible effect on the public API.

It may turn out that `Data.Map` is not necessary and that even a simple
list-based associative list (`Prelude.lookup`) may suffice. However, in
order to avoid any regressions, this commit takes the safe route and just
clones `Data.Map` for now.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
rts: Fix potential memory leak in ProfHeap.c

Discovered by Coverity. CID 43166.

Signed-off-by: Austin Seipp <austin@well-typed.com>
rts: Fix possible int overflow in resize_nursery

n_capabilities is declared as unsigned int (32bit), and so multiplication
is 32-bit before being stored in a 64bit integer (StgWord).

Instead, cast n_capabilities to StgWord before multiplying.

Discovered by Coverity. CID 43164.

Signed-off-by: Austin Seipp <austin@well-typed.com>
coverity: Suppress some time-of-check-time-of-use reports

CID 43178

Signed-off-by: Austin Seipp <austin@well-typed.com>
Check return value of sigaction

Issue discovered by Coverity scan, CID 43142.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix potential out-of-bound memory access

Issue discovered by Coverity scan, CID 43165.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Check correct variable for NULL

Issue discovered by Coverity scan, CID 43163. This should fix CID 43172 as a
side-effect as well.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix memleak in hp2ps

Issue discovered by Coverity scan, CID 43167.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Don't require mk/config.mk for all cleanup targets

`make clean` did already ignore a missing mk/config.mk,
but `make distclean` and `make maintainer-clean` didn't.
This commit rectifies this oversight.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Test Trac #9036
rm -rf ./docs/comm

The Commentary is now on the wiki and far more complete. This copy will
of course live on in the annals of history, but there's no reason to
keep it around still.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Do type-class defaulting even if there are insoluble constraints

The argument in Trac #9033 is very compelling: we should not report 20
errors, fix one, and have the other 19 disappear.  They were spurious
in the first place.

The fix was easy; do type-class defaulting uncondionally, rather than
only if there are no insoluble constraints.

See Note [When to do type-class defaulting] in TcSimplify.

Error messages generally improve, especially tc211 which actually
had an example of precisely this phenomenon.
Remove the definition of die, which is now provided by System.Exit
Update 32-bit perf numbers

Many of these have never been initialised, I think.  They
were simply guesses from the 64-bit version.
Start on 7.10.1 release notes

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix annotation reification for home package modules

The reifyAnnotation method of the Q monad correctly gathered annotations
from TCG and EPS.  Unfortunately it didn't look into the Home Package
Table.  This resulted in annotations not being found if they are in the
same package as the splice that is reifying and ghc --make is used for
compilation management.  Fix this by using the already existing
prepareAnnotations method from HscTypes.lhs that correctly searches
in HPT and EPS both.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Add a comprehensive test for using Annotations from TH

The provided tests test both annotation generation and reification
from Template Haskell.  Both --make and compilation via separate
units (ghc -c) are tested.

Signed-off-by: Austin Seipp <austin@well-typed.com>
tcrun045 should fail (implicit parameter as superclass)
Print for-alls more often (Trac #9018)

We now display the foralls of a type if any of the type variables
is polykinded.  This put kind polymorphism "in your face" a bit more
often, but eliminates a lot of head scratching.

The user manual reflects the new behaviour.
annth_make, annth_compunits: Only run these tests if have_dynamic()