diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-12-01 12:48:32 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-12-01 12:56:57 +0000 |
commit | 744d4b0086f9aac866b98227158a41125153e1e4 (patch) | |
tree | c06090c5d454aeffe3fee4fd4d242d760db34396 | |
parent | 57b995b83bc6f3483c0322fc13043e73e7f7e4ee (diff) | |
parent | 6dce643d1981f1ecba2b38f5932720385999244b (diff) | |
download | haskell-744d4b0086f9aac866b98227158a41125153e1e4.tar.gz |
Merge remote-tracking branch 'origin/master' into wip/spj-wildcard-refactorwip/spj-wildcard-refactor
-rw-r--r-- | compiler/basicTypes/MkId.hs | 12 | ||||
-rw-r--r-- | compiler/hsSyn/HsTypes.hs | 2 | ||||
-rw-r--r-- | compiler/typecheck/TcTyDecls.hs | 6 | ||||
-rw-r--r-- | ghc.mk | 17 | ||||
-rw-r--r-- | mk/config.mk.in | 49 | ||||
-rw-r--r-- | mk/warnings.mk | 44 | ||||
-rw-r--r-- | rules/distdir-way-opts.mk | 21 | ||||
-rw-r--r-- | utils/mkUserGuidePart/Main.hs | 5 |
8 files changed, 109 insertions, 47 deletions
diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index 989d79707e..8223f3340b 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -106,7 +106,7 @@ There are several reasons why an Id might appear in the wiredInIds: result type. -- sof 1/99] (3) Other error functions (rUNTIME_ERROR_ID) are wired in (a) because - the desugarer generates code that mentiones them directly, and + the desugarer generates code that mentions them directly, and (b) for the same reason as eRROR_ID (4) lazyId is wired in because the wired-in version overrides the @@ -390,7 +390,7 @@ mkDataConWorkId wkr_name data_con -- even if the data constructor is declared strict -- e.g. data T = MkT !(Int,Int) -- Why? Because the *wrapper* is strict (and its unfolding has case - -- expresssions that do the evals) but the *worker* itself is not. + -- expressions that do the evals) but the *worker* itself is not. -- If we pretend it is strict then when we see -- case x of y -> $wMkT y -- the simplifier thinks that y is "sure to be evaluated" (because @@ -655,7 +655,7 @@ dataConSrcToImplBang dflags fam_envs arg_ty = HsStrict --- | Wrappers/Workser and representation following Unpack/Strictness +-- | Wrappers/Workers and representation following Unpack/Strictness -- decisions dataConArgRep :: Type @@ -820,7 +820,7 @@ Because then we'd get an infinite number of arguments. Here is a more complicated case: data S = MkS {-# UNPACK #-} !T Int data T = MkT {-# UNPACK #-} !S Int -Each of S and T must decide independendently whether to unpack +Each of S and T must decide independently whether to unpack and they had better not both say yes. So they must both say no. Also behave conservatively when there is no UNPACK pragma @@ -835,7 +835,7 @@ because Int is non-recursive. Note [Unpack equality predicates] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If we have a GADT with a contructor C :: (a~[b]) => b -> T a +If we have a GADT with a constructor C :: (a~[b]) => b -> T a we definitely want that equality predicate *unboxed* so that it takes no space at all. This is easily done: just give it an UNPACK pragma. The rest of the unpack/repack code does the @@ -993,7 +993,7 @@ mkFCallId dflags uniq fcall ty strict_sig = mkClosedStrictSig (replicate arity topDmd) topRes -- the call does not claim to be strict in its arguments, since they - -- may be lifted (foreign import prim) and the called code doen't + -- may be lifted (foreign import prim) and the called code doesn't -- necessarily force them. See Trac #11076. {- ************************************************************************ diff --git a/compiler/hsSyn/HsTypes.hs b/compiler/hsSyn/HsTypes.hs index f7883f24a4..ed4c3be44b 100644 --- a/compiler/hsSyn/HsTypes.hs +++ b/compiler/hsSyn/HsTypes.hs @@ -203,7 +203,7 @@ type LHsKind name = Located (HsKind name) -------------------------------------------------- -- LHsQTyVars -- The explicitly-quantified binders in a data/type declaration -SQua + type LHsTyVarBndr name = Located (HsTyVarBndr name) -- See Note [HsType binders] diff --git a/compiler/typecheck/TcTyDecls.hs b/compiler/typecheck/TcTyDecls.hs index eeecc93b2c..ab63e8c070 100644 --- a/compiler/typecheck/TcTyDecls.hs +++ b/compiler/typecheck/TcTyDecls.hs @@ -1007,9 +1007,9 @@ like sel :: T [a] -> a For naughty selectors we make a dummy binding sel = () -for naughty selectors, so that the later type-check will add them to the -environment, and they'll be exported. The function is never called, because -the tyepchecker spots the sel_naughty field. +so that the later type-check will add them to the environment, and they'll be +exported. The function is never called, because the typechecker spots the +sel_naughty field. Note [GADT record selectors] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -138,21 +138,14 @@ endif endif include mk/ways.mk -include mk/warnings.mk # (Optional) build-specific configuration include mk/custom-settings.mk -SRC_CC_OPTS += -Wall -SRC_HC_OPTS += -Wall -# Don't add -Werror to GhcStage1HcOpts, because otherwise validate may -# unnecessarily fail during the stage1 build when booting with an older -# compiler. -# It would be better to only exclude certain warnings from becoming errors -# (e.g. '-Werror -Wno-error=unused-imports -Wno-error=...'), but -Wno-error -# isn't supported yet (https://ghc.haskell.org/trac/ghc/wiki/Design/Warnings). -SRC_CC_OPTS += $(WERROR) -GhcStage2HcOpts += $(WERROR) -GhcLibHcOpts += $(WERROR) + +# The user can reset SRC_HC_OPTS from mk/build.mk. Since we try to append +# '-Wall' to it in mk/warnings.mk, we have to include mk/warnings.mk after +# mk/custom-settings.mk. +include mk/warnings.mk # ----------------------------------------------------------------------------- # Check for inconsistent settings, after reading mk/build.mk. diff --git a/mk/config.mk.in b/mk/config.mk.in index f9394429bf..967c7510a1 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -64,10 +64,36 @@ GhcHcOpts=-Rghc-timing # Extra options added to specific stages of the compiler bootstrap. # These are placed later on the command line, and may therefore # override options from $(GhcHcOpts). +# +# See Note [Stage number in build variables]. GhcStage1HcOpts= GhcStage2HcOpts=-O2 GhcStage3HcOpts=-O2 +# Disable -O2 optimization. Otherwise amount of generated C code +# makes things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.lhs') +# and sometimes not compile at all (powerpc64 overflows something +# on 'compiler/hsSyn/HsExpr.lhs'). +ifeq "$(GhcUnregisterised)" "YES" +GhcStage1HcOpts= +GhcStage2HcOpts= +GhcStage3HcOpts= +endif + +# Note [Stage number in build variables]. +# +# There are (unfortunately) two different naming schemes for build variables +# specific to a certain stage. +# +# * GhcStage1HcOpts/GhcStage2HcOpts/GhcStage3HcOpts: +# +# The stage number refers to the compiler stage being built (ghc library +# and executable). +# +# * SRC_HC_OPTS_STAGE$4 and SRC_HC_WARNING_OPTS_STAGE$4: +# +# The stage number refers to the compiler stage the options are passed to. + GhcDebugged=NO GhcDynamic=NO @@ -408,15 +434,20 @@ BIN_DIST_TAR_COMP = $(BIN_DIST_NAME)-$(TARGETPLATFORM).tar.$(TAR_COMP_EXT) # SRC_HC_OPTS += -H32m -O -# Disable -O2 optimization. Otherwise amount of generated C code -# makes things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.lhs') -# and sometimes not compile at all (powerpc64 overflows something -# on 'compiler/hsSyn/HsExpr.lhs'). -ifeq "$(GhcUnregisterised)" "YES" -GhcStage1HcOpts= -GhcStage2HcOpts= -GhcStage3HcOpts= -endif + +# See Note [Stage number in build variables]. +SRC_HC_OPTS_STAGE0 = +SRC_HC_OPTS_STAGE1 = +SRC_HC_OPTS_STAGE2 = + +# Warning supression flags. See mk/warnings.mk. +SRC_CC_WARNING_OPTS = +SRC_HC_WARNING_OPTS = + +# See Note [Stage number in build variables]. +SRC_HC_WARNING_OPTS_STAGE0 = +SRC_HC_WARNING_OPTS_STAGE1 = +SRC_HC_WARNING_OPTS_STAGE2 = # ----------------------------------------------------------------------------- # Names of programs in the GHC tree diff --git a/mk/warnings.mk b/mk/warnings.mk index 267aef6a36..d604f9ae2d 100644 --- a/mk/warnings.mk +++ b/mk/warnings.mk @@ -1,9 +1,16 @@ -SRC_CC_WARNING_OPTS = -SRC_HC_WARNING_OPTS = - +# See Note [Order of warning flags]. +SRC_CC_OPTS += -Wall $(WERROR) +SRC_HC_OPTS += -Wall +# Don't add -Werror to SRC_HC_OPTS_STAGE0 (or SRC_HC_OPTS), because otherwise +# validate may unnecessarily fail when booting with an older compiler. +# It would be better to only exclude certain warnings from becoming errors +# (e.g. '-Werror -Wno-error=unused-imports -Wno-error=...'), but -Wno-error +# isn't supported yet (https://ghc.haskell.org/trac/ghc/wiki/Design/Warnings). +# +# See Note [Stage number in build variables] in mk/config.mk.in. +SRC_HC_OPTS_STAGE1 += $(WERROR) +SRC_HC_OPTS_STAGE2 += $(WERROR) -##################### -# Warnings ifneq "$(GccIsClang)" "YES" @@ -25,10 +32,6 @@ SRC_CC_WARNING_OPTS += -Wno-unknown-pragmas endif -GhcStage1HcOpts += -fwarn-tabs -GhcStage2HcOpts += -fwarn-tabs - -utils/hpc_dist-install_EXTRA_HC_OPTS += -fwarn-tabs ###################################################################### @@ -113,3 +116,26 @@ GhcBootLibExtraHcOpts += -fno-warn-deprecated-flags # GhcLibExtraHcOpts += -fno-warn-tabs GhcBootLibExtraHcOpts += -fno-warn-tabs + + +# Note [Order of warning flags] +# +# In distdir-way-opts, build flags are added in the following order (this +# list is not exhaustive): +# +# * SRC_HC_OPTS(_STAGE$4) +# * ghc-options from .cabal files ($1_$2_HC_OPTS) +# * SRC_HC_WARNING_OPTS(_STAGE$4) +# +# Considerations: +# +# * Most .cabal files specify -Wall. But not all, and not all building we +# do relies on .cabal files. So we have to add -Wall ourselves somewhere. +# +# * Some .cabal also specify warning supression flags. Because -Wall +# overrides any warning supression flags that come before it, we have to +# make sure -Wall comes before any warning supression flags. So we add it +# to SRC_HC_OPTS. +# +# * Similarly, our own warning supression should come after the -Wall from +# the .cabal files, so we do *not* add them to SRC_HC_OPTS. diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk index 47f6f90237..92dbf346ff 100644 --- a/rules/distdir-way-opts.mk +++ b/rules/distdir-way-opts.mk @@ -19,7 +19,9 @@ define distdir-way-opts # args: $1 = dir, $2 = distdir, $3 = way, $4 = stage # $1 is the directory we're building in # $2 is the distdir (e.g. "dist", "dist-install" etc.) # $3 is the way (e.g. "v", "p", etc.) -# $4 is the stage ("1", "2", "3") +# $4 is the stage ("0", "1", "2") that the options are passed to +# See Note [Stage number in build variables] +# in mk/config.mk.in. # # ----------------------------- # The variables affecting Haskell compilations are as follows, including @@ -40,10 +42,22 @@ define distdir-way-opts # args: $1 = dir, $2 = distdir, $3 = way, $4 = stage # SRC_HC_OPTS source-tree-wide GHC options mk/config.mk.in # mk/build.mk # mk/validate.mk -# +# mk/warnings.mk +# +# SRC_HC_OPTS_STAGE$4 source-tree-wide GHC options, mk/config.mk.in +# supplied to the stage $4 mk/build.mk +# compiler only mk/validate.mk +# mk/warnings.mk +# # SRC_HC_WARNING_OPTS source-tree-wide GHC warning mk/config.mk.in # options mk/build.mk # mk/validate.mk +# mk/warnings.mk +# +# SRC_HC_WARNING_OPTS_STAGE$4 mk/config.mk.in +# source-tree-wide GHC warning mk/build.mk +# options, supplied to the mk/validate.mk +# stage $4 compiler only mk/warnings.mk # # EXTRA_HC_OPTS for supplying extra options on make EXTRA_HC_OPTS=... # the command line @@ -60,6 +74,7 @@ define distdir-way-opts # args: $1 = dir, $2 = distdir, $3 = way, $4 = stage # $1_$2_MORE_HC_OPTS GHC options for this dir/distdir ??? # # $1_$2_EXTRA_HC_OPTS GHC options for this dir/distdir mk/build.mk +# mk/warnings.mk # # $1_$2_HC_PKGCONF -package-db flag if necessary rules/package-config.mk # @@ -100,6 +115,7 @@ $1_$2_$3_MOST_HC_OPTS = \ $$(WAY_$3_HC_OPTS) \ $$(CONF_HC_OPTS) \ $$(SRC_HC_OPTS) \ + $$(SRC_HC_OPTS_STAGE$4) \ $$($1_HC_OPTS) \ $$($1_$2_HC_PKGCONF) \ $$(if $$($1_$2_PROG),, \ @@ -121,6 +137,7 @@ $1_$2_$3_MOST_HC_OPTS = \ $$($1_$2_$3_HC_OPTS) \ $$($$(basename $$(subst ./,,$$<))_HC_OPTS) \ $$(SRC_HC_WARNING_OPTS) \ + $$(SRC_HC_WARNING_OPTS_STAGE$4) \ $$(EXTRA_HC_OPTS) $1_$2_$3_MOST_DIR_HC_OPTS = \ diff --git a/utils/mkUserGuidePart/Main.hs b/utils/mkUserGuidePart/Main.hs index dd72c270d5..11283c0b95 100644 --- a/utils/mkUserGuidePart/Main.hs +++ b/utils/mkUserGuidePart/Main.hs @@ -76,11 +76,6 @@ flagsTable theFlags = inlineCode :: String -> ReST inlineCode s = "``" ++ s ++ "``" --- | Generate a ReST substitution definition. -substitution :: String -> ReST -> ReST -substitution substName content = - unlines [".. |" ++ substName ++ "| ", content] - heading :: Char -> String -> ReST heading chr title = unlines [ title |