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

#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

#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
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by Patrick Palka

#8527: The ordering of -I directives should be consistent with the ordering of -package directives -------------------------------------+------------------------------------- Reporter: parcs | Owner: parcs Type: bug | Status: new Priority: normal | Milestone: Component: Package | Version: 7.7 system | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Old description:
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
is obsolete and will be removed in GHC 7.10 [-Wcpp] #warning 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?
New description:
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
participants (1)
-
GHC