testsuite: normalise integer library name for T8958

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Some typos
Revert "Comment why the include is necessary"

This reverts commit 15df6d98afb8c3813013c5b97efffe0ba8020d32.
Revert "Make sure that a prototype is included for 'setIOManagerControlFd'"

This reverts commit 7bf49f86a20f3beda0ee5fbea2db64cfef730d74.
Re-export Word from Prelude (re #9531)

The original proposal text can be found at

  http://www.haskell.org/pipermail/libraries/2014-August/023491.html

The proposal passed with a clear majority, and was additionally
confirmed by the core libraries committee.

*Compatibility Note*

Only code that imports `Data.Word` for the sole purpose of using `Word`
*and* requires to be `-Werror`-clean (due to `-fwarn-unused-imports`)
is affected by this change.

In order to write warning-free forward/backward compatible against `base`,
a variant of the following CPP-based snippet can be used:

  -- Starting with base>4.7.0 or GHC>7.8 Prelude re-exports 'Word'
  -- The following is needed, if 'Word' is the *only* entity needed from Data.Word
  #ifdef MIN_VERSION_base
  # if !MIN_VERSION_base(4,7,1)
  import Data.Word (Word)
  # endif
  -- no cabal_macros.h -- fallback to __GLASGOW_HASKELL__
  #elif __GLASGOW_HASKELL__ < 709
  import Data.Word (Word)
  #endif

This also updates the haddock submodule in order to avoid a compile warning
Add `FiniteBits(count{Leading,Trailing}Zeros)`

This exposes the newly added CLZ/CTZ primops from
e0c1767d0ea8d12e0a4badf43682a08784e379c6 (re #9340)
via two new methods `countLeadingZeros` and `countTrailingZeros`
in the `Data.Bits.FiniteBits` class.

The original proposal can be found at

  http://www.haskell.org/pipermail/libraries/2014-August/023567.html

Test Plan: successful validate

Reviewers: ekmett, tibbe

GHC Trac Issues: #9532

Differential Revision: https://phabricator.haskell.org/D158
`M-x delete-trailing-whitespace` & `M-x untabify`...

...some files more or less recently touched by me

[ci skip]
Remove incorrect property in docstring (re #9532)

The property

  countLeadingZeros . negate = const 0

doesn't generally hold and it's not such a useful property to state, as
it simply follows from "sign-bit == most-significant-bit" for FiniteBits
types which use twos-complement representation for negative values, and
even then it breaks down for 0...

TLDR, remove thinko from documentation of `countLeadingZeros`
Make ghc-api cleaning less aggressive.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
testsuite: update T6056 rule firing order

Fixes testsuite failure.

Summary: Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

Test Plan: validate --slow

Reviewers: simonpj, austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D184
includes/Stg.h: remove unused 'wcStore' inline

Summary:
Commit reverts never used addition in cbd29e0a23bb8e15033edae123d6c8fbe9740c97

I think it might make sense to take advantage of TSO/RMO/PSO models
tome day. But it's highly architecture/model-dependent thus it better
be implemented in per-arch Native CodeGen.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

Test Plan: build-tested on UNREG-amd64

Reviewers: simonmar, austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D186
StringBuffer should not contain initial byte-order mark (BOM)

Summary:
Just skipping over a BOM, but leaving it in the Stringbuffer, is not
sufficient. The Lexer calls prevChar when a regular expression starts
with '^' (which is a shorthand for '\n^'). It would never match on the
first line, since instead of '\n', prevChar would still return '\xfeff'.

Test Plan: validate

Reviewers: austin, ezyang

Reviewed By: austin, ezyang

Subscribers: simonmar, ezyang, carter

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

GHC Trac Issues: #6016
Cleanup and better documentation of sync-all script

Summary:
Rumor has it that sync-all is slowly on the way out. Now that all
subrepositories have been turned into git submodules, sync-all might
not be needed anymore. Nevertheless, here are some changes I had made
while trying to understand why it existed in the first place:

* update comments + help text
* rename some variables for maintainability
    * s/branch_name/remote_name/
    origin is the name of a remote, not a branch

    * s/repo_base/remote_root/
    the word *remote* is key here

    * s/defaultrepo/default_root/
    this was a darcsism, and it doesn't refer to a repository but to the
    root directory of all repositories
* small tweaks
* .git can be a file nowadays
* don't skip END actions on exceptions #8886
  reverts d523f9b3d4ce3463e8816cad2139ea397e00f8d1

Test Plan:
Why revert d523f9b3d4ce3463e8816cad2139ea397e00f8d1?

I put an old haddock repository from
http://darcs.haskell.org/haddock2.git back in my tree. Now, when running
`sync-all get`, the following happens:

1. I get a cryptic error saying:

    fatal: reference is not a tree:
    5412c262f403e52be45d607b34eb3a5806ea2a76
    Unable to checkout '5412c262f403e52be45d607b34eb3a5806ea2a76' in
    submodule path 'utils/haddock'
    git failed: 256 at ./sync-all line 112.

2. sync-all checks if maybe an old haddock repository is present

3. I get a clear warning saying:

    ============================
    ATTENTION!

    You have an old haddock repository in your GHC tree!

    Please remove it (e.g. "rm -r utils/haddock"), and then run
    "./sync-all get" to get the new repository.
    ============================

Without commit d523f9b3d4ce3463e8816cad2139ea397e00f8d1 reverted, steps
2 and 3 were skipped. The problem that commit tried to solve,
is now solved with 7012ed8515100b4947383e93b82dbff7a0aa835c.

Reviewers: nomeata, austin, hvr

Reviewed By: austin, hvr

Subscribers: simonmar, ezyang, carter

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

GHC Trac Issues: #8886, #9212
Make Lexer.x more like the 2010 report

Summary:
I tried reading the lexer and the 2010 report side-by-side. Althought I didn't
quite finish, here are some small discrepancies that I found.

This revision may be low priority for reviewers, but having these commits just
in my local repository does no good either.

Changes:
* $nl was defined, but not used anywhere
* formfeed is a newline character
* add \: to $ascsymbol
  For simplification reason, the colon (':') was added to the character
  set $ascsymbol in the 2010 report. Here we make the same change.
* introduce the macros `qvarid`, `qconid`, `qvarsym` and `qconsym`
* foreign is a Haskell keyword
* add/update comments

Test Plan: Harbormaster (is awesome)

Reviewers: simonmar, hvr, austin

Reviewed By: austin

Subscribers: hvr, simonmar, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D180
genprimopcode: GHC.Prim is Unsafe (#9449)

Summary:
Make sure the documentation for `GHC.Prim` adequately
reflects the fact it is unsafe.

Also clean up some 80-column violations.

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

Test Plan:
Build documentation, check `GHC.Prim`. It's properly marked
as `Unsafe`.

Reviewers: hvr, goldfire, ezyang

Reviewed By: ezyang

Subscribers: nomeata, simonmar, ezyang, carter

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

GHC Trac Issues: #9449
Refactor stack squeezing logic

Summary:
This patch is only to make the code easier to read.

In addition, this is the first patch I send with the arc/differential workflow.
So I start with something very small.

Test Plan: I have not even tried to compile it yet.

Reviewers: simonmar, austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D189
Set llc and opt commands on all platforms

Summary:
LLVM llc and opt commands should be set on all platforms, including
Windows. If they're not, GHC tries to execute an unnamed executable,
resulting in error messages such as:

    Error (figuring out LLVM version): : runInteractiveProcess: invalid argument (Invalid argument)
    <no location info>:
        Warning: Couldn't figure out LLVM version!
                 Make sure you have installed LLVM

This regression was introduced in e6bfc596.

Test Plan: Build GHC and test if --info shows sensible values of "LLVM llc command" and "LLVM opt command"

Reviewers: austin, #ghc

Reviewed By: austin, #ghc

Subscribers: austin

Projects: #ghc

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

GHC Trac Issues: #7143
Fix a couple test failures encountered when building on Windows

Summary:
* Adjusts performance tests
* Change ghcpkg05.stderr-mingw32 to match ghcpkg05.stderr

Test Plan: Ran 'sh validate' and observed fewer test failures afterwards

Reviewers: austin

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D191
systools: fix gcc version detecton on non-english locale

Summary:
ghc runs 'gcc -v' to check if we run under vanilla gcc
or disaguised clang by checking for string

    "gcc version <something>"

But this check does not always work as gcc has that string
localized via gettext mechanism:

    (some gcc's locale strings)
    be.po-msgstr "версія gcc %s\n"
    da.po-msgstr "GCC version %s\n"
    de.po-msgstr "gcc-Version %s %s\n"
    el.po-msgstr "έκδοση gcc %s\n"
    ...

To ping gcc to English locale we now override environment
variable with 'LANGUAGE=en' value.

Fixes Issue #8825

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

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

GHC Trac Issues: #8825
Revert "Fix a couple test failures encountered when building on Windows"

This reverts commit 9711f78f790d10d914e08851544c6fc96f9a030a, as it's
causing build phailures in phabricator.