[GHC] #12890: Stdcall - treating as CCall (bogus warning on win 64 bit)

#12890: Stdcall - treating as CCall (bogus warning on win 64 bit) -------------------------------------+------------------------------------- Reporter: tim-m89 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Windows Architecture: x86_64 | Type of failure: Incorrect (amd64) | error/warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- On windows you generally have the stdcall calling convention so you're average foreign import looks like this: {{{ foreign import stdcall "someFile.h getFoo" getFoo :: IO Foo }}} But on a 64 bit system, GHC warns: {{{ C:\Some\Path.hs:35:1: warning: [-Wunsupported-calling-conventions] * the 'stdcall' calling convention is unsupported on this platform, treating as ccall * When checking declaration: foreign import stdcall safe "static someFile.h getFoo" getFoo :: IO Foo }}} Both stdcall & ccall are not applicable to a 64 bit system as far as I know, and if it was really treating it as ccall it would have segfaulted at runtime. So the warning is a bit of a lie anyway. So far some developers generally have resorted to creating c preprocessor macros like this: [https://www.mail-archive.com/cvs- libraries@haskell.org/msg09725.html] Apologies if this is a dupe, I thought someone already reported this a long time ago but I can't seem to find the ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12890 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12890: Stdcall - treating as CCall (bogus warning on win 64 bit) -------------------------------------+------------------------------------- Reporter: tim-m89 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 Type of failure: Incorrect | (amd64) error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): Hi, Thanks for the report. Win32 now contains a header you can include instead of needing to define the macros over and over again see https://github.com/haskell/win32/commit/7f91a92f74b7d93081df49d01b408ae1cd9c... About the warning. While I agree, I don't know what the right thing here is. You most definitely should get a warning. But the Microsoft x64 calling convention doesn't really have a name we can refer to. And the Haskell FFI standard doesn't allow you to omit the calling convention https://www.haskell.org/onlinereport/haskell2010/haskellch8.html#x15-1540008.... We default to `cdecl` because that means in this case `do whatever is native to the platform`. If you have any suggestions on how we can do better here, I'm all for it! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12890#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC