ghc.git
3 years agoLibdwPool: Use poolTryTake
Ben Gamari [Thu, 26 Nov 2015 11:02:47 +0000 (12:02 +0100)] 
LibdwPool: Use poolTryTake

3 years agorts/Pool: Add poolTryTake
Ben Gamari [Thu, 26 Nov 2015 11:02:33 +0000 (12:02 +0100)] 
rts/Pool: Add poolTryTake

3 years agoNote #11108 in the bugs section of users guide
Ben Gamari [Wed, 25 Nov 2015 23:32:21 +0000 (00:32 +0100)] 
Note #11108 in the bugs section of users guide

3 years agoUser documentation for DuplicateRecordFields
Adam Gundry [Wed, 25 Nov 2015 23:28:32 +0000 (00:28 +0100)] 
User documentation for DuplicateRecordFields

This is a first draft of the user manual documentation for
DuplicateRecordFields. Feedback welcome. I've intentionally made this a
minimal change, but I wonder if it might make sense to pull out all the
subsections on record system extensions ("Traditional record syntax",
and "Record field disambiguation" through to "Record wildcards") into a
new section? That is, is it worth breaking down the rather monolithic
"Syntactic extensions" section?

Test Plan: n/a

Reviewers: simonpj, bgamari, austin

Reviewed By: bgamari, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1522

3 years agoUser's Guide: Add links to MFP wiki page
Herbert Valerio Riedel [Wed, 25 Nov 2015 23:26:23 +0000 (00:26 +0100)] 
User's Guide: Add links to MFP wiki page

Test Plan: IIAM

Reviewers: austin, bgamari, quchen

Reviewed By: bgamari, quchen

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1529

GHC Trac Issues: #10751

3 years agoNote STM's vulnerability to non-allocating loops
Ben Gamari [Wed, 25 Nov 2015 23:24:42 +0000 (00:24 +0100)] 
Note STM's vulnerability to non-allocating loops

Test Plan: Read it

Reviewers: austin, fryguybob

Reviewed By: austin

Subscribers: thomie, fryguybob

Differential Revision: https://phabricator.haskell.org/D1523

GHC Trac Issues: #10639, #367

3 years agoAdd a simplifier trace for eta-expansion
Simon Peyton Jones [Wed, 25 Nov 2015 16:27:45 +0000 (16:27 +0000)] 
Add a simplifier trace for eta-expansion

3 years agoComments only
Simon Peyton Jones [Wed, 25 Nov 2015 16:26:58 +0000 (16:26 +0000)] 
Comments only

3 years agoRefactor default methods (Trac #11105)
Simon Peyton Jones [Wed, 25 Nov 2015 16:26:23 +0000 (16:26 +0000)] 
Refactor default methods (Trac #11105)

This patch does some signficant refactoring to the treatment
of default methods in class declarations, and more generally
to the type checking of type/class decls.

Highlights:

* When the class has a generic-default method, such as
     class C a where
       op :: a -> a -> Bool
       default op :: Ord a => a -> a -> a
  the ClassOpItem records the type of the generic-default,
  in this case the type (Ord a => a -> a -> a)

* I killed off Class.DefMeth in favour of the very-similar
  BasicTypes.DefMethSpec.  However it turned out to be better
  to use a Maybe, thus
      Maybe (DefMethSpec Type)
  with Nothing meaning "no default method".

* In TcTyClsDecls.tcTyClGroup, we used to accumulate a [TyThing],
  but I found a way to make it much simpler, accumulating only
  a [TyCon].  Much less wrapping and unwrapping.

* On the way I also fixed Trac #10896 in a better way. Instead
  of killing off all ambiguity checks whenever there are any type
  errors (the fix in commit 8e8b9ed), I instead recover in
  TcTyClsDecls.checkValidTyCl.

There was a lot of associated simplification all round

3 years agoupdate link to MonadFail proposal
Herbert Valerio Riedel [Wed, 25 Nov 2015 12:22:47 +0000 (13:22 +0100)] 
update link to MonadFail proposal

[skip ci]

3 years agoDynFlags: Drop stale comment
Ben Gamari [Tue, 24 Nov 2015 15:55:48 +0000 (16:55 +0100)] 
DynFlags: Drop stale comment

3 years agoSimplify the MonadFail code
Simon Peyton Jones [Tue, 24 Nov 2015 15:07:08 +0000 (15:07 +0000)] 
Simplify the MonadFail code

Simplify and tidy up the MonadFail code.
See TcMatches.tcMonadFailOp

Less, code; and more robust.

This incidentally fixes a bug; see the change
to MonadFailErrors.stderr

3 years agoComments only
Simon Peyton Jones [Tue, 24 Nov 2015 13:25:51 +0000 (13:25 +0000)] 
Comments only

3 years agoDynFlags: Update comments to reflect new users guide
Ben Gamari [Tue, 24 Nov 2015 11:41:44 +0000 (12:41 +0100)] 
DynFlags: Update comments to reflect new users guide

3 years agoRewrite checkUniques and incorporate into validate
Ben Gamari [Tue, 24 Nov 2015 11:45:27 +0000 (12:45 +0100)] 
Rewrite checkUniques and incorporate into validate

This should catch duplicate uniques in the future before Bad Things
happen.

Test Plan: Introduce a duplicate unique and validate

Reviewers: austin, hvr, thomie

Reviewed By: hvr, thomie

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1521

3 years agoAdd -Wcompat warning flag group
David Luposchainsky [Tue, 24 Nov 2015 11:45:00 +0000 (12:45 +0100)] 
Add -Wcompat warning flag group

Reviewers: hvr, austin, thomie, bgamari

Reviewed By: hvr, austin, thomie, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1495

GHC Trac Issues: #11000

3 years agoRearrange error msgs and add section markers (Trac #11014).
Evan Laforge [Tue, 24 Nov 2015 11:43:18 +0000 (12:43 +0100)] 
Rearrange error msgs and add section markers (Trac #11014).

This puts the "Relevant bindings" section at the end.

It uses a TcErrors.Report Monoid to divide messages by importance and
then mappends them together.  This is not the most efficient way since
there are various intermediate Reports and list appends, but it probably
doesn't matter since error messages shouldn't get that large, and are
usually prepended.  In practice, everything is `important` except
`relevantBindings`, which is `supplementary`.

ErrMsg's errMsgShortDoc and errMsgExtraInfo were extracted into ErrDoc,
which has important, context, and suppelementary fields.  Each of those
three sections is marked with a bullet character, '•' on unicode
terminals and '*' on ascii terminals.  Since this breaks tons of tests,
I also modified testlib.normalise_errmsg to strip out '•'s.

--- Additional notes:

To avoid prepending * to an empty doc, I needed to filter empty docs.
This seemed less error-prone than trying to modify everyone who produces
SDoc to instead produce Maybe SDoc.  So I added `Outputable.isEmpty`.
Unfortunately it needs a DynFlags, which is kind of bogus, but otherwise
I think I'd need another Empty case for SDoc, and then it couldn't be a
newtype any more.

ErrMsg's errMsgShortString is only used by the Show instance, which is
in turn only used by Show HscTypes.SourceError, which is in turn only
needed for the Exception instance.  So it's probably possible to get rid
of errMsgShortString, but that would a be an unrelated cleanup.

Fixes #11014.

Test Plan: see above

Reviewers: austin, simonpj, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: simonpj, nomeata, thomie

Differential Revision: https://phabricator.haskell.org/D1427

GHC Trac Issues: #11014

3 years agoImplement new `-fwarn-noncanonical-monad-instances`
Herbert Valerio Riedel [Tue, 24 Nov 2015 11:46:33 +0000 (12:46 +0100)] 
Implement new `-fwarn-noncanonical-monad-instances`

Warn about incoherent/non-canonical 'Applicative'/'Monad' instance
declarations. Specifically the following invariants are checked:

In 'Monad' instances declarations warn if the any of the following
conditions does not hold:

 * If `return` is overridden it must be canonical (i.e. `return = pure`).
 * If `(>>)` is overridden it must be canonical (i.e. `(>>) = (*>)`).

In 'Applicative' instance declarations:

 * Warn if 'pure' is defined backwards (i.e. `pure = return`).
 * Warn if '(*>)' is defined backwards (i.e. `(*>) = (>>)`).

NB, this warning flag is not enabled via `-Wall` nor `-Wcompat`.

This addresses #11128

Reviewers: quchen, austin, bgamari

Reviewed By: bgamari

Differential Revision: https://phabricator.haskell.org/D1516

3 years agoAdd `PrelNames.thenAName` for `Applicative(*>)`
Herbert Valerio Riedel [Mon, 23 Nov 2015 21:25:38 +0000 (22:25 +0100)] 
Add `PrelNames.thenAName` for `Applicative(*>)`

This is needed to allow subsequent patches to refer to `*>`.

While at it, this commit also groups together the `Applicative` definitions
to reduce confusion.

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D1513

3 years agorts: Always export Libdw* symbols
Ben Gamari [Mon, 23 Nov 2015 22:12:41 +0000 (23:12 +0100)] 
rts: Always export Libdw* symbols

Otherwise we'll get link time failures as `base` always builds
`GHC.ExecutionStack`.

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1519

3 years agoAdd the rest of the notes for Located RdrName
Alan Zimmerman [Mon, 23 Nov 2015 17:33:34 +0000 (19:33 +0200)] 
Add the rest of the notes for Located RdrName

3 years agoAdd tests/monadfail/Makefile
Simon Peyton Jones [Mon, 23 Nov 2015 17:20:51 +0000 (17:20 +0000)] 
Add tests/monadfail/Makefile

3 years agoImprove constraint-used-as-type error msg
Simon Peyton Jones [Mon, 23 Nov 2015 08:35:44 +0000 (08:35 +0000)] 
Improve constraint-used-as-type error msg

This responds to Trac #11112 by improving the error message
when the kind checker discovers something of kind Constraint
used when a type is expected

3 years agoOutput source notes in extended DWARF DIEs
Ben Gamari [Fri, 23 Oct 2015 08:52:12 +0000 (10:52 +0200)] 
Output source notes in extended DWARF DIEs

In order to accomplish this we need to ensure that emit DIEs for all
DebugBlocks, even those that have been optimized out, lest we end up
with undefined symbols of parents at link time.

Differential Revision: https://phabricator.haskell.org/D1279

3 years agoDwarf: Ensure tick parentage is preserved
Ben Gamari [Fri, 30 Oct 2015 19:59:45 +0000 (20:59 +0100)] 
Dwarf: Ensure tick parentage is preserved

Differential Revision: https://phabricator.haskell.org/D1387

3 years agoSupport multiple debug output levels
Ben Gamari [Fri, 25 Sep 2015 16:00:19 +0000 (18:00 +0200)] 
Support multiple debug output levels

We now only strip block information from DebugBlocks when compiling with
`-g1`, intended to be used when only minimal debug information is
desired. `-g2` is assumed when `-g` is passed without any integer
argument.

Differential Revision: https://phabricator.haskell.org/D1281

3 years agobase: Add Haskell interface to ExecutionStack
Ben Gamari [Sun, 23 Aug 2015 09:48:51 +0000 (11:48 +0200)] 
base: Add Haskell interface to ExecutionStack

Differential Revision: https://phabricator.haskell.org/D1198#40948

3 years agorts: Add LibdwPool, a pool for libdw sessions
Ben Gamari [Thu, 22 Oct 2015 20:17:11 +0000 (22:17 +0200)] 
rts: Add LibdwPool, a pool for libdw sessions

Differential Revision: https://phabricator.haskell.org/D1198#40948

3 years agorts: Add simple resource pool
Ben Gamari [Thu, 22 Oct 2015 20:16:46 +0000 (22:16 +0200)] 
rts: Add simple resource pool

3 years agorts: Expose more libdw symbols
Ben Gamari [Fri, 23 Oct 2015 07:15:20 +0000 (09:15 +0200)] 
rts: Expose more libdw symbols

3 years agoLibdw: Fix initial register collection on i386
Ben Gamari [Mon, 23 Nov 2015 11:45:47 +0000 (12:45 +0100)] 
Libdw: Fix initial register collection on i386

RIP-relative addressing isn't available on i386.

3 years agoLibdw: Fix build on 32-bit platforms
Ben Gamari [Mon, 23 Nov 2015 11:37:17 +0000 (12:37 +0100)] 
Libdw: Fix build on 32-bit platforms

The casting here is a bit tricky since Dwarf_Addr is always 64-bits.
This means we first need to narrow to uintptr_t before casting to/from a
pointer for compatibility on 32-bit architectures.

3 years agoAdd a note explaining why every RdrName is Located
Alan Zimmerman [Mon, 23 Nov 2015 13:37:25 +0000 (15:37 +0200)] 
Add a note explaining why every RdrName is Located

3 years agoRip out Papi configure check
Ben Gamari [Mon, 23 Nov 2015 12:44:13 +0000 (13:44 +0100)] 
Rip out Papi configure check

3 years agobuild.mk.sample: Document meaning of WERROR
Ben Gamari [Mon, 23 Nov 2015 10:35:34 +0000 (11:35 +0100)] 
build.mk.sample: Document meaning of WERROR

31bcf9b62ceaed98bdd3b7605e68d315bcff0c8a changed the behavior of WERROR
such that it would only apply to the stage 2 build. The reason for this
was to avoid silly redundant imports and such breaking validation on
different bootstrap compiler versions.

Document the fact that WERROR now only applies to the stage 2 build.

3 years agoMake abstractVars deterministic in SetLevel
Bartosz Nitka [Sun, 22 Nov 2015 22:42:30 +0000 (23:42 +0100)] 
Make abstractVars deterministic in SetLevel

This fixes a non-determinism bug where depending on the order
of uniques allocated, the type variables would be in a different order
when abstracted for the purpose of lifting out an expression.

Test Plan:
I've added a new testcase that reproduces the problem
./validate

Reviewers: simonmar, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: nomeata, thomie

Differential Revision: https://phabricator.haskell.org/D1504

GHC Trac Issues: #4012

3 years agoApiAnnotations: Make all RdrName occurences Located
Alan Zimmerman [Sun, 22 Nov 2015 22:41:57 +0000 (23:41 +0100)] 
ApiAnnotations: Make all RdrName occurences Located

At the moment the API Annotations can only be used on the ParsedSource,
as there are changes made to the RenamedSource that prevent it from
being used to round trip source code.

It is possible to build a map from every Located Name in the
RenamedSource from its location to the Name, which can then be used when
resolved names are required when changing the ParsedSource.

However, there are instances where the identifier is not located,
specifically

  (GHC.VarPat name)
  (GHC.HsVar name)
  (GHC.UserTyVar name)
  (GHC.HsTyVar name)

Replace each of the name types above with (Located name)

Updates the haddock submodule.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari

Reviewed By: bgamari

Subscribers: goldfire, thomie, mpickering

Differential Revision: https://phabricator.haskell.org/D1512

GHC Trac Issues: #11019

3 years agoNew expected test output for 32 bit platforms
Erik de Castro Lopo [Sun, 22 Nov 2015 22:32:33 +0000 (23:32 +0100)] 
New expected test output for 32 bit platforms

Test Plan: Test on Arm and PowerPc.

Reviewers: bgamari, thomie, austin

Differential Revision: https://phabricator.haskell.org/D1510

GHC Trac Issues: #11060

3 years agoAdd comment to Parser.y re extra API Annotation
Alan Zimmerman [Sun, 22 Nov 2015 19:18:24 +0000 (21:18 +0200)] 
Add comment to Parser.y re extra API Annotation

Document extra AnnRarrow annotation on a HsFunTy

3 years agoFollow-up fix to 3e2a4eefbed7002437c3f (re #11109)
Herbert Valerio Riedel [Sun, 22 Nov 2015 08:38:38 +0000 (09:38 +0100)] 
Follow-up fix to 3e2a4eefbed7002437c3f (re #11109)

Using `:` as sed-`s`-expr separator is not a good idea on windows, as
this can result in an expression like

   's:@INSTALL@:$(subst ../install-sh,E:/msys64/home/foo/ghc/install-sh,@INSTALL@):g'

(note the `E:/` drive component)

Using `|` instead of `:` has less risk of collision with the substitution expression

3 years agoRemove accidentally added T10359 blob
Herbert Valerio Riedel [Sun, 22 Nov 2015 08:09:06 +0000 (09:09 +0100)] 
Remove accidentally added T10359 blob

This sneaked in via 2325bd4e0fad0e5872556c5a78d1a6a1873e7201 / D1468 / #4012

This is frustrating... we've added a useless 2.4MiB binary blob to our
Git history which wastes *everyones* bandwidth for eternity
(unless we truncate or rewrite history).

We should add lint-checks and/or a pre-receive commit hook test to prevent
this in future.

3 years agoFunction definition in GHCi
Roman Shatsov [Sat, 21 Nov 2015 14:58:34 +0000 (15:58 +0100)] 
Function definition in GHCi

This patch allows define and re-define functions in ghci. `let` is not
required anymore (but can be used).

Idea: If ghci input string can be parsed as statement then run it as
statement else run it as declaration.

Reviewers: mpickering, bgamari, austin

Reviewed By: mpickering, bgamari, austin

Subscribers: hvr, mpickering, dterei, thomie

Differential Revision: https://phabricator.haskell.org/D1299

GHC Trac Issues: #7253

3 years agoCreate a deterministic version of tyVarsOfType
Bartosz Nitka [Sat, 21 Nov 2015 14:57:09 +0000 (15:57 +0100)] 
Create a deterministic version of tyVarsOfType

I've run into situations where I need deterministic `tyVarsOfType` and
this implementation achieves that and also brings an algorithmic
improvement.  Union of two `VarSet`s takes linear time the size of the
sets and in the worst case we can have `n` unions of sets of sizes
`(n-1, 1), (n-2, 1)...` making it quadratic.

One reason why we need deterministic `tyVarsOfType` is in `abstractVars`
in `SetLevels`. When we abstract type variables when floating we want
them to be abstracted in deterministic order.

Test Plan: harbormaster

Reviewers: simonpj, goldfire, austin, hvr, simonmar, bgamari

Reviewed By: simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1468

GHC Trac Issues: #4012

3 years agoAdd DVarSet - a deterministic set of Vars
Bartosz Nitka [Sat, 21 Nov 2015 14:49:14 +0000 (15:49 +0100)] 
Add DVarSet - a deterministic set of Vars

This implements `DVarSet`, a deterministic set of Vars, with an
interface very similar to `VarSet` with a couple of functions missing.

I will need this in changes that follow, one of them will be about
changing the type of the set of Vars that `RuleInfo` holds to make the
free variable computation deterministic.

Test Plan:
./validate
I can add new tests if anyone wants me to.

Reviewers: simonpj, simonmar, austin, bgamari

Reviewed By: simonmar, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1487

GHC Trac Issues: #4012

3 years agoSuppress conflicting types for builtins warnings
Herbert Valerio Riedel [Sat, 21 Nov 2015 14:48:49 +0000 (15:48 +0100)] 
Suppress conflicting types for builtins warnings

GCC 4.0 and later warn about type-conflicting prototypes for built-in
functions such as `strlen`. This is a problem for the via-c backend as
it generates code such as

  typedef void *(*(*StgFunPtr)(void))(void);
  extern StgFunPtr strlen();

However, by using the `-fno-builtin` flag, GCC is told not to try to
auto-detect such built-in functions and instead treat them as ordinary
external functions.  This also suppresses this warning.

This address #7660

Test Plan: IIAM

Reviewers: bgamari, austin

Reviewed By: austin

Subscribers: thomie, erikd

Differential Revision: https://phabricator.haskell.org/D1506

GHC Trac Issues: #7660

3 years agoRtsFlags: Fix const warning
Ben Gamari [Sat, 21 Nov 2015 14:48:09 +0000 (15:48 +0100)] 
RtsFlags: Fix const warning

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1509

3 years agoFix Windows builds after D1242
Tamar Christina [Sat, 21 Nov 2015 12:33:09 +0000 (13:33 +0100)] 
Fix Windows builds after D1242

Summary:
Only use the merge_sections.ld linker script if SplitSections is enabled.

I thought I had a way to make the linker script actually work on Windows
and produce object files instead of image files (by using the "INSERT AFTER"
linker script command to get the default script's output format setting),
but that fix caused ghci to crash with an illegal instruction on startup.

Gave up and made a simpler fix of just disabling this for normal builds,
as it's only really relevant with SplitSections enabled anyway.

Reviewers: austin, thomie, bgamari

Reviewed By: austin, thomie

Subscribers: Phyx, thomie

Differential Revision: https://phabricator.haskell.org/D1505

GHC Trac Issues: #8405

3 years agoFollow-up fixup to c5d8162d230c373
Herbert Valerio Riedel [Fri, 20 Nov 2015 17:06:50 +0000 (18:06 +0100)] 
Follow-up fixup to c5d8162d230c373

This was missing from c5d8162d230c373b2b49ec94d3f9a027ff6e2dd6 / D1501
for some reason causing the AIX detection to result in `OSUnknown`
rather than `OSAIX`.

3 years agobase: Delete errant GHC/Stack.hsc
Ben Gamari [Thu, 19 Nov 2015 16:58:37 +0000 (17:58 +0100)] 
base: Delete errant GHC/Stack.hsc

This was added in 8988be8561ce0857f3befd6ab3b6c29060685c0a, probably due
to an incorrect merge resolution. The build system has been building
`Stack.hs`.

3 years agousers-guide: Fix version number
Ben Gamari [Thu, 19 Nov 2015 14:27:28 +0000 (15:27 +0100)] 
users-guide: Fix version number

Previously used GhcVersion, which is apparently the version of the
bootstrap compiler. ProjectVersion appears to be the thing to use here.

3 years agouser's guide: Fix some accidental triple-` quote
Herbert Valerio Riedel [Fri, 20 Nov 2015 13:28:22 +0000 (07:28 -0600)] 
user's guide: Fix some accidental triple-` quote

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D1503

3 years agoghci: don't let ctags/etags overwrite source files
Austin Seipp [Fri, 20 Nov 2015 13:26:42 +0000 (07:26 -0600)] 
ghci: don't let ctags/etags overwrite source files

A ource file which was accidently passed as parameter into `:ctags` or `:etags`
can be overwritten by tag data. This patch updates documentation to avoid
confusion in commands usage and prevents `collateAndWriteTags` from modifying
existing source files.

Reviewed By: thomie, bgamari, austin

Differential Revision: https://phabricator.haskell.org/D1471

GHC Trac Issues: #10989

3 years agoPattern Synonym Documentation
Matthew Pickering [Thu, 19 Nov 2015 13:50:01 +0000 (13:50 +0000)] 
Pattern Synonym Documentation

Summary:
This patch adds documentation for record pattern synonyms (D1258) and
bundling pattern synonyms with type constructors in export lists (D1152).

There are also other small improvements motivated by #10900.

Reviewers: goldfire, bgamari, austin

Reviewed By: bgamari

Subscribers: goldfire, thomie

Differential Revision: https://phabricator.haskell.org/D1325

GHC Trac Issues: #10900

3 years agoBump process submodule
Ben Gamari [Thu, 19 Nov 2015 13:05:27 +0000 (14:05 +0100)] 
Bump process submodule

3 years agoUnbreak Text.Read.Lex.lex on Unicode symbols
M Farkas-Dyck [Thu, 19 Nov 2015 11:19:30 +0000 (12:19 +0100)] 
Unbreak Text.Read.Lex.lex on Unicode symbols

Reviewers: thomie, hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: bgamari, thomie

Differential Revision: https://phabricator.haskell.org/D1480

GHC Trac Issues: #10444

3 years agoSet AIX specific CFLAGS flags
Herbert Valerio Riedel [Thu, 19 Nov 2015 11:56:48 +0000 (12:56 +0100)] 
Set AIX specific CFLAGS flags

First of all, we need to use -mminimal-toc on IBM AIX

AIX's XCOFF is limited to 16k entries in its TOC for 32bit compilation,
which quickly overflows with GHC's code generation.

Otoh, the Parser.hs module contains more entries than fit into a
minimal-toc, so we need to switch back to `-mfull-toc` for that single
module again.

Then, we also need to set the `THREAD_SAFE` CPP #define in order to
unlock the thread-safe `errno` which is essential for the threaded
runtime.

Depends on D1501

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, erikd

Differential Revision: https://phabricator.haskell.org/D1502

3 years agoMake GHC aware of OSAIX and AixLD
Herbert Valerio Riedel [Thu, 19 Nov 2015 11:55:35 +0000 (12:55 +0100)] 
Make GHC aware of OSAIX and AixLD

GHC needs to be aware of targetting AIX because
AIX requires some special handling for the toolchain
(similiar to Solaris)

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, erikd

Differential Revision: https://phabricator.haskell.org/D1501

3 years agoderivedConstants: Add support for AIX
Herbert Valerio Riedel [Thu, 19 Nov 2015 11:55:26 +0000 (12:55 +0100)] 
derivedConstants: Add support for AIX

On IBM AIX `nm` doesn't support reporting symbol sizes, so we need to
resort to `objdump` instead, which has a peculiar output format on AIX.

depends on D1499

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: kgardas, thomie

Differential Revision: https://phabricator.haskell.org/D1500

3 years agoMake `derivedConstants` more crosscompile-friendly
Herbert Valerio Riedel [Thu, 19 Nov 2015 11:54:54 +0000 (12:54 +0100)] 
Make `derivedConstants` more crosscompile-friendly

`derivedConstants` currently uses `System.Info.os` for decisions (which
doesn't necessarily reflect the build-target), as well as hardcoding
"/usr/bin/objdump" for openbsd.

This patch auto-detects `objdump` similiar to how `nm` is detected via
Autoconf as well as passing the target-os into `derivedConstants` via
commandline.

Reviewers: austin, kgardas, erikd, bgamari

Reviewed By: kgardas, erikd, bgamari

Subscribers: kgardas, thomie, erikd

Differential Revision: https://phabricator.haskell.org/D1499

3 years agoFix broken build-system when libffi uses install-sh
Herbert Valerio Riedel [Thu, 19 Nov 2015 11:21:04 +0000 (12:21 +0100)] 
Fix broken build-system when libffi uses install-sh

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1494

GHC Trac Issues: #11109

3 years agoFix interaction of DuplicateRecordFields and GHC.Generics
Adam Gundry [Thu, 19 Nov 2015 11:53:46 +0000 (12:53 +0100)] 
Fix interaction of DuplicateRecordFields and GHC.Generics

This prevents GHC.Generics from exposing mangled selector names
when used on a datatype defined with DuplicateRecordFields enabled.

Test Plan:
New test overloadedrecflds_generics, which tests that both
GHC.Generics and Data.Data use the correct field labels, not mangled
names.

Reviewers: kosmikus, simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1486

3 years agoRelease Notes: Mention out-of-scope error message improvements
Joachim Breitner [Wed, 18 Nov 2015 23:05:50 +0000 (00:05 +0100)] 
Release Notes: Mention out-of-scope error message improvements

Summary: as implemented for #11071.

Differential Revision: https://phabricator.haskell.org/D1498

3 years agoMention "-XMonadFailDesugaring" in the docs
David Luposchainsky [Wed, 18 Nov 2015 22:12:47 +0000 (23:12 +0100)] 
Mention "-XMonadFailDesugaring" in the docs

Reviewers: austin, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1496

3 years agoCorrect > to > in user's guide
Reid Barton [Wed, 18 Nov 2015 22:12:05 +0000 (23:12 +0100)] 
Correct > to > in user's guide

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1497

3 years agousers-guide: Move <h1> outside of <a> tag
Ben Gamari [Wed, 18 Nov 2015 16:42:46 +0000 (17:42 +0100)] 
users-guide: Move <h1> outside of <a> tag

Otherwise the header extends across the entire body, increasing the
chance that the user hits it instead of the "next" link below it.

3 years agoFix inconsistent pretty-printing of type families
Michał Sośnicki [Wed, 18 Nov 2015 15:02:53 +0000 (16:02 +0100)] 
Fix inconsistent pretty-printing of type families

After the changes, the three functions used to print type families
were identical, so they are refactored into one.

Original RHSs of data instance declarations are recreated and
printed in user error messages.

RHSs containing representation TyCons are printed in the
Coercion Axioms section in a typechecker dump.

Add vbar to the list of SDocs exported by Outputable.
Replace all text "|" docs with it.

Fixes #10839

Reviewers: goldfire, jstolarek, austin, bgamari

Reviewed By: jstolarek

Subscribers: jstolarek, thomie

Differential Revision: https://phabricator.haskell.org/D1441

GHC Trac Issues: #10839

3 years agoRefactor HsExpr.RecordCon, RecordUpd
Simon Peyton Jones [Wed, 18 Nov 2015 15:57:13 +0000 (15:57 +0000)] 
Refactor HsExpr.RecordCon, RecordUpd

This follows Matthew's patch making pattern synoyms work
with records.

This patch
 - replaces the (PostTc id [FieldLabel]) field of
   RecordCon with (PostTc id ConLike)

 - record-ises both RecordCon and RecordUpd, which
   both have quite a lot of fields.

No change in behaviour

3 years agoComments on TcRnTypes.canDischarge
Simon Peyton Jones [Wed, 18 Nov 2015 13:51:35 +0000 (13:51 +0000)] 
Comments on TcRnTypes.canDischarge

3 years agoComments only
Simon Peyton Jones [Mon, 9 Nov 2015 09:38:53 +0000 (09:38 +0000)] 
Comments only

3 years agousers-guide: Fix typo in conf.py
Ben Gamari [Wed, 18 Nov 2015 12:53:53 +0000 (13:53 +0100)] 
users-guide: Fix typo in conf.py

inputenv /= inputenc

3 years agousers-guide: Use tango pygments style
Ben Gamari [Wed, 18 Nov 2015 12:06:50 +0000 (13:06 +0100)] 
users-guide: Use tango pygments style

3 years agorelnotes: Update base version
Ben Gamari [Tue, 17 Nov 2015 21:04:33 +0000 (22:04 +0100)] 
relnotes: Update base version

3 years agousers-guide: Give links more contrast
Ben Gamari [Wed, 18 Nov 2015 10:22:40 +0000 (11:22 +0100)] 
users-guide: Give links more contrast

3 years agoImprove MonadFail errors by mentioning the pattern
David Luposchainsky [Wed, 18 Nov 2015 11:23:57 +0000 (12:23 +0100)] 
Improve MonadFail errors by mentioning the pattern

Example error message:

    MonadFailErrors.hs:16:5: error:
        Could not deduce (MonadFail m)
          arising from a do statement
                       with the failable pattern ‘Just x’

Depends on D1248

Reviewers: austin, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1489

3 years agodocs: Ignore Sphinx doctrees produced by manpage build
Ben Gamari [Wed, 18 Nov 2015 11:23:25 +0000 (12:23 +0100)] 
docs: Ignore Sphinx doctrees produced by manpage build

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1491

3 years agobase: Documentation for TypeError
Ben Gamari [Wed, 18 Nov 2015 11:22:58 +0000 (12:22 +0100)] 
base: Documentation for TypeError

Test Plan: Read

Reviewers: yav, hvr, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1490

3 years agorts: Kill PAPI support
Ben Gamari [Wed, 18 Nov 2015 11:22:02 +0000 (12:22 +0100)] 
rts: Kill PAPI support

This hasn't been used for a very long time and will soon be superceded
by perf_events support.

Test Plan: validate

Reviewers: austin, simonmar

Reviewed By: austin, simonmar

Subscribers: thomie, erikd

Differential Revision: https://phabricator.haskell.org/D1493

3 years agoAdd -fwarn-missing-monadfail-instance to mkUserGuidePart
Ben Gamari [Wed, 18 Nov 2015 11:20:35 +0000 (12:20 +0100)] 
Add -fwarn-missing-monadfail-instance to mkUserGuidePart

3 years agoDisable failed specialisation warnings by default & update documentation.
Ben Gamari [Wed, 18 Nov 2015 11:19:01 +0000 (12:19 +0100)] 
Disable failed specialisation warnings by default & update documentation.

These were far too noisy to enable by default. In the future we will
hopefully have a more variant of -Wall targetted at these sorts of
diagnostics.

In the interim I've pointed out the existence of these options in the
release
notes in hopes that people will discover them.

Test Plan: Validate

Reviewers: hvr, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1492

3 years agoMore import related hints
Joachim Breitner [Wed, 18 Nov 2015 11:18:17 +0000 (12:18 +0100)] 
More import related hints

Now for unqualified imports. Improves upon #11071.

Unfortunately, it seems that since 7.10, ghc will not print all
out-of-scope errors.

Test Plan: test suite updated

Reviewers: austin, thomie, bgamari

Reviewed By: bgamari

Differential Revision: https://phabricator.haskell.org/D1478

GHC Trac Issues: #11071

3 years agoDynFlags: Don't list TemplateHaskell as supported if it's not
Ben Gamari [Wed, 18 Nov 2015 06:56:30 +0000 (07:56 +0100)] 
DynFlags: Don't list TemplateHaskell as supported if it's not

`-XTemplateHaskell` requires GHCi; don't show it in
`--supported-extensions` if it's not supported.

Together with https://github.com/haskell/cabal/issues/2644
this allows to finally fix a long-standing annoyance in cabal
of not being able to detect availability of TH in build-plans.

Fixes #11102

See also https://github.com/haskell/cabal/pull/2930 which provides
emulation of this feature for older GHCs.

Reviewed By: bgamari

Differential Revision: https://phabricator.haskell.org/D1484

3 years agoMonadFail proposal, phase 1
David Luposchainsky [Tue, 17 Nov 2015 16:10:02 +0000 (17:10 +0100)] 
MonadFail proposal, phase 1

This implements phase 1 of the MonadFail proposal (MFP, #10751).

- MonadFail warnings are all issued as desired, tunable with two new flags
- GHC was *not* made warning-free with `-fwarn-missing-monadfail-warnings`
  (but it's disabled by default right now)

Credits/thanks to
- Franz Thoma, whose help was crucial to implementing this
- My employer TNG Technology Consulting GmbH for partially funding us
  for this work

Reviewers: goldfire, austin, #core_libraries_committee, hvr, bgamari, fmthoma

Reviewed By: hvr, bgamari, fmthoma

Subscribers: thomie

Projects: #ghc

Differential Revision: https://phabricator.haskell.org/D1248

GHC Trac Issues: #10751

3 years agoImplement OverloadedLabels
Adam Gundry [Tue, 17 Nov 2015 14:50:33 +0000 (15:50 +0100)] 
Implement OverloadedLabels

See
https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/OverloadedLabels
for the big picture.

Reviewers: goldfire, simonpj, austin, hvr, bgamari

Reviewed By: simonpj, bgamari

Subscribers: kosmikus, thomie, mpickering

Differential Revision: https://phabricator.haskell.org/D1331

3 years agoFix archive loading on Windows by the runtime loader
Tamar Christina [Tue, 17 Nov 2015 14:35:46 +0000 (15:35 +0100)] 
Fix archive loading on Windows by the runtime loader

The runtime loader is unable to find archive files `.a` shipping
with the inplace `GCC`.

It seems the issue is caused by `findArchive` being unable to
find any archives that are shipped using the in-place `GCC`.

- It works on Linux because `findArchive` would search
  the standard Linux include path.
- It works during compilation because `GCC` can find it's own libraries
  (we explicitly tell it where to look for libraries using the `gcc`
  wrapper around `realgcc`)

So fixing the issue means using `searchForLibUsingGcc` in `findArchive`
as well, which will then find the correct file.

The reason for the error as it is, is because if we can't locate the
library using any of the methods we have, we assume it is a system dll,
or something on the system search path.  e.g. if trying to load
`kernel32.dll`.

There is a slight issue in that the `GHCi` code (incorrectly) favors
`static archives` over `dynamic` ones

```
findDll        `orElse`
findArchive    `orElse`
tryGcc         `orElse`
tryGccPrefixed `orElse`
assumeDll
```
This has the unwanted effect of when `kernel32` is specified as a lib,
it will try to load `kernel32.a` instead of `kernel32.dll`.

To solve this I have added another search function that is able to
search the Windows search paths using `SearchPath` in order to find if
it is a dll on the system search path.

The new search order is:

```
findDll     `orElse`
findSysDll  `orElse`
tryGcc      `orElse`
findArchive `orElse`
assumeDll
```

(`tryGccPrefixed` was rolled into `tryGcc` so it is no longer needed at
top level)

Test Plan: ./validate added new windows tests T3242

Reviewers: thomie, erikd, hvr, austin, bgamari

Reviewed By: thomie, erikd, bgamari

Differential Revision: https://phabricator.haskell.org/D1455

GHC Trac Issues: #3242

3 years agoMake `timer_create(CLOCK_REALTIME)` autoconf test more reliable
Herbert Valerio Riedel [Tue, 17 Nov 2015 14:30:56 +0000 (15:30 +0100)] 
Make `timer_create(CLOCK_REALTIME)` autoconf test more reliable

I've noticed that on a platform with a coarse timer/scheduling
granularity of 10ms this autoconf tests fails to detect a working
`timer_create(CLOCK_REALTIME)`.

On AIX, this effectively means that intervals/timers are rounded up to
multiples of 10ms, so a 13ms delay is effectively a 20ms delay.

By using a 100ms timeout we are on the safe side.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, erikd

Differential Revision: https://phabricator.haskell.org/D1483

3 years agoUpdate Cabal submodule for new known extension
Adam Sandberg Eriksson [Tue, 17 Nov 2015 14:29:22 +0000 (15:29 +0100)] 
Update Cabal submodule for new known extension

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1485

3 years agotemplate-haskell: drop `TemplateHaskell` requirement
Herbert Valerio Riedel [Tue, 17 Nov 2015 14:55:43 +0000 (15:55 +0100)] 
template-haskell: drop `TemplateHaskell` requirement

`other-extensions: TemplateHaskell` is inaccurate: It's not required
to compile `template-haskell` (otherwise we wouldn't be able to build
that package via `ghc-stage1`...)

This has been discovered while working on #11102

3 years agoRemove orphan Functor instance of Data.Graph.SCC
Ömer Sinan Ağacan [Tue, 17 Nov 2015 08:50:05 +0000 (09:50 +0100)] 
Remove orphan Functor instance of Data.Graph.SCC

Reviewers: bgamari, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1481

3 years agoT9181: Fix testsuite output
Ben Gamari [Tue, 17 Nov 2015 11:20:30 +0000 (06:20 -0500)] 
T9181: Fix testsuite output

I'm not really sure how this one snuck through my local validation. Hmm.

3 years agoBump process submodule
Ben Gamari [Tue, 17 Nov 2015 08:37:51 +0000 (09:37 +0100)] 
Bump process submodule

3 years agoRevert "Unify hsig and hs-boot; add preliminary "hs-boot" merging."
Edward Z. Yang [Sat, 14 Nov 2015 00:18:24 +0000 (16:18 -0800)] 
Revert "Unify hsig and hs-boot; add preliminary "hs-boot" merging."

Summary:
This reverts commit 06d46b1e4507e09eb2a7a04998a92610c8dc6277.

This also has a Haddock submodule update.

Test Plan: validate

Reviewers: simonpj, austin, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1475

3 years agoMove usage calculation to desugaring, simplifying ModGuts.
Edward Z. Yang [Fri, 13 Nov 2015 00:38:02 +0000 (16:38 -0800)] 
Move usage calculation to desugaring, simplifying ModGuts.

Summary:
(This patch was excised from the fat interfaces patch, which
has been put indefinitely on hold.)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, austin, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1469

3 years agos/FrontendMerge/FrontendInterface/g
Edward Z. Yang [Tue, 20 Oct 2015 02:16:14 +0000 (19:16 -0700)] 
s/FrontendMerge/FrontendInterface/g

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoImplement support for user-defined type errors.
Iavor S. Diatchki [Mon, 16 Nov 2015 16:08:14 +0000 (17:08 +0100)] 
Implement support for user-defined type errors.

Implements Lennart's idea from the Haskell Symposium.
Users may use the special type function `TypeError`, which is
similar to `error` at the value level.

See Trac ticket https://ghc.haskell.org/trac/ghc/ticket/9637, and wiki
page https://ghc.haskell.org/trac/ghc/wiki/CustomTypeErros

Test Plan: Included testcases

Reviewers: simonpj, austin, hvr, goldfire, bgamari

Reviewed By: goldfire, bgamari

Subscribers: adamgundry, thomie

Differential Revision: https://phabricator.haskell.org/D1236

GHC Trac Issues: #9637

3 years agoData.List.isSubsequenceOf documentation clarification
Justin Raymond [Mon, 16 Nov 2015 16:05:36 +0000 (17:05 +0100)] 
Data.List.isSubsequenceOf documentation clarification

Fixes #11083.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1477

GHC Trac Issues: #11083

3 years agoWeaken monadic list operations to Applicative
Ben Gamari [Mon, 16 Nov 2015 16:02:58 +0000 (17:02 +0100)] 
Weaken monadic list operations to Applicative

Generalize `filterM`, `mapAndUnzipM`, `zipWithM`, `zipWithM_`,
`replicateM`, and `replicateM_`.

Reviewers: ekmett, #core_libraries_committee, austin, hvr, bgamari

Reviewed By: ekmett, #core_libraries_committee, bgamari

Subscribers: ekmett, glguy, thomie

Projects: #ghc

Differential Revision: https://phabricator.haskell.org/D1324

GHC Trac Issues: #10168

3 years agoUse TcM instead of it's expanded form, in TcSplice
Ömer Sinan Ağacan [Mon, 16 Nov 2015 16:01:01 +0000 (17:01 +0100)] 
Use TcM instead of it's expanded form, in TcSplice

Reviewers: austin, bgamari, goldfire

Reviewed By: bgamari, goldfire

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1474

3 years agohaddock.mk: Use \{1,\} instead of \+
Ben Gamari [Mon, 16 Nov 2015 14:42:16 +0000 (16:42 +0200)] 
haddock.mk: Use \{1,\} instead of \+

This works around Mac OS X's sed, which doesn't support \+.
For the record,

    The regex implementation in Mac OS X 10.8 and later is based on a heavily
    modified subset of TRE, http://laurikari.net/tre/

3 years agoghc.mk: Make install_docs rule sh-compatible
Ben Gamari [Mon, 16 Nov 2015 14:56:12 +0000 (16:56 +0200)] 
ghc.mk: Make install_docs rule sh-compatible

3 years agoRtsFlags: Refactor some of the deeper switches
Ben Gamari [Mon, 16 Nov 2015 15:58:41 +0000 (16:58 +0100)] 
RtsFlags: Refactor some of the deeper switches

This was previously nearly impossible to read; now it's merely
difficult.

Ideally we would do a more thorough refactoring of the RTS command line
parser (#4243) but this is more effort than I have time for at the
moment.

Test Plan: Try using affected RTS flags

Reviewers: simonmar, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1476

GHC Trac Issues: #4243