diff options
| author | Andrei Barbu <andrei@0xab.com> | 2021-09-30 17:19:36 -0400 |
|---|---|---|
| committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-12-15 16:33:17 -0500 |
| commit | f5a0b408c7e4ef71221eea3ea80ea250fbb28e18 (patch) | |
| tree | 31b305405145c022d6aadfd512e83c3184330365 /compiler | |
| parent | 45bd630886157fbe4856594e098202808aedbdd0 (diff) | |
| download | haskell-f5a0b408c7e4ef71221eea3ea80ea250fbb28e18.tar.gz | |
Plugin load order should follow the commandline order (fixes #17884)
In the past the order was reversed because flags are consed onto a list.
No particular behavior was documented.
We now reverse the flags and document the behavior.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/GHC/Driver/Session.hs | 2 | ||||
| -rw-r--r-- | compiler/GHC/Runtime/Loader.hs | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 33b27c2f9f..3af4ede9bf 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -573,6 +573,8 @@ data DynFlags = DynFlags { -- Plugins pluginModNames :: [ModuleName], + -- ^ the @-fplugin@ flags given on the command line, in *reverse* + -- order that they're specified on the command line. pluginModNameOpts :: [(ModuleName,String)], frontendPluginOpts :: [String], -- ^ the @-ffrontend-opt@ flags given on the command line, in *reverse* diff --git a/compiler/GHC/Runtime/Loader.hs b/compiler/GHC/Runtime/Loader.hs index 654b270fb1..704f499a4f 100644 --- a/compiler/GHC/Runtime/Loader.hs +++ b/compiler/GHC/Runtime/Loader.hs @@ -74,7 +74,7 @@ import GHC.Unit.Types (ModuleNameWithIsBoot) initializePlugins :: HscEnv -> Maybe ModuleNameWithIsBoot -> IO HscEnv initializePlugins hsc_env mnwib -- plugins not changed - | map lpModuleName (hsc_plugins hsc_env) == pluginModNames dflags + | map lpModuleName (hsc_plugins hsc_env) == reverse (pluginModNames dflags) -- arguments not changed , all same_args (hsc_plugins hsc_env) = return hsc_env -- no need to reload plugins @@ -96,7 +96,7 @@ loadPlugins hsc_env mnwib ; return $ zipWith attachOptions to_load plugins } where dflags = hsc_dflags hsc_env - to_load = pluginModNames dflags + to_load = reverse $ pluginModNames dflags attachOptions mod_nm (plug, mod) = LoadedPlugin (PluginWithArgs plug (reverse options)) mod |
