summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2016-03-30 21:44:09 +0200
committerBen Gamari <ben@smart-cactus.org>2016-03-30 22:49:06 +0200
commitbc953fcdbc76ffbb4f06a2b74be271268f73328f (patch)
treed415337c117c51dc89446f6c601b8e643db14ff1 /compiler
parente9c2555ac666912f7dff56448ced4bfa06d14e76 (diff)
downloadhaskell-bc953fcdbc76ffbb4f06a2b74be271268f73328f.tar.gz
Add -f(no-)version-macro to explicitly control macros.
Test Plan: validate Reviewers: thomie, austin, bgamari Reviewed By: bgamari Subscribers: hvr Differential Revision: https://phabricator.haskell.org/D2058 GHC Trac Issues: #11763
Diffstat (limited to 'compiler')
-rw-r--r--compiler/main/DriverPipeline.hs2
-rw-r--r--compiler/main/DynFlags.hs5
2 files changed, 5 insertions, 2 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index bc9c19bf69..586754fe1c 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -2056,7 +2056,7 @@ doCpp dflags raw input_fn output_fn = do
let uids = explicitPackages (pkgState dflags)
pkgs = catMaybes (map (lookupPackage dflags) uids)
mb_macro_include <-
- if not (null pkgs)
+ if not (null pkgs) && gopt Opt_VersionMacros dflags
then do macro_stub <- newTempName dflags "h"
writeFile macro_stub (generatePackageVersionMacros pkgs)
-- Include version macros for every *exposed* package.
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 9c6704581d..9e064451ef 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -486,6 +486,7 @@ data GeneralFlag
| Opt_FlatCache
| Opt_ExternalInterpreter
| Opt_OptimalApplicativeDo
+ | Opt_VersionMacros
-- PreInlining is on by default. The option is there just to see how
-- bad things get if you turn it off!
@@ -3397,6 +3398,7 @@ fFlagsDeps = [
flagSpec "unbox-strict-fields" Opt_UnboxStrictFields,
flagSpec "vectorisation-avoidance" Opt_VectorisationAvoidance,
flagSpec "vectorise" Opt_Vectorise,
+ flagSpec "version-macros" Opt_VersionMacros,
flagSpec "worker-wrapper" Opt_WorkerWrapper,
flagSpec "show-warning-groups" Opt_ShowWarnGroups
]
@@ -3640,7 +3642,8 @@ defaultFlags settings
Opt_ProfCountEntries,
Opt_RPath,
Opt_SharedImplib,
- Opt_SimplPreInlining
+ Opt_SimplPreInlining,
+ Opt_VersionMacros
]
++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]