summaryrefslogtreecommitdiff
path: root/compiler/main/SysTools.hs
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2016-10-22 19:01:49 +1100
committerErik de Castro Lopo <erikd@mega-nerd.com>2016-10-22 20:18:13 +1100
commit767ee632167271475eb40b1c8bc53ac54c7031e4 (patch)
tree8c7bf06e8cdef8799d3d96d0d5fa56897d3f4334 /compiler/main/SysTools.hs
parentf41a8a369796985a75dd618b969292e1e7033112 (diff)
downloadhaskell-wip/erikd/cpp-undef.tar.gz
Add -Wcpp-undef warning flagwip/erikd/cpp-undef
Summary: When enabled, this new warning flag passes `-Wundef` to the C pre-processor which causes the pre-processor to warn on uses of the `#if` directive on undefined identifiers. It is not currently enabled in any of the standard warning groups. Test Plan: Add a test to this commit and make sure the test passes on all major platforms. Reviewers: bgamari, hvr, austin, Phyx, carter Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2626 GHC Trac Issues: #12752
Diffstat (limited to 'compiler/main/SysTools.hs')
-rw-r--r--compiler/main/SysTools.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs
index dd98883cb5..d5fd0c5c29 100644
--- a/compiler/main/SysTools.hs
+++ b/compiler/main/SysTools.hs
@@ -403,9 +403,8 @@ runCpp :: DynFlags -> [Option] -> IO ()
runCpp dflags args = do
let (p,args0) = pgm_P dflags
args1 = map Option (getOpts dflags opt_P)
- args2 = if gopt Opt_WarnIsError dflags
- then [Option "-Werror"]
- else []
+ args2 = [Option "-Werror" | gopt Opt_WarnIsError dflags]
+ ++ [Option "-Wundef" | wopt Opt_WarnCPPUndef dflags]
mb_env <- getGccEnv args2
runSomethingFiltered dflags id "C pre-processor" p
(args0 ++ args1 ++ args2 ++ args) mb_env