ghc recompilation check doesn't take into account headers directly included by CApiFFI
Continuing from #14756, given the following simple module
{-# LANGUAGE CPP, CApiFFI #-}
#include "Bar.hs.inc"
module Foo where
foreign import capi unsafe "cbits.h foo" c_foo :: Int -> IO ()
After having compiled ghc -c Foo.hs
successfully, and second invocation of ghc -c Foo.hs
- ...will properly recompile when
Bar.hs.inc
changes (or any of its recursive#include
s!) (good!) - ...will fail to detect when
cbits.h
changes, and thus claimcompilation IS NOT required
(BAD!)
Ideally, we should always run CPP for the CApiFFI-included, in order to detect when any recursive #include
s inside cbits.h
change, and use a recorded checksum to detect whether recompilation of the C wrapper (and thus re-linking of the haskell module; which currently forces resynthesizing the object files) is necessary.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |