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

#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

#12752: GHC should be able to warn on usafe CPP usage -------------------------------------+------------------------------------- Reporter: erikd | Owner: erikd Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by erikd): * owner: => erikd -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12752#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12752: GHC should be able to warn on usafe CPP usage -------------------------------------+------------------------------------- Reporter: erikd | Owner: erikd Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by erikd): I suspect this is just a matter of adding a GHC warning flag named something like `-Dcpp-undef` and then if that is set, passing `-Wundef` to the C pre-processor. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12752#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12752: GHC should be able to warn on unsafe CPP usage -------------------------------------+------------------------------------- Reporter: erikd | Owner: erikd Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12752#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12752: GHC should be able to warn on unsafe CPP usage -------------------------------------+------------------------------------- Reporter: erikd | Owner: erikd Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): phab:D2626 Wiki Page: | -------------------------------------+------------------------------------- Changes (by erikd): * differential: => phab:D2626 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12752#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12752: GHC should be able to warn on unsafe CPP usage
-------------------------------------+-------------------------------------
Reporter: erikd | Owner: erikd
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: Other | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): phab:D2626
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#12752: GHC should be able to warn on unsafe CPP usage -------------------------------------+------------------------------------- Reporter: erikd | Owner: erikd Type: feature request | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): phab:D2626 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed * milestone: => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12752#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12752: GHC should be able to warn on unsafe CPP usage -------------------------------------+------------------------------------- Reporter: erikd | Owner: erikd Type: feature request | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): phab:D2626 Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): Well okay, but you could also just use `-optP -Wundef` since forever. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12752#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC