[commit: ghc] master: Change which files --make thinks are 'Haskellish' (#10220) (7cec6c7)

git at git.haskell.org git at git.haskell.org
Wed Apr 1 17:25:10 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7cec6c7b2973b34c18da1c74c87cead33bb1bfd7/ghc

>---------------------------------------------------------------

commit 7cec6c7b2973b34c18da1c74c87cead33bb1bfd7
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Wed Apr 1 19:22:28 2015 +0200

    Change which files --make thinks are 'Haskellish' (#10220)
    
    `.hspp` and `.hscpp` are haskell files that have already been preprocessed.
    
    Treat `.hspp` and `.hscpp` as Haskellish sources again, as they were before
    commit a10e1990. This way, ghc --make will load their imports.
    
    Make sure that `.cmm` and `.cmmcpp` are still not treated as Haskellish,
    by moving them out of `haskell_src_suffixes` (but still keeping them in
    haskellish_suffixes, though I'm not sure what the purpose of that group
    is).
    
    Reviewed By: austin
    
    Differential Revision: https://phabricator.haskell.org/D778


>---------------------------------------------------------------

7cec6c7b2973b34c18da1c74c87cead33bb1bfd7
 compiler/main/DriverPhases.hs      | 7 +++++--
 ghc/Main.hs                        | 2 +-
 testsuite/tests/driver/T10220.hspp | 2 ++
 testsuite/tests/driver/T10220B.hs  | 1 +
 testsuite/tests/driver/all.T       | 4 ++++
 5 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs
index e3aaf69..9d11993 100644
--- a/compiler/main/DriverPhases.hs
+++ b/compiler/main/DriverPhases.hs
@@ -279,11 +279,14 @@ phaseInputExt StopLn              = "o"
 haskellish_src_suffixes, haskellish_suffixes, cish_suffixes,
     haskellish_user_src_suffixes, haskellish_sig_suffixes
  :: [String]
+-- When a file with an extension in the haskellish_src_suffixes group is
+-- loaded in --make mode, its imports will be loaded too.
 haskellish_src_suffixes      = haskellish_user_src_suffixes ++
-                               [ "hspp", "hscpp", "cmm", "cmmcpp" ]
+                               [ "hspp", "hscpp" ]
 haskellish_suffixes          = haskellish_src_suffixes ++
-                               [ "hc" ]
+                               [ "hc", "cmm", "cmmcpp" ]
 cish_suffixes                = [ "c", "cpp", "C", "cc", "cxx", "s", "S", "ll", "bc", "lm_s", "m", "M", "mm" ]
+
 -- Will not be deleted as temp files:
 haskellish_user_src_suffixes =
   haskellish_sig_suffixes ++ [ "hs", "lhs", "hs-boot", "lhs-boot" ]
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 2f013aa..fa266a2 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -656,7 +656,7 @@ doMake srcs  = do
     let (hs_srcs, non_hs_srcs) = partition haskellish srcs
 
         haskellish (f,Nothing) =
-          looksLikeModuleName f || isHaskellUserSrcFilename f || '.' `notElem` f
+          looksLikeModuleName f || isHaskellSrcFilename f || '.' `notElem` f
         haskellish (_,Just phase) =
           phase `notElem` [ As True, As False, Cc, Cobjc, Cobjcxx, CmmCpp, Cmm
                           , StopLn]
diff --git a/testsuite/tests/driver/T10220.hspp b/testsuite/tests/driver/T10220.hspp
new file mode 100644
index 0000000..9dd6b0d
--- /dev/null
+++ b/testsuite/tests/driver/T10220.hspp
@@ -0,0 +1,2 @@
+module T10220 where
+import T10220B
diff --git a/testsuite/tests/driver/T10220B.hs b/testsuite/tests/driver/T10220B.hs
new file mode 100644
index 0000000..fce109b
--- /dev/null
+++ b/testsuite/tests/driver/T10220B.hs
@@ -0,0 +1 @@
+module T10220B where
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index e1665f1..32678d3 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -427,3 +427,7 @@ test('T10219', normal, run_command,
      # `-x hspp` in make mode should work.
      # Note: need to specify `-x hspp` before the filename.
      ['{compiler} --make -x hspp T10219.hspp -fno-code -v0'])
+
+test('T10220', normal, run_command,
+     # Preprocessed T10220.hspp imports T10220B. Should work in --make mode.
+     ['{compiler} --make T10220.hspp -fno-code -v0'])



More information about the ghc-commits mailing list