summaryrefslogtreecommitdiff
path: root/compiler/main/CmdLineParser.hs
Commit message (Collapse)AuthorAgeFilesLines
* Remove some redundant definitions/constraintsHerbert Valerio Riedel2015-12-311-2/+0
| | | | | | Starting with GHC 7.10 and base-4.8, `Monad` implies `Applicative`, which allows to simplify some definitions to exploit the superclass relationship. This a first refactoring to that end.
* Drop pre-AMP compatibility CPP conditionalsHerbert Valerio Riedel2015-12-311-3/+0
| | | | | | | | | | | | Since GHC 8.1/8.2 only needs to be bootstrap-able by GHC 7.10 and GHC 8.0 (and GHC 8.2), we can now finally drop all that pre-AMP compatibility CPP-mess for good! Reviewers: austin, goldfire, bgamari Subscribers: goldfire, thomie, erikd Differential Revision: https://phabricator.haskell.org/D1724
* Make Monad/Applicative instances MRP-friendlyHerbert Valerio Riedel2015-10-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | This patch refactors pure/(*>) and return/(>>) in MRP-friendly way, i.e. such that the explicit definitions for `return` and `(>>)` match the MRP-style default-implementation, i.e. return = pure and (>>) = (*>) This way, e.g. all `return = pure` definitions can easily be grepped and removed in GHC 8.1; Test Plan: Harbormaster Reviewers: goldfire, alanz, bgamari, quchen, austin Reviewed By: quchen, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1312
* Dont call unsafeGlobalDynFlags if it is not setThomas Miedema2015-03-161-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | Parsing of static and mode flags happens before any session is started, i.e., before the first call to 'GHC.withGhc'. Therefore, to report errors for invalid usage of these two types of flags, we can not call any function that needs DynFlags, as there are no DynFlags available yet (unsafeGlobalDynFlags is not set either). So we always print "on the commandline" as the location, which is true except for Api users, which is probably ok. When reporting errors for invalid usage of dynamic flags we /can/ make use of DynFlags, and we do so explicitly in DynFlags.parseDynamicFlagsFull. Before, we called unsafeGlobalDynFlags when an invalid (combination of) flag(s) was given on the commandline, resulting in panics (#9963). This regression was introduced in 1d6124de. Also rename showSDocSimple to showSDocUnsafe, to hopefully prevent this from happening again. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D730 GHC Trac Issues: #9963
* Don't hardcode the name "ghc" in versionedAppDirEdsko de Vries2015-01-161-1/+1
| | | | | | | | | | Reviewers: austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D618
* Package environmentsEdsko de Vries2015-01-131-3/+5
| | | | | | | | | | | | Summary: Package environments are files with package IDs that indicate which packages should be visible; see entry in user guide for details. Reviewers: duncan, austin Reviewed By: duncan, austin Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D558
* Remove redundant constraints in the compiler itself, found by ↵Simon Peyton Jones2015-01-061-1/+1
| | | | -fwarn-redundant-constraints
* msse flag handling: fix trac issue #9777Denis Redozubov2014-12-051-12/+0
| | | | | | | | | | | | | | | | | | | | | Summary: Signed-off-by: Denis Redozubov <denis.redozubov@gmail.com> SSE version handled by different dynamic flags Signed-off-by: Denis Redozubov <denis.redozubov@gmail.com> Test Plan: validate Reviewers: austin, jstolarek Reviewed By: austin, jstolarek Subscribers: kolmodin, thomie, carter Differential Revision: https://phabricator.haskell.org/D504 GHC Trac Issues: #9777
* ghc: allow --show-options and --interactive togetherLennart Kolmodin2014-11-211-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously 'ghc --show-options' showed all options that GHC can possibly accept. With this patch, it'll only show the options that have effect in non-interactive modes. This change also adds support for using 'ghc --interactive --show-options' which previously was disallowed. This command will show all options that have effect in the interactive mode. The CmdLineParser is updated to know about the GHC modes, and then each flag is annotated with which mode it has effect. This fixes #9259. Test Plan: Try out --show-options with --interactive on the command line. With and without --interactive should give different results. Run the test suite, mode001 has been updated to verify this new flag combination. Reviewers: austin, jstolarek Reviewed By: austin, jstolarek Subscribers: jstolarek, thomie, carter, simonmar Differential Revision: https://phabricator.haskell.org/D337 GHC Trac Issues: #9259
* compiler/main: fixes #9776Carlos Tomé2014-11-191-1/+2
| | | | | | | | | | | | | | Test Plan: test T9776 under tests/driver Reviewers: jstolarek, austin Reviewed By: jstolarek, austin Subscribers: jstolarek, thomie, carter Differential Revision: https://phabricator.haskell.org/D503 GHC Trac Issues: #9776
* Make Applicative a superclass of MonadAustin Seipp2014-09-091-1/+2
| | | | | | | | | | | | | | | | | | | | | Summary: This includes pretty much all the changes needed to make `Applicative` a superclass of `Monad` finally. There's mostly reshuffling in the interests of avoid orphans and boot files, but luckily we can resolve all of them, pretty much. The only catch was that Alternative/MonadPlus also had to go into Prelude to avoid this. As a result, we must update the hsc2hs and haddock submodules. Signed-off-by: Austin Seipp <austin@well-typed.com> Test Plan: Build things, they might not explode horribly. Reviewers: hvr, simonmar Subscribers: simonmar Differential Revision: https://phabricator.haskell.org/D13
* Add LANGUAGE pragmas to compiler/ source filesHerbert Valerio Riedel2014-05-151-0/+2
| | | | | | | | | | | | | | | | | | In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been reorganized, while following the convention, to - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before any `{-# OPTIONS_GHC #-}`-lines. - Moreover, if the list of language extensions fit into a single `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each individual language extension. In both cases, try to keep the enumeration alphabetically ordered. (The latter layout is preferable as it's more diff-friendly) While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
* Catch potential garbage after -msse.Geoffrey Mainland2013-09-231-1/+2
|
* Enable -msse to be specified by itself.Geoffrey Mainland2013-09-221-1/+1
| | | | This sets the SSE "version" to 1.0.
* Fix AMP warnings.Austin Seipp2013-09-111-0/+17
| | | | | Authored-by: David Luposchainsky <dluposchainsky@gmail.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Clean up -msse flag handlingJohan Tibell2013-01-171-0/+10
| | | | | We know have a single flag that takes a version number, instead of one flag per SSE version.
* Make the opt_UF_* static flags dynamicIan Lynagh2012-10-091-0/+10
| | | | | | | | I also removed the default values from the "Discounts and thresholds" note: most of them were no longer up-to-date. Along the way I added FloatSuffix to the argument parser, analogous to IntSuffix.
* Fix ambiguous flag resolution (#7138)Paolo Capriotti2012-08-131-5/+7
| | | | | | | Pick longest flag when more than one matches in findArg. This fixes an issue where -ignore-dot-ghci wasn't honored, because the flag was parsed as "-i gnore-dot-ghci".
* Tweak the way UsageErrors are constructedIan Lynagh2012-06-131-1/+2
| | | | | Using 'unlines' meant that we get a trailing newline, which gave different output.
* Make it possible to show SrcSpans without going via DocIan Lynagh2012-06-111-2/+1
| | | | | | | | This shouldn't be any slower; the FilePaths were already going via String so that we could normalise them. This means that very early on, when printing flag parsing errors, we can do so without having a DynFlags yet.
* Implememt -fdefer-type-errors (Trac #5624)Simon Peyton Jones2012-01-121-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the idea of deferring (most) type errors to runtime, instead emitting only a warning at compile time. The basic idea is very simple: * The on-the-fly unifier in TcUnify never fails; instead if it gets stuck it emits a constraint. * The constraint solver tries to solve the constraints (and is entirely unchanged, hooray). * The remaining, unsolved constraints (if any) are passed to TcErrors.reportUnsolved. With -fdefer-type-errors, instead of emitting an error message, TcErrors emits a warning, AND emits a binding for the constraint witness, binding it to (error "the error message"), via the new form of evidence TcEvidence.EvDelayedError. So, when the program is run, when (and only when) that witness is needed, the program will crash with the exact same error message that would have been given at compile time. Simple really. But, needless to say, the exercise forced me into some major refactoring. * TcErrors is almost entirely rewritten * EvVarX and WantedEvVar have gone away entirely * ErrUtils is changed a bit: * New Severity field in ErrMsg * Renamed the type Message to MsgDoc (this change touches a lot of files trivially) * One minor change is that in the constraint solver we try NOT to combine insoluble constraints, like Int~Bool, else all such type errors get combined together and result in only one error message! * I moved some definitions from TcSMonad to TcRnTypes, where they seem to belong more
* Formmatting fixes to CmdLineParserDavid Terei2011-11-011-89/+93
|
* Fix safe haskell warnings to include src locationsDavid Terei2011-10-171-1/+4
|
* Formatting wibbles.David Terei2011-10-171-4/+4
|
* Remove cruft code from old Safe Haskell implementation methodDavid Terei2011-10-171-80/+37
|
* SafeHaskell: Try to be consistent in naming.David Terei2011-06-291-3/+3
|
* SafeHaskell: Disable certain ghc extensions in Safe.David Terei2011-06-171-31/+79
| | | | | | | | | | This patch disables the use of some GHC extensions in Safe mode and also the use of certain flags. Some are disabled completely while others are only allowed on the command line and not in source PRAGMAS. We also check that Safe imports are indeed importing a Safe or Trustworthy module.
* Start support for coloured SDoc output.Thomas Schilling2011-04-071-1/+1
| | | | | | | The SDoc type now passes around an abstract SDocContext rather than just a PprStyle which required touching a few more files. This should also make it easier to integrate DynFlags passing, so that we can get rid of global variables.
* Refactor the command-line argument parsing (again)simonpj@microsoft.com2010-08-161-61/+110
| | | | | | | | | | | This change allows the client of CmdLineParser a bit more flexibility, by giving him an arbitrary computation (not just a deprecation message) for each flag. There are several clients, so there are lots of boilerplate changes. Immediate motivation: if RTS is not profiled, we want to make Template Haskell illegal. That wasn't with the old setup.
* Fix panic when running "ghc -H"; trac #3364Ian Lynagh2010-06-241-1/+1
| | | | | | The problem is that showing SDoc's looks at the static flags global variables, but those are panics while we are parsing the static flags. We work around this by explicitly using a fixed prettyprinter style.
* Give a better deprecated message for INCLUDE pragmas; fixes #3933Ian Lynagh2010-05-061-1/+5
| | | | | We now have a DeprecatedFullText constructor, so we can override the "-#include is deprecated: " part of the warning.
* Remove maybePrefixMatch, using stripPrefix insteadIan Lynagh2009-07-091-1/+3
| | | | | We already require GHC 6.8 to build, and that included stripPrefix in Data.List.
* Give locations of flag warnings/errorsIan Lynagh2008-08-261-12/+24
|
* Tweak the deprecated flags warningIan Lynagh2008-06-141-1/+1
|
* Allow flags to be marked as deprecatedIan Lynagh2008-06-141-18/+29
|
* Use a proper datatype, rather than pairs, for flagsIan Lynagh2008-06-141-7/+13
|
* Don't import FastString in HsVersions.hIan Lynagh2008-03-291-2/+0
| | | | Modules that need it import it themselves instead.
* Fix warnings in main/CmdLineParserIan Lynagh2008-01-211-87/+85
|
* Move OPTIONS pragmas above commentsIan Lynagh2007-09-211-7/+7
| | | | Fixes building with -Werror (i.e. validate) and GHC < 6.6
* Make various assertions work when !DEBUGIan Lynagh2007-09-081-3/+1
|
* Fix CodingStyle#Warnings URLsIan Lynagh2007-09-041-1/+1
|
* Use OPTIONS rather than OPTIONS_GHC for pragmasIan Lynagh2007-09-031-2/+2
| | | | | | | Older GHCs can't parse OPTIONS_GHC. This also changes the URL referenced for the -w options from WorkingConventions#Warnings to CodingStyle#Warnings for the compiler modules.
* Add {-# OPTIONS_GHC -w #-} and some blurb to all compiler modulesIan Lynagh2007-09-011-0/+7
|
* Use -X for language extensionssimonpj@microsoft.com2007-06-201-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've often talked about having a separate flag for language extensions, and now we have one. You can say -XImplicitParams -X=ImplicitParams -Ximplicit-params as you like. These replace the "-f" flags with similar names (though the -f prefix will serve as a synonym for -X for a while). There's an optional "=", and the flag is normalised by removing hyphens and lower-casing, so all the above variants mean the same thing. The nomenclature is intended to match the LANGUAGE pramgas, which are defined by Cabal. So you can also say {-# LANGUAGE ImplicitParams #-} But Cabal doesn't have as many language options as GHC does, so the -X things are a superset of the LANGUAGE things. The optional "=" applies to all flags that take an argument, so you can, for example, say -pgmL=/etc/foo I hope that's ok. (It's an unforced change; just fitted in.) I hope we'll add more -X flags, to replace the portmanteau -fglasgow-exts which does everything! I have updated the manual, but doubtless missed something.
* Log-message for: Improve command-line parser (add OptIntSuffix); make ↵simonpj@microsoft.com2007-01-111-1/+1
| | | | | | | | | | | | | | | | -fliberate-case-threshold dynamic (Alas, Darcs failed to record my log-message for the above patch, so this patch is an attempt to add the log message retrospectively.) Parsing options numeric arguments, such as -fliberate-case-threshold=30 for dynamic flags wasn't being handled well. I elaborated the command-line parser to have a new constructor, OptIntSuffix, for this case, and did the consequential changes. This patch also makes the -fliberate-case-threshold flag into a dynamic flag.
* Improve command-line parser (add OptIntSuffix); make ↵simonpj@microsoft.com2007-01-111-10/+12
| | | | -fliberate-case-threshold dynamic
* Make -fcontext-stack into a dynamic flagsimonpj@microsoft.com2006-07-271-41/+51
| | | | | | | | | This allows you to put -fcontext-stack into an options pragma, as requested by Trac #829 While I was at it, I added OptIntPrefix to the forms allowed in CmdLineParser.
* Reorganisation of the source treeSimon Marlow2006-04-071-0/+139
Most of the other users of the fptools build system have migrated to Cabal, and with the move to darcs we can now flatten the source tree without losing history, so here goes. The main change is that the ghc/ subdir is gone, and most of what it contained is now at the top level. The build system now makes no pretense at being multi-project, it is just the GHC build system. No doubt this will break many things, and there will be a period of instability while we fix the dependencies. A straightforward build should work, but I haven't yet fixed binary/source distributions. Changes to the Building Guide will follow, too.