Revert "Use dropWhileEndLE p instead of reverse . dropWhile p . reverse"

This reverts commit 2a8856884de7d476e26b4ffa829ccb3a14d6f63e.
Use dropWhileEndLE p instead of reverse . dropWhile p . reverse

Summary: Using `dropWhileEndLE` tends to be faster and easier to read
than the `reverse . dropWhile p . reverse` idiom. This also cleans up
some other, nearby, messes. Fix #9616 (incorrect number formatting
potentially leading to incorrect numbers in output).

Test Plan: Run validate

Reviewers: thomie, rwbarton, nomeata, austin

Reviewed By: nomeata, austin

Subscribers: simonmar, ezyang, carter, thomie

Projects: #ghc

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

GHC Trac Issues: #9623, #9616

Conflicts:
	compiler/basicTypes/OccName.lhs
rts/PrimOps.cmm: follow '_static_closure' update

Caught by UNREG build failure:

      rts_dist_HC rts/dist/build/PrimOps.o
    /tmp/ghc8613_0/ghc8613_2.hc: In function 'cf8_entry':

    /tmp/ghc8613_0/ghc8613_2.hc:1942:13:
         error: 'base_ControlziExceptionziBase_nestedAtomically_static_closure' undeclared (first use in this function)
         R1.w = (W_)&base_ControlziExceptionziBase_nestedAtomically_static_closure;
                     ^

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Really fix dropWhileEndLE commit

which I fixed before, but failed to pass -a to "git commit --amend"
arclint: Don't complain about tabs unless it's inside the diff.

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

Test Plan: none

Reviewers: austin

Subscribers: simonmar, ezyang, carter, thomie

Differential Revision: https://phabricator.haskell.org/D303
Comments only (instances for Proxy are lazy)
Revert "Basic Python 3 support for testsuite driver (Trac #9184)"

This reverts commit 084d241b316bfa12e41fc34cae993ca276bf0730.

This is a possible culprit of Windows breakage reported at ghc-devs.
Restore spaces instead of tabs, caused by revert of Python 3

The git hook does not allow to reinsert tabs.
Check for staticclosures section in Windows linker.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Fix typo in section name: no leading period.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ghc.mk: fix list for dll-split on GHCi-less builds

To reproduce build failure it's enough to try
to build GHC on amd64 with the following setup:

    $ cat mk/build.mk
    # for #9552
    GhcWithInterpreter = NO

It gives:

    Reachable modules from DynFlags out of date
    Please fix compiler/ghc.mk, or building DLLs on Windows may break (#7780)
    Redundant modules: Bitmap BlockId ... <list of 42 modules>
    <make error>

dll-split among other things makes sure
all mentioned modules are used by DynFlags.
'#ifdef GHCI' keeps is from happening.

Patch moves those 42 modules under
'GhcWithInterpreter' guard.

Fixes Issue #9552

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Implement `MIN_VERSION_GLASGOW_HASKELL()` macro

This exposes the `cProjectPatchLevel{1,2}` value at the CPP level to
allow it to be used in CPP conditionals. Concretely, GHC 7.10.2.20150623
would result in

  #define __GLASGOW_HASKELL__             710
  #define __GLASGOW_HASKELL_PATCHLEVEL1__ 2
  #define __GLASGOW_HASKELL_PATCHLEVEL2__ 20150623

while GHC 7.10.3 results in

  #define __GLASGOW_HASKELL__             710
  #define __GLASGOW_HASKELL_PATCHLEVEL1__ 3

and finally GHC 7.9.20141009 results in

  #define __GLASGOW_HASKELL__             709
  #define __GLASGOW_HASKELL_PATCHLEVEL1__ 20141009

As it's error-prone to properly express CPP conditionals for testing GHC
multi-component versions, a new macro `MIN_VERSION_GLASGOW_HASKELL()` is
provided (also via the new CPP include file `ghcversion.h`)

Finally, in order to make it easier to define the new CPP macro
`MIN_VERSION_GLASGOW_HASKELL()`, a new default-included
`include/ghcversion.h` is used for the new CPP definitions.

Reviewed By: ekmett, austin, #ghc

Differential Revision: https://phabricator.haskell.org/D66
rts: unrust 'libbfd' debug symbols parser

Summary:
Patch does the following:
- fixes detection of working libbfd on modern linux
  platforms (where bfd_uncompress_section_contents is a macro)
- disables 'bfd' by default and adds '--enable-bfd-debug'
  configure option. As bfd's ABI is unstable
  the feature is primarily useful by ghc hackers.

Not done (subject for another patch):
- one-time bfd object memory leak in DEBUG_LoadSymbols
- in '-dynamic' mode debugging symbols are loaded only for
  current executable, not all libraries it is linked against.

Fixes Issue #8790

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

Test Plan: built unregisterised ghc on amd64 and ran './hello +RTS -Di' there

Reviewers: simonmar, austin

Reviewed By: simonmar, austin

Subscribers: thomie, simonmar, ezyang, carter

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

GHC Trac Issues: #8790
testsuite: fix tcrun036 build against Prelude/Main 'traverse' clash

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
testsuite: fix T5751 build failure (AMP)

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
testsuite: fix T1735_Help/State.hs build failure (AMP)

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
testsuite: fix seward-space-leak build aganst Prelude/Main 'traverse' clash

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Use correct precedence when printing contexts with class operators

Fixes Trac #9658
Merge branch 'master' of http://git.haskell.org/ghc
Fix a typo in an error message