Commit f09d6547 authored by petercommand's avatar petercommand Committed by Ben Gamari

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
parent fe4008f6
......@@ -2343,8 +2343,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 -------------------------------------------------------------
......
......@@ -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
``-jN`` to compile N jobs in parallel.
``-jN`` 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:
......
......@@ -82,6 +82,7 @@ extra_src_files = {
'T11430': ['Test11430.hs', 't11430.hs'],
'T11824': ['TyCon.hs', 'Type.hs', 'Type.hs-boot', 'Unbound/'],
'T11827': ['A.hs', 'A.hs-boot', 'B.hs'],
'T12062': ['A.hs', 'A.hs-boot', 'C.hs'],
'T1372': ['p1/', 'p2/'],
'T1407': ['A.c'],
'T1959': ['B.hs', 'C.hs', 'D.hs', 'E1.hs', 'E2.hs'],
......
module C where
import Language.Haskell.TH
import {-# SOURCE #-} A
nothing = return [] :: Q [Dec]
TOP=../../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
{-# LANGUAGE TemplateHaskell #-}
module T12062 where
import C
$(nothing)
ghc-stage2: on the commandline: Syntax: -j[n] where n > 0
Usage: For basic information, try the `--help' option.
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'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment