[GHC] #8527: container's Typeable.h is being shadowed by base's Typeable.h during preprocessing

GHC ghc-devs at haskell.org
Wed Nov 13 02:44:14 UTC 2013


#8527: container's Typeable.h is being shadowed by base's Typeable.h during
preprocessing
------------------------------------+-------------------------------------
       Reporter:  parcs             |             Owner:  parcs
           Type:  bug               |            Status:  new
       Priority:  normal            |         Milestone:
      Component:  Package system    |           Version:  7.7
       Keywords:                    |  Operating System:  Unknown/Multiple
   Architecture:  Unknown/Multiple  |   Type of failure:  None/Unknown
     Difficulty:  Unknown           |         Test Case:
     Blocked By:                    |          Blocking:
Related Tickets:                    |
------------------------------------+-------------------------------------
 Here's a reduced test case:


 == cpp.hs ==
 {{{
 #!haskell
 {-# LANGUAGE CPP #-}

 #include "Typeable.h"

 main = return ()
 }}}

 == command line ==
 {{{
 $ ghc-stage2 -c -package base cpp.hs

 In file included from cpp.hs:4:0:

 /home/patrick/code/ghc/libraries/base/include/Typeable.h:17:2:
      warning: #warning <Typeable.h> is obsolete and will be removed in GHC
 7.10 [-Wcpp]
      #warning <Typeable.h> is obsolete and will be removed in GHC 7.10
       ^
 compilation IS NOT required
 $ ghc-stage2 -c -package base -package containers cpp.hs
 compilation IS NOT required
 $ ghc-stage2 -c -package containers -package base cpp.hs
 }}}

 Notice that if I pass `-package containers` to ghc, the cpp warning from
 Typeable.h (from the base library) doesn't appear. This is because
 containers also has a Typeable.h in its include path, and in the
 invocation of the preprocessor, containers' include path precedes base's
 no matter how I order the `-package` directives.

 This behavior is intuitive and limiting. To fix this, I think that the
 ordering of -I directives passed to the preprocessor should be consistent
 with the ordering of -package directives passed to ghc. For example, in
 the above test case, a warning should be shown in the 1st and 2nd
 invocations of ghc but not the 3rd, because in the 3rd invocation
 containers precedes base.

 Does this sound okay?

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


More information about the ghc-tickets mailing list