Purge TargetPlatform_NAME and cTargetPlatformString
authorJohn Ericson <git@JohnEricson.me>
Wed, 27 Mar 2019 03:48:47 +0000 (23:48 -0400)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Wed, 8 May 2019 19:53:40 +0000 (15:53 -0400)
compiler/ghc.mk
compiler/main/DynFlags.hs
compiler/main/SysTools.hs
compiler/utils/Panic.hs
hadrian/src/Rules/Generate.hs
includes/ghc.mk

index 988759e..18c3425 100644 (file)
@@ -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"              >> $@
index 1a62d9b..ece0c22 100644 (file)
@@ -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),
index 4374c35..50cc6d5 100644 (file)
@@ -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
              }
 
index 4f0f3b1..df6612b 100644 (file)
@@ -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"
 
index 97cd124..b2a3c16 100644 (file)
@@ -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"
index 4a25aaa..71941c9 100644 (file)
@@ -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)")' >> $@