From 93f34bbd3319544d8eb3a5e2593bccb9b12e3459 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 26 Mar 2019 23:48:47 -0400 Subject: Purge TargetPlatform_NAME and cTargetPlatformString --- compiler/ghc.mk | 4 ---- compiler/main/DynFlags.hs | 3 ++- compiler/main/SysTools.hs | 2 ++ compiler/utils/Panic.hs | 4 ++-- hadrian/src/Rules/Generate.hs | 4 +--- includes/ghc.mk | 1 + 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 988759ecb1..18c3425305 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -63,8 +63,6 @@ compiler/stage%/build/Config.hs : mk/config.mk mk/project.mk | $$(dir $$@)/. @echo 'cBuildPlatformString = BuildPlatform_NAME' >> $@ @echo 'cHostPlatformString :: String' >> $@ @echo 'cHostPlatformString = HostPlatform_NAME' >> $@ - @echo 'cTargetPlatformString :: String' >> $@ - @echo 'cTargetPlatformString = TargetPlatform_NAME' >> $@ @echo >> $@ @echo 'cProjectName :: String' >> $@ @echo 'cProjectName = "$(ProjectName)"' >> $@ @@ -150,7 +148,6 @@ compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/. @echo >> $@ @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@ @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@ - @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@ @echo >> $@ @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@ @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@ @@ -192,7 +189,6 @@ compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/. @echo >> $@ @echo "#define BuildPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@ @echo "#define HostPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@ - @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@ @echo >> $@ @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@ @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@ diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 1a62d9b15f..ece0c2208e 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -1357,6 +1357,7 @@ data Settings = Settings { sPlatformConstants :: PlatformConstants, -- Formerly Config.hs, target specific + sTargetPlatformString :: String, -- TODO Recalculate string from richer info? sTablesNextToCode :: Bool } @@ -5621,7 +5622,7 @@ compilerInfo dflags ("Stage", cStage), ("Build platform", cBuildPlatformString), ("Host platform", cHostPlatformString), - ("Target platform", cTargetPlatformString), + ("Target platform", sTargetPlatformString $ settings dflags), ("Have interpreter", cGhcWithInterpreter), ("Object splitting supported", showBool False), ("Have native code generator", cGhcWithNativeCodeGen), diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 4374c35dcf..50cc6d58e5 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -177,6 +177,7 @@ initSysTools top_dir Nothing -> pgmError ("Failed to read " ++ show key ++ " value " ++ show xs) Nothing -> pgmError ("No entry for " ++ show key ++ " in " ++ show settingsFile) crossCompiling <- getBooleanSetting "cross compiling" + targetPlatformString <- getSetting "target platform string" targetArch <- readSetting "target arch" targetOS <- readSetting "target os" targetWordSize <- readSetting "target word size" @@ -305,6 +306,7 @@ initSysTools top_dir sOpt_lc = [], sOpt_i = [], sPlatformConstants = platformConstants, + sTargetPlatformString = targetPlatformString, sTablesNextToCode = tablesNextToCode } diff --git a/compiler/utils/Panic.hs b/compiler/utils/Panic.hs index 4f0f3b1b32..df6612bdda 100644 --- a/compiler/utils/Panic.hs +++ b/compiler/utils/Panic.hs @@ -160,13 +160,13 @@ showGhcException exception sorryMsg :: ShowS -> ShowS sorryMsg s = showString "sorry! (unimplemented feature or known bug)\n" - . showString (" (GHC version " ++ cProjectVersion ++ " for " ++ TargetPlatform_NAME ++ "):\n\t") + . showString (" (GHC version " ++ cProjectVersion ++ ":\n\t") . s . showString "\n" panicMsg :: ShowS -> ShowS panicMsg s = showString "panic! (the 'impossible' happened)\n" - . showString (" (GHC version " ++ cProjectVersion ++ " for " ++ TargetPlatform_NAME ++ "):\n\t") + . showString (" (GHC version " ++ cProjectVersion ++ ":\n\t") . s . showString "\n\n" . showString "Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug\n" diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs index 97cd124594..b2a3c16587 100644 --- a/hadrian/src/Rules/Generate.hs +++ b/hadrian/src/Rules/Generate.hs @@ -292,6 +292,7 @@ generateSettings = do , ("libtool command", settingsFileSetting SettingsFileSetting_LibtoolCommand) , ("unlit command", ("$topdir/bin/" <>) . takeFileName <$> builderPath Unlit) , ("cross compiling", flag' CrossCompiling) + , ("target platform string", setting TargetPlatform) , ("target os", lookupValueOrError configFile "haskell-target-os") , ("target arch", lookupValueOrError configFile "haskell-target-arch") , ("target word size", lookupValueOrError configFile "target-word-size") @@ -357,8 +358,6 @@ generateConfigHs = do , "cBuildPlatformString = BuildPlatform_NAME" , "cHostPlatformString :: String" , "cHostPlatformString = HostPlatform_NAME" - , "cTargetPlatformString :: String" - , "cTargetPlatformString = TargetPlatform_NAME" , "" , "cProjectName :: String" , "cProjectName = " ++ show cProjectName @@ -452,7 +451,6 @@ generateGhcBootPlatformH = do , "" , "#define BuildPlatform_NAME " ++ show buildPlatform , "#define HostPlatform_NAME " ++ show hostPlatform - , "#define TargetPlatform_NAME " ++ show targetPlatform , "" , "#define " ++ cppify buildPlatform ++ "_BUILD 1" , "#define " ++ cppify hostPlatform ++ "_HOST 1" diff --git a/includes/ghc.mk b/includes/ghc.mk index 4a25aaa8c1..71941c9d50 100644 --- a/includes/ghc.mk +++ b/includes/ghc.mk @@ -199,6 +199,7 @@ $(includes_SETTINGS) : includes/Makefile | $$(dir $$@)/. @echo ',("libtool command", "$(SettingsLibtoolCommand)")' >> $@ @echo ',("unlit command", "$$topdir/bin/$(utils/unlit_dist_PROG)")' >> $@ @echo ',("cross compiling", "$(CrossCompiling)")' >> $@ + @echo ',("target platform string", "$(TARGETPLATFORM)")' >> $@ @echo ',("target os", "$(HaskellTargetOs)")' >> $@ @echo ',("target arch", "$(HaskellTargetArch)")' >> $@ @echo ',("target word size", "$(TargetWordSize)")' >> $@ -- cgit v1.2.1