diff options
author | Hécate <hecate+gitlab@glitchbra.in> | 2020-09-22 20:35:49 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-10-10 14:49:59 -0400 |
commit | ea59fd4d0abe73e1127dcdd91855a39232e62d41 (patch) | |
tree | 8860a8eb4357979680c43362251b2b733661e7e4 /hadrian/src/Rules/Lint.hs | |
parent | 5884fd325248e75d40c9da431b4069e43a2c182c (diff) | |
download | haskell-ea59fd4d0abe73e1127dcdd91855a39232e62d41.tar.gz |
Lint the compiler for extraneous LANGUAGE pragmas
Diffstat (limited to 'hadrian/src/Rules/Lint.hs')
-rw-r--r-- | hadrian/src/Rules/Lint.hs | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/hadrian/src/Rules/Lint.hs b/hadrian/src/Rules/Lint.hs index 39e047a4d4..76ee4a7028 100644 --- a/hadrian/src/Rules/Lint.hs +++ b/hadrian/src/Rules/Lint.hs @@ -7,7 +7,9 @@ import Settings.Builders.Common import System.Directory (findExecutable) lintRules :: Rules () -lintRules = "lint:base" ~> lint base +lintRules = do + "lint:base" ~> lint base + "lint:compiler" ~> lint compiler lint :: Action () -> Action () lint lintAction = do @@ -43,3 +45,31 @@ base = do " -h " <> hlintYaml <> " libraries/base" putBuild $ "| " <> cmdLine cmd_ cmdLine + +compiler :: Action () +compiler = do + topDir <- topDirectory + buildDir <- buildRoot + let stage1Lib = topDir </> buildDir </> "stage1/lib" + let stage1Compiler = topDir </> buildDir </> "stage1/compiler/build" + let machDeps = topDir </> "includes/MachDeps.h" + let hsVersions = topDir </> "compiler/HsVersions.h" + let compilerDir = topDir </> "compiler" + let ghcautoconf = stage1Lib </> "ghcautoconf.h" + let ghcplatform = stage1Lib </> "ghcplatform.h" + let pmv = stage1Compiler </> "primop-vector-uniques.hs-incl" + need [ghcautoconf, ghcplatform, machDeps, hsVersions, pmv] + let include0 = topDir </> "includes" + let include1 = stage1Lib + let hlintYaml = topDir </> "compiler/.hlint.yaml" + hostArch <- (<> "_HOST_ARCH") <$> setting HostArch + let cmdLine = "hlint -j --cpp-define " <> hostArch <> + " --cpp-include=" <> include0 <> + " --cpp-include=" <> include1 <> + " --cpp-include=" <> compilerDir <> + " --cpp-include=" <> ghcplatform <> + " --cpp-include=" <> stage1Compiler <> + " -h " <> hlintYaml <> " compiler" + putBuild $ "| " <> cmdLine + cmd_ cmdLine + |