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 | |
parent | 5884fd325248e75d40c9da431b4069e43a2c182c (diff) | |
download | haskell-ea59fd4d0abe73e1127dcdd91855a39232e62d41.tar.gz |
Lint the compiler for extraneous LANGUAGE pragmas
Diffstat (limited to 'hadrian')
-rw-r--r-- | hadrian/src/Main.hs | 6 | ||||
-rw-r--r-- | hadrian/src/Rules/Lint.hs | 32 |
2 files changed, 34 insertions, 4 deletions
diff --git a/hadrian/src/Main.hs b/hadrian/src/Main.hs index e6bf015c0a..d75bc743a7 100644 --- a/hadrian/src/Main.hs +++ b/hadrian/src/Main.hs @@ -1,21 +1,21 @@ module Main (main) where -import System.Directory (getCurrentDirectory) import Development.Shake import Hadrian.Expression import Hadrian.Utilities import Settings.Parser +import System.Directory (getCurrentDirectory) import qualified Base import qualified CommandLine import qualified Environment import qualified Rules import qualified Rules.Clean -import qualified Rules.Lint import qualified Rules.Documentation +import qualified Rules.Lint import qualified Rules.Nofib -import qualified Rules.SourceDist import qualified Rules.Selftest +import qualified Rules.SourceDist import qualified Rules.Test import qualified UserSettings 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 + |