summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi
diff options
context:
space:
mode:
authorRyanGlScott <ryan.gl.scott@gmail.com>2016-05-02 00:07:14 +0200
committerBen Gamari <ben@smart-cactus.org>2016-05-02 00:07:21 +0200
commita28611b14930c9fd73b0028857e1ea8c0e64a38a (patch)
treeb302193ceea50bd2e0d81b6c95cf1792dcaba435 /testsuite/tests/ffi
parentecc060302b13d5a6ffb0fdfb0625b90f2fbfca0f (diff)
downloadhaskell-a28611b14930c9fd73b0028857e1ea8c0e64a38a.tar.gz
Export constructors for IntPtr and WordPtr
This finishes what #5529 started by exporting the constructors for `IntPtr` and `WordPtr` from `Foreign.Ptr`, allowing them to be used in `foreign` declarations. Fixes #11983. Test Plan: `make TEST=T11983` Reviewers: simonpj, hvr, bgamari, austin Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2142 GHC Trac Issues: #11983
Diffstat (limited to 'testsuite/tests/ffi')
-rw-r--r--testsuite/tests/ffi/should_compile/T11983.c5
-rw-r--r--testsuite/tests/ffi/should_compile/T11983.h9
-rw-r--r--testsuite/tests/ffi/should_compile/T11983.hs11
-rw-r--r--testsuite/tests/ffi/should_compile/all.T2
4 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_compile/T11983.c b/testsuite/tests/ffi/should_compile/T11983.c
new file mode 100644
index 0000000000..2b475fb0d8
--- /dev/null
+++ b/testsuite/tests/ffi/should_compile/T11983.c
@@ -0,0 +1,5 @@
+#include <stdint.h>
+#include "T11983.h"
+
+void intptr_example(intptr_t i) {}
+void uintptr_example(uintptr_t u) {}
diff --git a/testsuite/tests/ffi/should_compile/T11983.h b/testsuite/tests/ffi/should_compile/T11983.h
new file mode 100644
index 0000000000..33c78cb9a4
--- /dev/null
+++ b/testsuite/tests/ffi/should_compile/T11983.h
@@ -0,0 +1,9 @@
+#ifndef T11983_H
+#define T11983_H
+
+#include <stdint.h>
+
+void intptr_example(intptr_t);
+void uintptr_example(uintptr_t);
+
+#endif // T11983_H
diff --git a/testsuite/tests/ffi/should_compile/T11983.hs b/testsuite/tests/ffi/should_compile/T11983.hs
new file mode 100644
index 0000000000..162d2411fc
--- /dev/null
+++ b/testsuite/tests/ffi/should_compile/T11983.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module T11983 where
+
+{-# INCLUDE T11983.h #-}
+
+import Foreign.Ptr
+
+foreign import ccall "intptr_example"
+ intPtrExample :: IntPtr -> IO ()
+foreign import ccall "uintptr_example"
+ wordPtrExample :: WordPtr -> IO ()
diff --git a/testsuite/tests/ffi/should_compile/all.T b/testsuite/tests/ffi/should_compile/all.T
index ec6326b610..dac31aeec6 100644
--- a/testsuite/tests/ffi/should_compile/all.T
+++ b/testsuite/tests/ffi/should_compile/all.T
@@ -30,3 +30,5 @@ test('T3742', normal, compile, [''])
test('cc015', normal, compile, [''])
test('cc016', normal, compile, [''])
test('T10460', normal, compile, [''])
+test('T11983', [ omit_ways(['ghci']), extra_clean(['T11983.o']) ],
+ compile, ['T11983.c'])