#2100: [PATCH] generated FFI ccall stub prototypes are incomplete
-------------------------+--------------------------------------------------
Reporter: pcc | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler (FFI)
Version: 6.9 | Severity: minor
Keywords: | Testcase:
Architecture: Multiple | Os: Multiple
-------------------------+--------------------------------------------------
For generated C prototypes in which there are no arguments, the argument
list should be "void", not blank. The GCC flag -Wstrict-prototypes warns
about this.
To reproduce: create file Test.hs as follows
{{{
{-# OPTIONS -fffi #-}
module Test where
foreign export ccall "foo" foo :: IO ()
foo = putStrLn "hello world"
}}}
and file use_test.c as follows:
{{{
#include "Test_stub.h"
}}}
Execute the following:
{{{
ghc -c Test.hs
gcc -Wstrict-prototypes -I/usr/lib/ghc-6.6/include -c use_test.c
}}}
(change path as appropriate). Expected output: nothing. Actual output:
{{{
In file included from use_test.c:1:
Test_stub.h:5: warning: function declaration isn’t a prototype
}}}
Patch attached.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2100>
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