Fix several linker warnings

This commit is contained in:
pho 2021-05-05 16:38:40 +00:00
parent a1202cec0f
commit 9acd285293
6 changed files with 98 additions and 11 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.2 2021/05/05 16:18:07 pho Exp $
# $NetBSD: Makefile,v 1.3 2021/05/05 16:38:40 pho Exp $
DISTNAME= foundation-0.0.26
PKGREVISION= 1
PKGREVISION= 2
CATEGORIES= devel
MAINTAINER= pho@cielonegro.org

View file

@ -1,4 +1,4 @@
# $NetBSD: buildlink3.mk,v 1.2 2021/05/05 16:19:08 pho Exp $
# $NetBSD: buildlink3.mk,v 1.3 2021/05/05 16:38:40 pho Exp $
BUILDLINK_TREE+= hs-foundation
@ -6,7 +6,7 @@ BUILDLINK_TREE+= hs-foundation
HS_FOUNDATION_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.hs-foundation+= hs-foundation>=0.0.26
BUILDLINK_ABI_DEPENDS.hs-foundation+= hs-foundation>=0.0.26nb1
BUILDLINK_ABI_DEPENDS.hs-foundation+= hs-foundation>=0.0.26nb2
BUILDLINK_PKGSRCDIR.hs-foundation?= ../../devel/hs-foundation
.include "../../devel/hs-basement/buildlink3.mk"

View file

@ -1,7 +1,9 @@
$NetBSD: distinfo,v 1.2 2021/05/05 16:18:07 pho Exp $
$NetBSD: distinfo,v 1.3 2021/05/05 16:38:40 pho Exp $
SHA1 (foundation-0.0.26.tar.gz) = f68e1ff42a76270f41ec3db0b69f548d587a706b
RMD160 (foundation-0.0.26.tar.gz) = 3545c9a261e8570b0d41b809a6b4a53afe195382
SHA512 (foundation-0.0.26.tar.gz) = c85b4fc08ee92de8c7bd6e2b469762e7f101c52eebedca17ceb4073048781d309e6e62dff4d248df79f8237e293f5b38c73c94c14635ba2992bda52510e85eac
Size (foundation-0.0.26.tar.gz) = 120483 bytes
SHA1 (patch-Foundation_System_Bindings_Posix.hsc) = d370ea51bc337f1d9bec4f81ed065fec502eb093
SHA1 (patch-Foundation_Foreign_MemoryMap_Posix.hsc) = 4eff66816573ad8b606229635194ecbd86aa44b4
SHA1 (patch-Foundation_System_Bindings_Posix.hsc) = 904e8e196b66ed4a368863a2ba9ecbee36a0f97d
SHA1 (patch-Foundation_System_Bindings_Time.hsc) = a946c4e92e8f71e3543306d607fe352d5002cfb3

View file

@ -0,0 +1,24 @@
$NetBSD: patch-Foundation_Foreign_MemoryMap_Posix.hsc,v 1.1 2021/05/05 16:38:40 pho Exp $
Suppress linker warnings about compatibility syscall wrappers by using
"capi" instead of "ccall".
--- Foundation/Foreign/MemoryMap/Posix.hsc.orig 2021-05-05 16:31:38.032586413 +0000
+++ Foundation/Foreign/MemoryMap/Posix.hsc
@@ -22,6 +22,7 @@
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE CPP #-}
+{-# LANGUAGE CApiFFI #-}
module Foundation.Foreign.MemoryMap.Posix
( memoryMap
, memoryUnmap
@@ -73,7 +74,7 @@ foreign import ccall unsafe "madvise"
c_madvise :: Ptr a -> CSize -> CInt -> IO CInt
#endif
-foreign import ccall unsafe "msync"
+foreign import capi unsafe "sys/mman.h msync"
c_msync :: Ptr a -> CSize -> CInt -> IO CInt
foreign import ccall unsafe "mprotect"

View file

@ -1,18 +1,49 @@
$NetBSD: patch-Foundation_System_Bindings_Posix.hsc,v 1.1 2021/05/05 16:18:07 pho Exp $
$NetBSD: patch-Foundation_System_Bindings_Posix.hsc,v 1.2 2021/05/05 16:38:40 pho Exp $
dirfd(3) is a macro on NetBSD. It doesn't exist as a symbol in libc.
* dirfd(3) is a macro on NetBSD. It doesn't exist as a symbol in libc.
--- Foundation/System/Bindings/Posix.hsc.orig 2021-05-05 16:09:20.261233488 +0000
* Suppress linker warnings about compatibility syscall wrappers by
using "capi" instead of "ccall".
--- Foundation/System/Bindings/Posix.hsc.orig 2019-09-02 03:58:08.000000000 +0000
+++ Foundation/System/Bindings/Posix.hsc
@@ -27,7 +27,7 @@ import Foundation.System.Bindings.PosixD
@@ -27,8 +27,8 @@ import Foundation.System.Bindings.PosixD
#include <fcntl.h>
#include <errno.h>
-data CDir
-data CDirent
+data {-# CTYPE "dirent.h" "DIR" #-} CDir
data CDirent
+data {-# CTYPE "dirent.h" "struct dirent" #-} CDirent
sysPosix_E2BIG
, sysPosix_EACCES
@@ -312,7 +312,7 @@ foreign import ccall unsafe "madvise"
sysPosixMadvise :: Ptr a -> CSize -> CMemAdvice -> IO CInt
#endif
-foreign import ccall unsafe "msync"
+foreign import capi unsafe "sys/mman.h msync"
sysPosixMsync :: Ptr a -> CSize -> CMemSyncFlags -> IO CInt
foreign import ccall unsafe "mprotect"
@@ -361,13 +361,13 @@ foreign import ccall unsafe "ftruncate"
-- directories
--------------------------------------------------------------------------------
-foreign import ccall unsafe "opendir"
+foreign import capi unsafe "dirent.h opendir"
sysPosixOpendir :: Ptr CChar -> IO (Ptr CDir)
foreign import ccall unsafe "fdopendir"
sysPosixFdopendir :: CFd -> IO (Ptr CDir)
-foreign import ccall unsafe "readdir"
+foreign import capi unsafe "dirent.h readdir"
sysPosixReaddir :: Ptr CDir -> IO (Ptr CDirent)
-foreign import ccall unsafe "readdir_r"
+foreign import capi unsafe "dirent.h readdir_r"
sysPosixReaddirR :: Ptr CDir -> Ptr CDirent -> Ptr (Ptr CDirent) -> IO CInt
foreign import ccall unsafe "telldir"
sysPosixTelldir :: Ptr CDir -> IO CLong
@@ -377,5 +377,5 @@ foreign import ccall unsafe "rewinddir"
sysPosixRewinddir :: Ptr CDir -> IO ()
foreign import ccall unsafe "closedir"

View file

@ -0,0 +1,30 @@
$NetBSD: patch-Foundation_System_Bindings_Time.hsc,v 1.1 2021/05/05 16:38:40 pho Exp $
Suppress linker warnings about compatibility syscall wrappers by using
"capi" instead of "ccall".
--- Foundation/System/Bindings/Time.hsc.orig 2021-05-05 16:28:40.081345013 +0000
+++ Foundation/System/Bindings/Time.hsc
@@ -3,6 +3,7 @@
-- Maintainer : Haskell foundation
--
+{-# LANGUAGE CApiFFI #-}
module Foundation.System.Bindings.Time where
import Basement.Compat.Base
@@ -116,11 +117,11 @@ foreign import ccall unsafe "foundation_
foreign import ccall unsafe "foundation_time_clock_gettime"
sysTimeClockGetTime :: CClockId -> Ptr CTimeSpec -> IO CInt
#else
-foreign import ccall unsafe "clock_getres"
+foreign import capi unsafe "time.h clock_getres"
sysTimeClockGetRes :: CClockId -> Ptr CTimeSpec -> IO CInt
-foreign import ccall unsafe "clock_gettime"
+foreign import capi unsafe "time.h clock_gettime"
sysTimeClockGetTime :: CClockId -> Ptr CTimeSpec -> IO CInt
#endif
-foreign import ccall unsafe "gettimeofday"
+foreign import capi unsafe "sys/time.h gettimeofday"
sysTimeGetTimeOfDay :: Ptr CTimeVal -> Ptr CTimeZone -> IO CInt