#1386: foreign exports not taken into account when calculating -fwarn-unused-
imports
-----------------------+----------------------------------------------------
  Reporter:  duncan    |          Owner:         
      Type:  bug       |         Status:  new    
  Priority:  normal    |      Milestone:         
 Component:  Compiler  |        Version:  6.7    
  Severity:  normal    |       Keywords:         
Difficulty:  Unknown   |             Os:  Unknown
  Testcase:            |   Architecture:  Unknown
-----------------------+----------------------------------------------------
Here we have a program that imports and uses {{{liftM}}} from
 {{{Control.Monad}}}, but only as a result of being used in the definition
 of a function that is foreign exported.

 {{{
 module Foo () where

 import Control.Monad (liftM)

 foo :: IO ()
 foo = id `liftM` return ()

 foreign export ccall "hs_foo"
   foo :: IO ()
 }}}

 GHC 6.6 and HEAD report:

 {{{
 foo.hs:3:0:
     Warning: Module `Control.Monad' is imported, but nothing from it is
 used,
                except perhaps instances visible in `Control.Monad'
              To suppress this warning, use: import Control.Monad()
 }}}

 So I suppose all that needs to happen is to add in foreign exports as
 roots when building the usage graph.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1386>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to