Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,870
    • Issues 4,870
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 453
    • Merge requests 453
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #8527
Closed
Open
Created Nov 13, 2013 by parcs@trac-parcs

The ordering of -I directives should be consistent with the ordering of -package directives

Here's a reduced test case:

cpp.hs

{-# 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 unintuitive 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?

Edited Mar 10, 2019 by Thomas Miedema
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking