Commit 0f5e104c authored by Ian Lynagh's avatar Ian Lynagh
Browse files

More commandline flag improvements

* Allow -ffoo flags to be deprecated
* Mark some -ffoo flags as deprecated
* Avoid using deprecated flags in error messages, in the build system, etc
* Add a flag to en/disable the deprecated flag warning
parent 1363f412
......@@ -96,7 +96,13 @@ SRC_CC_OPTS += -I$(FPTOOLS_TOP)/libraries/base/cbits -I$(FPTOOLS_TOP)/libraries/
# Make the #includes in the stubs independent of the current location
SRC_HC_OPTS += -I$(FPTOOLS_TOP)/libraries
SRC_HC_OPTS += -fglasgow-exts -fforce-recomp
SRC_HC_OPTS += -fglasgow-exts
ifeq "$(ghc_ge_609)" "YES"
SRC_HC_OPTS += -fforce-recomp
else
SRC_HC_OPTS += -no-recomp
endif
ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
Compat/Directory_HC_OPTS += -\#include shlobj.h
......
......@@ -568,9 +568,13 @@ SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
# -----------------------------------------------------------------------------
# Haskell compilations
SRC_HC_OPTS += \
-cpp -fglasgow-exts -fno-generics -Rghc-timing \
-I. -Iparser -Iutil
SRC_HC_OPTS += -cpp -fglasgow-exts -Rghc-timing -I. -Iparser -Iutil
ifeq "$(ghc_ge_609)" "NO"
SRC_HC_OPTS += -fno-generics
else
SRC_HC_OPTS += -XNoGenerics
endif
# Omitted: -I$(GHC_INCLUDE_DIR)
# We should have -I$(GHC_INCLUDE_DIR) in SRC_HC_OPTS,
......
......@@ -23,7 +23,7 @@ SRC_HC_OPTS += -Wall
SRC_HC_OPTS += -package ghc
SRC_HC_OPTS += -Istage$(stage)
SRC_HC_OPTS += \
-cpp -fglasgow-exts -fno-generics -Rghc-timing \
-cpp -fglasgow-exts -XNoGenerics -Rghc-timing \
-I. -IcodeGen -InativeGen -Iparser
SRC_HC_OPTS += $(GhcHcOpts) $(GhcStage$(stage)HcOpts)
ifeq "$(TargetOS_CPP)" "openbsd"
......
{-# LANGUAGE MultiParamTypeClasses, ScopedTypeVariables #-}
{-# OPTIONS -fno-allow-overlapping-instances -fglasgow-exts #-}
{-# OPTIONS -fglasgow-exts #-}
-- -fglagow-exts for kind signatures
module ZipDataflow
......
......@@ -1406,12 +1406,12 @@ setCmd ""
vcat (text "other dynamic, non-language, flag settings:"
:map (flagSetting dflags) nonLanguageDynFlags)
))
where flagSetting dflags (str,f)
where flagSetting dflags (str, f, _)
| dopt f dflags = text " " <> text "-f" <> text str
| otherwise = text " " <> text "-fno-" <> text str
(ghciFlags,others) = partition (\(_,f)->f `elem` flags)
(ghciFlags,others) = partition (\(_, f, _) -> f `elem` flags)
DynFlags.fFlags
nonLanguageDynFlags = filterOut (\(_,f) -> f `elem` languageOptions)
nonLanguageDynFlags = filterOut (\(_, f, _) -> f `elem` languageOptions)
others
flags = [Opt_PrintExplicitForalls
,Opt_PrintBindResult
......@@ -1689,7 +1689,7 @@ completeWord w start end = do
(s,r') = span isBreak r
in (n,w):words' isBreak (n+length w+length s) r'
-- In a Haskell expression we want to parse 'a-b' as three words
-- where a compiler flag (ie. -fno-monomorphism-restriction) should
-- where a compiler flag (e.g. -ddump-simpl) should
-- only be a single word.
selectWord [] = (0,w)
selectWord ((offset,x):xs)
......
This diff is collapsed.
......@@ -176,8 +176,13 @@ printBagOfWarnings dflags bag_of_warns
GT -> False
handleFlagWarnings :: DynFlags -> [String] -> IO ()
handleFlagWarnings _ [] = return ()
handleFlagWarnings dflags warns
= when (dopt Opt_WarnDeprecatedFlags dflags)
(handleFlagWarnings' dflags warns)
handleFlagWarnings' :: DynFlags -> [String] -> IO ()
handleFlagWarnings' _ [] = return ()
handleFlagWarnings' dflags warns
= do -- It would be nicer if warns :: [Message], but that has circular
-- import problems.
let warns' = map text warns
......
......@@ -649,7 +649,7 @@ way_details =
, "-package concurrent" ]),
(WayNDP, Way "ndp" False "Nested data parallelism"
[ "-fparr"
[ "-XParr"
, "-fvectorise"]),
(WayUser_a, Way "a" False "User way 'a'" ["$WAY_a_REAL_OPTS"]),
......
......@@ -504,8 +504,8 @@ data Token
| ITvocurly
| ITvccurly
| ITobrack
| ITopabrack -- [:, for parallel arrays with -fparr
| ITcpabrack -- :], for parallel arrays with -fparr
| ITopabrack -- [:, for parallel arrays with -XParr
| ITcpabrack -- :], for parallel arrays with -XParr
| ITcbrack
| IToparen
| ITcparen
......@@ -1550,7 +1550,7 @@ getLexState :: P Int
getLexState = P $ \s@PState{ lex_state=ls:_ } -> POk s ls
-- for reasons of efficiency, flags indicating language extensions (eg,
-- -fglasgow-exts or -fparr) are represented by a bitmap stored in an unboxed
-- -fglasgow-exts or -XParr) are represented by a bitmap stored in an unboxed
-- integer
genericsBit, ffiBit, parrBit :: Int
......
......@@ -926,7 +926,7 @@ isModuleExported implicit_prelude mod (GRE { gre_name = name, gre_prov = prov })
-- They just clutter up the environment (esp tuples), and the parser
-- will generate Exact RdrNames for them, so the cluttered
-- envt is no use. To avoid doing this filter all the time,
-- we use -fno-implicit-prelude as a clue that the filter is
-- we use -XNoImplicitPrelude as a clue that the filter is
-- worth while. Really, it's only useful for GHC.Base and GHC.Tuple.
--
-- It's worth doing because it makes the environment smaller for
......@@ -1038,7 +1038,7 @@ a) It might be a WiredInName; in that case we may not load
its interface (although we could).
b) It might be GHC.Real.fromRational, or GHC.Num.fromInteger
These are seen as "used" by the renamer (if -fno-implicit-prelude)
These are seen as "used" by the renamer (if -XNoImplicitPrelude)
is on), but the typechecker may discard their uses
if in fact the in-scope fromRational is GHC.Read.fromRational,
(see tcPat.tcOverloadedLit), and the typechecker sees that the type
......
......@@ -447,7 +447,7 @@ badDotDot str = ptext (sLit "You cannot use `..' in record") <+> text str
badPun :: Located RdrName -> SDoc
badPun fld = vcat [ptext (sLit "Illegal use of punning for field") <+> quotes (ppr fld),
ptext (sLit "Use -XRecordPuns to permit this")]
ptext (sLit "Use -XNamedFieldPuns to permit this")]
-- wrappers
......
......@@ -401,7 +401,7 @@ newMethodFromName :: InstOrigin -> BoxyRhoType -> Name -> TcM TcId
newMethodFromName origin ty name = do
id <- tcLookupId name
-- Use tcLookupId not tcLookupGlobalId; the method is almost
-- always a class op, but with -fno-implicit-prelude GHC is
-- always a class op, but with -XNoImplicitPrelude GHC is
-- meant to find whatever thing is in scope, and that may
-- be an ordinary function.
loc <- getInstLoc origin
......@@ -862,7 +862,7 @@ tcGetInstEnvs = do { eps <- getEps; env <- getGblEnv;
%* *
%************************************************************************
Suppose we are doing the -fno-implicit-prelude thing, and we encounter
Suppose we are doing the -XNoImplicitPrelude thing, and we encounter
a do-expression. We have to find (>>) in the current environment, which is
done by the rename. Then we have to check that it has the same type as
Control.Monad.(>>). Or, more precisely, a compatible type. One 'customer' had
......
......@@ -630,14 +630,14 @@ tcLhs sig_fn (FunBind { fun_id = L nm_loc name, fun_infix = inf, fun_matches = m
tcLhs sig_fn (PatBind { pat_lhs = pat, pat_rhs = grhss })
= do { mb_sigs <- mapM (tcInstSig_maybe sig_fn) names
; mono_pat_binds <- doptM Opt_MonoPatBinds
-- With -fmono-pat-binds, we do no generalisation of pattern bindings
-- With -XMonoPatBinds, we do no generalisation of pattern bindings
-- But the signature can still be polymoprhic!
-- data T = MkT (forall a. a->a)
-- x :: forall a. a->a
-- MkT x = <rhs>
-- The function get_sig_ty decides whether the pattern-bound variables
-- should have exactly the type in the type signature (-fmono-pat-binds),
-- or the instantiated version (-fmono-pat-binds)
-- should have exactly the type in the type signature (-XMonoPatBinds),
-- or the instantiated version (-XMonoPatBinds)
; let nm_sig_prs = names `zip` mb_sigs
get_sig_ty | mono_pat_binds = idType . sig_id
......
......@@ -794,7 +794,7 @@ notSimple inst_tys
notGeneric :: TyCon -> SDoc
notGeneric tycon
= vcat [ptext (sLit "because the instance type constructor") <+> quotes (ppr tycon) <+>
ptext (sLit "was not compiled with -fgenerics")]
ptext (sLit "was not compiled with -XGenerics")]
badGenericInstanceType :: LHsBinds Name -> SDoc
badGenericInstanceType binds
......
......@@ -971,7 +971,7 @@ inferInstanceContexts oflag infer_specs
iterate_deriv :: Int -> [ThetaType] -> TcM [DerivSpec]
iterate_deriv n current_solns
| n > 20 -- Looks as if we are in an infinite loop
-- This can happen if we have -fallow-undecidable-instances
-- This can happen if we have -XUndecidableInstances
-- (See TcSimplify.tcSimplifyDeriv.)
= pprPanic "solveDerivEqns: probable loop"
(vcat (map pprDerivSpec infer_specs) $$ ppr current_solns)
......
......@@ -1595,7 +1595,7 @@ predUndecErr pred msg = sep [msg,
nomoreMsg, smallerMsg, undecidableMsg :: SDoc
nomoreMsg = ptext (sLit "Variable occurs more often in a constraint than in the instance head")
smallerMsg = ptext (sLit "Constraint is no smaller than the instance head")
undecidableMsg = ptext (sLit "Use -fallow-undecidable-instances to permit this")
undecidableMsg = ptext (sLit "Use -XUndecidableInstances to permit this")
\end{code}
......@@ -1635,7 +1635,7 @@ should have only type-variable constraints.
Here is another example:
data Fix f = In (f (Fix f)) deriving( Eq )
Here, if we are prepared to allow -fallow-undecidable-instances we
Here, if we are prepared to allow -XUndecidableInstances we
could derive the instance
instance Eq (f (Fix f)) => Eq (Fix f)
but this is so delicate that I don't think it should happen inside
......@@ -1672,7 +1672,7 @@ validDerivPred _ = False
\begin{code}
-- Check that a "type instance" is well-formed (which includes decidability
-- unless -fallow-undecidable-instances is given).
-- unless -XUndecidableInstances is given).
--
checkValidTypeInst :: [Type] -> Type -> TcM ()
checkValidTypeInst typats rhs
......
......@@ -2670,7 +2670,7 @@ disambiguate doc interactive dflags insts
| extended_defaulting = any isInteractiveClass clss
| otherwise = all is_std_class clss && (any is_num_class clss)
-- In interactive mode, or with -fextended-default-rules,
-- In interactive mode, or with -XExtendedDefaultRules,
-- we default Show a to Show () to avoid graututious errors on "show []"
isInteractiveClass cls
= is_num_class cls || (classKey cls `elem` [showClassKey, eqClassKey, ordClassKey])
......@@ -2736,7 +2736,7 @@ getDefaultTys extended_deflts ovl_strings
Note [Default unitTy]
~~~~~~~~~~~~~~~~~~~~~
In interative mode (or with -fextended-default-rules) we add () as the first type we
In interative mode (or with -XExtendedDefaultRules) we add () as the first type we
try when defaulting. This has very little real impact, except in the following case.
Consider:
Text.Printf.printf "hello"
......@@ -2962,7 +2962,7 @@ report_no_instances tidy_env mb_what insts
ASSERT( not (null unifiers) )
parens (vcat [ptext (sLit "The choice depends on the instantiation of") <+>
quotes (pprWithCommas ppr (varSetElems (tyVarsOfInst dict))),
ptext (sLit "To pick the first instance above, use -fallow-incoherent-instances"),
ptext (sLit "To pick the first instance above, use -XIncoherentInstances"),
ptext (sLit "when compiling the other instance declarations")])]
where
ispecs = [ispec | (ispec, _) <- matches]
......@@ -3061,8 +3061,8 @@ monomorphism_fix dflags
= ptext (sLit "Probable fix:") <+> vcat
[ptext (sLit "give these definition(s) an explicit type signature"),
if dopt Opt_MonomorphismRestriction dflags
then ptext (sLit "or use -fno-monomorphism-restriction")
else empty] -- Only suggest adding "-fno-monomorphism-restriction"
then ptext (sLit "or use -XNoMonomorphismRestriction")
else empty] -- Only suggest adding "-XNoMonomorphismRestriction"
-- if it is not already set!
warnDefault :: [(Inst, Class, Var)] -> Type -> TcM ()
......
......@@ -11,7 +11,8 @@ Basically, the things need to be in class @Uniquable@, and we use the
@getUnique@ method to grab their @Uniques@.
\begin{code}
{-# OPTIONS -Wall -fno-warn-name-shadowing -Werror -fallow-undecidable-instances #-}
{-# OPTIONS -Wall -fno-warn-name-shadowing -Werror #-}
{-# LANGUAGE UndecidableInstances #-}
module LazyUniqFM (
UniqFM, -- abstract type
......
......@@ -32,8 +32,8 @@
<h2>More Sugar: Special Syntax for Array Comprehensions</h2>
<p>
The option <code>-fparr</code>, which is a dynamic hsc option that can
be reversed with <code>-fno-parr</code>, enables special syntax for
The option <code>-XParr</code>, which is a dynamic hsc option that can
be reversed with <code>-XNoParr</code>, enables special syntax for
parallel arrays, which is not essential to using parallel arrays, but
makes for significantly more concise programs. The switch works by
making the lexical analyser (located in <a
......@@ -326,7 +326,7 @@ mapFilterP :: (a -> Maybe b) -> [:a:] -> [:b:]</pre>
flattening (just like profiling does), there is a <em>compiler way</em>
<code>"ndp"</code>, which can be selected using the way option code
<code>-ndp</code>. This option will automagically select
<code>-fparr</code> and <code>-fflatten</code>.
<code>-XParr</code> and <code>-fflatten</code>.
<h4><code>FlattenMonad</code></h4>
<p>
......
......@@ -98,7 +98,7 @@ main = do args &lt;- getArgs
<para>GHC's typechecker makes all pattern bindings monomorphic
by default; this behaviour can be disabled with
<option>-fno-mono-pat-binds</option>. See <xref
<option>-XNoMonoPatBinds</option>. See <xref
linkend="options-language" />.</para>
</sect3>
......
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