[GHC] #12752: GHC should be able to warn on usafe CPP usage

GHC ghc-devs at haskell.org
Sat Oct 22 07:08:04 UTC 2016


#12752: GHC should be able to warn on usafe CPP usage
-------------------------------------+-------------------------------------
           Reporter:  erikd          |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Other
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 GCC has a warning `-Wundef` that catches unsafe CPP usage like:
 {{{#!c
 #if variable_does_not_exist
 // something
 #endif
 }}}
 The GCC man page says about `-Wundef`:
 {{{
   -Wundef
     Warn if an undefined identifier is evaluated in an "#if" directive.
 }}}
 Following GCC's lead, GHC should have a similar warning flag to detect and
 warn about this problem in Haskell code that uses CPP.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12752>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list