diff options
author | CarrieMY <carrie.xmy@gmail.com> | 2021-10-04 21:03:38 +0800 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-08 18:11:08 -0400 |
commit | 816d256114858d01c99503c10e3be86ecdb15173 (patch) | |
tree | 44ded885646734cbd185304eaaa0f855aa6df6e7 | |
parent | 1f160cd9c82c8cd21fbc733dc18c86a2abe3459f (diff) | |
download | haskell-816d256114858d01c99503c10e3be86ecdb15173.tar.gz |
Fix -E -fno-code undesirable interactions #20439
-rw-r--r-- | compiler/GHC/Driver/Pipeline.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/driver/T20439.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/driver/all.T | 3 |
3 files changed, 8 insertions, 2 deletions
diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs index 8362af9423..202043665c 100644 --- a/compiler/GHC/Driver/Pipeline.hs +++ b/compiler/GHC/Driver/Pipeline.hs @@ -530,11 +530,13 @@ compileFile hsc_env stop_phase (src, _mb_phase) = do dflags = hsc_dflags hsc_env mb_o_file = outputFile dflags ghc_link = ghcLink dflags -- Set by -c or -no-link - + notStopPreprocess | StopPreprocess <- stop_phase = False + | _ <- stop_phase = True -- When linking, the -o argument refers to the linker's output. -- otherwise, we use it as the name for the pipeline's output. output - | NoBackend <- backend dflags = NoOutputFile + | NoBackend <- backend dflags, notStopPreprocess = NoOutputFile + -- avoid -E -fno-code undesirable interactions. see #20439 | NoStop <- stop_phase, not (isNoLink ghc_link) = Persistent -- -o foo applies to linker | isJust mb_o_file = SpecificFile diff --git a/testsuite/tests/driver/T20439.stdout b/testsuite/tests/driver/T20439.stdout new file mode 100644 index 0000000000..810c461699 --- /dev/null +++ b/testsuite/tests/driver/T20439.stdout @@ -0,0 +1 @@ + `Foo.hspp': diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T index 0e6eb594b1..f9174a6015 100644 --- a/testsuite/tests/driver/all.T +++ b/testsuite/tests/driver/all.T @@ -294,3 +294,6 @@ test('OneShotTH', normal, makefile_test, []) test('T17481', normal, makefile_test, []) test('T20084', normal, makefile_test, []) test('RunMode', extra_files(['RunMode/Test.hs']), run_command, ['{compiler} --run -iRunMode/ -ignore-dot-ghci RunMode.hs -- hello']) +test('T20439', normal, run_command, + ['echo "module Foo where" >> Foo.hs && \ + {compiler} -E -fno-code -XCPP -v Foo.hs 2>&1 | grep "Copying" | sed "s/.*to//" ']) |