summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-06-09 09:50:41 -0400
committerBen Gamari <ben@smart-cactus.org>2019-06-12 08:20:25 -0400
commit898f7e9235eff57ececac4836f6ba74388131db2 (patch)
treec9dcbdaa5f6c66c55970458f4a5650836092ebf6 /hadrian
parent0782141ef52c72523b82cd83b7466a3a65d94a31 (diff)
downloadhaskell-898f7e9235eff57ececac4836f6ba74388131db2.tar.gz
Fix uses of #ifdef/#ifndef
The linter now enforces our preference for `#if defined()` and `#if !defined()`.
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/src/Rules/Generate.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs
index c755e389eb..7f7fd2ee47 100644
--- a/hadrian/src/Rules/Generate.hs
+++ b/hadrian/src/Rules/Generate.hs
@@ -233,7 +233,7 @@ generateGhcPlatformH = do
targetVendor <- getSetting TargetVendor
ghcUnreg <- getFlag GhcUnregisterised
return . unlines $
- [ "#ifndef __GHCPLATFORM_H__"
+ [ "#if !defined(__GHCPLATFORM_H__)"
, "#define __GHCPLATFORM_H__"
, ""
, "#define BuildPlatform_TYPE " ++ cppify hostPlatform
@@ -386,7 +386,7 @@ generateGhcAutoconfH = do
ccLlvmBackend <- getSetting CcLlvmBackend
ccClangBackend <- getSetting CcClangBackend
return . unlines $
- [ "#ifndef __GHCAUTOCONF_H__"
+ [ "#if !defined(__GHCAUTOCONF_H__)"
, "#define __GHCAUTOCONF_H__" ]
++ configHContents ++
[ "\n#define TABLES_NEXT_TO_CODE 1" | tablesNextToCode && not ghcUnreg ]
@@ -422,7 +422,7 @@ generateGhcBootPlatformH = do
targetOs <- getSetting TargetOs
targetVendor <- getSetting TargetVendor
return $ unlines
- [ "#ifndef __PLATFORM_H__"
+ [ "#if !defined(__PLATFORM_H__)"
, "#define __PLATFORM_H__"
, ""
, "#define BuildPlatform_NAME " ++ show buildPlatform
@@ -464,10 +464,10 @@ generateGhcVersionH = do
patchLevel1 <- getSetting ProjectPatchLevel1
patchLevel2 <- getSetting ProjectPatchLevel2
return . unlines $
- [ "#ifndef __GHCVERSION_H__"
+ [ "#if !defined(__GHCVERSION_H__)"
, "#define __GHCVERSION_H__"
, ""
- , "#ifndef __GLASGOW_HASKELL__"
+ , "#if !defined(__GLASGOW_HASKELL__)"
, "# define __GLASGOW_HASKELL__ " ++ version
, "#endif"
, ""]