[commit: ghc] ghc-8.0: check that the number of parallel build is greater than 0 (6f804c2)
git at git.haskell.org
git at git.haskell.org
Thu Aug 25 16:37:29 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/6f804c249bf4ca9b8b3b63796fc36c0ec69a936b/ghc
>---------------------------------------------------------------
commit 6f804c249bf4ca9b8b3b63796fc36c0ec69a936b
Author: Ruey-Lin Hsu <petercommand at gmail.com>
Date: Thu Aug 4 13:41:57 2016 +0200
check that the number of parallel build is greater than 0
Fixes #12062.
Reviewers: bgamari, thomie, austin, simonmar
Reviewed By: bgamari, thomie, simonmar
Subscribers: simonmar, thomie
Differential Revision: https://phabricator.haskell.org/D2415
GHC Trac Issues: #12062
(cherry picked from commit f09d65474ed042360999cb88221d65b07bfb4b5f)
>---------------------------------------------------------------
6f804c249bf4ca9b8b3b63796fc36c0ec69a936b
compiler/main/DynFlags.hs | 13 +++++++++++--
docs/users_guide/using.rst | 10 ++++++----
.../{programs/hs-boot/A.hs-boot => driver/T12062/A.hs} | 2 --
testsuite/tests/{th/T2014 => driver/T12062}/A.hs-boot | 0
.../{th/TH_import_loop/ModuleC.hs => driver/T12062/C.hs} | 6 ++----
.../scripts/break022 => driver/T12062}/Makefile | 0
.../TH_import_loop/ModuleB.hs => driver/T12062/T12062.hs} | 7 ++-----
testsuite/tests/driver/T12062/T12062.stderr | 2 ++
testsuite/tests/driver/T12062/all.T | 2 ++
9 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 0a944b7..7582e11 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -2328,8 +2328,17 @@ dynamic_flags_deps = [
"deprecated: They no longer have any effect"))))
, make_ord_flag defFlag "v" (OptIntSuffix setVerbosity)
- , make_ord_flag defGhcFlag "j" (OptIntSuffix (\n ->
- upd (\d -> d {parMakeCount = n})))
+ , make_ord_flag defGhcFlag "j" (OptIntSuffix
+ (\n -> case n of
+ Just n
+ | n > 0 -> upd (\d -> d { parMakeCount = Just n })
+ | otherwise -> addErr "Syntax: -j[n] where n > 0"
+ Nothing -> upd (\d -> d { parMakeCount = Nothing })))
+ -- When the number of parallel builds
+ -- is omitted, it is the same
+ -- as specifing that the number of
+ -- parallel builds is equal to the
+ -- result of getNumProcessors
, make_ord_flag defFlag "sig-of" (sepArg setSigOf)
-- RTS options -------------------------------------------------------------
diff --git a/docs/users_guide/using.rst b/docs/users_guide/using.rst
index 3d3ef34..1d7f52c 100644
--- a/docs/users_guide/using.rst
+++ b/docs/users_guide/using.rst
@@ -418,7 +418,8 @@ The main advantages to using ``ghc --make`` over traditional
dependencies never get out of sync with the source.
- Using the :ghc-flag:`-j` flag, you can compile modules in parallel. Specify
- ``-j⟨N⟩`` to compile ⟨N⟩ jobs in parallel.
+ ``-j⟨N⟩`` to compile ⟨N⟩ jobs in parallel. If N is omitted,
+ then it defaults to the number of processors.
Any of the command-line options described in the rest of this chapter
can be used with ``--make``, but note that any options you give on the
@@ -444,11 +445,12 @@ The source files for the program don't all need to be in the same
directory; the :ghc-flag:`-i` option can be used to add directories to the
search path (see :ref:`search-path`).
-.. ghc-flag:: -j <N>
+.. ghc-flag:: -j [N]
Perform compilation in parallel when possible. GHC will use up to ⟨N⟩
- threads during compilation. Note that compilation of a module may not
- begin until its dependencies have been built.
+ threads during compilation. If N is omitted, then it defaults to the
+ number of processors. Note that compilation of a module may not begin
+ until its dependencies have been built.
.. _eval-mode:
diff --git a/testsuite/tests/programs/hs-boot/A.hs-boot b/testsuite/tests/driver/T12062/A.hs
similarity index 92%
copy from testsuite/tests/programs/hs-boot/A.hs-boot
copy to testsuite/tests/driver/T12062/A.hs
index c80b00d..b1ea7a4 100644
--- a/testsuite/tests/programs/hs-boot/A.hs-boot
+++ b/testsuite/tests/driver/T12062/A.hs
@@ -1,4 +1,2 @@
-
module A where
-
import C
diff --git a/testsuite/tests/th/T2014/A.hs-boot b/testsuite/tests/driver/T12062/A.hs-boot
similarity index 100%
copy from testsuite/tests/th/T2014/A.hs-boot
copy to testsuite/tests/driver/T12062/A.hs-boot
diff --git a/testsuite/tests/th/TH_import_loop/ModuleC.hs b/testsuite/tests/driver/T12062/C.hs
similarity index 53%
copy from testsuite/tests/th/TH_import_loop/ModuleC.hs
copy to testsuite/tests/driver/T12062/C.hs
index 3047a8f..0f2a5b3 100644
--- a/testsuite/tests/th/TH_import_loop/ModuleC.hs
+++ b/testsuite/tests/driver/T12062/C.hs
@@ -1,9 +1,7 @@
-
-module ModuleC where
+module C where
import Language.Haskell.TH
-import {-# SOURCE #-} ModuleA
+import {-# SOURCE #-} A
nothing = return [] :: Q [Dec]
-
diff --git a/testsuite/tests/ghci.debugger/scripts/break022/Makefile b/testsuite/tests/driver/T12062/Makefile
similarity index 100%
copy from testsuite/tests/ghci.debugger/scripts/break022/Makefile
copy to testsuite/tests/driver/T12062/Makefile
diff --git a/testsuite/tests/th/TH_import_loop/ModuleB.hs b/testsuite/tests/driver/T12062/T12062.hs
similarity index 54%
copy from testsuite/tests/th/TH_import_loop/ModuleB.hs
copy to testsuite/tests/driver/T12062/T12062.hs
index 9aaffb6..ed581c0 100644
--- a/testsuite/tests/th/TH_import_loop/ModuleB.hs
+++ b/testsuite/tests/driver/T12062/T12062.hs
@@ -1,9 +1,6 @@
-
{-# LANGUAGE TemplateHaskell #-}
+module T12062 where
-module ModuleB where
-
-import ModuleC
+import C
$(nothing)
-
diff --git a/testsuite/tests/driver/T12062/T12062.stderr b/testsuite/tests/driver/T12062/T12062.stderr
new file mode 100644
index 0000000..8262940
--- /dev/null
+++ b/testsuite/tests/driver/T12062/T12062.stderr
@@ -0,0 +1,2 @@
+ghc-stage2: on the commandline: Syntax: -j[n] where n > 0
+Usage: For basic information, try the `--help' option.
diff --git a/testsuite/tests/driver/T12062/all.T b/testsuite/tests/driver/T12062/all.T
new file mode 100644
index 0000000..1372ae3
--- /dev/null
+++ b/testsuite/tests/driver/T12062/all.T
@@ -0,0 +1,2 @@
+test('T12062', extra_clean(['T12062.o','T12062.hi', 'A.hi', 'A.o', 'A.hi-boot', 'A.o-boot', 'C.hi', 'C.o']),
+ multimod_compile_fail, ['T12062', '-v0 -j0'])
More information about the ghc-commits
mailing list