diff options
author | Zubin Duggal <zubin.duggal@gmail.com> | 2021-11-19 14:21:58 +0530 |
---|---|---|
committer | Zubin Duggal <zubin.duggal@gmail.com> | 2022-03-30 17:01:11 +0530 |
commit | 079be2c88032e2551c356bee273c301b29281135 (patch) | |
tree | c4dfcec53f77ea93d78563004ad3b38475b60ddb /compiler/GHC/Driver/Pipeline/Execute.hs | |
parent | 21894a6318e0daffa0e34041855c3c73ad1f5b6f (diff) | |
download | haskell-wip/parse-errs.tar.gz |
Add warnings for file header pragmas that appear in the body of a module (#20385)wip/parse-errs
Once we are done parsing the header of a module to obtain the options, we
look through the rest of the tokens in order to determine if they contain any
misplaced file header pragmas that would usually be ignored, potentially
resulting in bad error messages.
The warnings are reported immediately so that later errors don't shadow
over potentially helpful warnings.
Metric Increase:
T13719
Diffstat (limited to 'compiler/GHC/Driver/Pipeline/Execute.hs')
-rw-r--r-- | compiler/GHC/Driver/Pipeline/Execute.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/Driver/Pipeline/Execute.hs b/compiler/GHC/Driver/Pipeline/Execute.hs index 97eeb58260..baf4071d51 100644 --- a/compiler/GHC/Driver/Pipeline/Execute.hs +++ b/compiler/GHC/Driver/Pipeline/Execute.hs @@ -571,15 +571,15 @@ runUnlitPhase hsc_env input_fn output_fn = do return output_fn -getFileArgs :: HscEnv -> FilePath -> IO ((DynFlags, [Warn])) +getFileArgs :: HscEnv -> FilePath -> IO ((DynFlags, Messages PsMessage, [Warn])) getFileArgs hsc_env input_fn = do let dflags0 = hsc_dflags hsc_env parser_opts = initParserOpts dflags0 - src_opts <- getOptionsFromFile parser_opts input_fn + (warns0, src_opts) <- getOptionsFromFile parser_opts input_fn (dflags1, unhandled_flags, warns) <- parseDynamicFilePragma dflags0 src_opts checkProcessArgsResult unhandled_flags - return (dflags1, warns) + return (dflags1, warns0, warns) runCppPhase :: HscEnv -> FilePath -> FilePath -> IO FilePath runCppPhase hsc_env input_fn output_fn = do |