diff options
-rw-r--r-- | compiler/GHC/StgToByteCode.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T7388.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T7388.script | 2 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T7388.stdout | 1 | ||||
-rwxr-xr-x | testsuite/tests/ghci/scripts/all.T | 1 |
5 files changed, 12 insertions, 1 deletions
diff --git a/compiler/GHC/StgToByteCode.hs b/compiler/GHC/StgToByteCode.hs index e056dadc2b..e7d4df472d 100644 --- a/compiler/GHC/StgToByteCode.hs +++ b/compiler/GHC/StgToByteCode.hs @@ -1393,6 +1393,7 @@ generateCCall d0 s p (CCallSpec target cconv safety) result_ty args_r_to_l conv = case cconv of CCallConv -> FFICCall + CApiConv -> FFICCall StdCallConv -> FFIStdCall _ -> panic "GHC.StgToByteCode: unexpected calling convention" @@ -1935,7 +1936,7 @@ isSupportedCConv (CCallSpec _ cconv _) = case cconv of StdCallConv -> True -- convention to ensure that a warning PrimCallConv -> False -- is triggered when a new one is added JavaScriptCallConv -> False - CApiConv -> False + CApiConv -> True -- See bug #10462 unsupportedCConvException :: a diff --git a/testsuite/tests/ghci/scripts/T7388.hs b/testsuite/tests/ghci/scripts/T7388.hs new file mode 100644 index 0000000000..91ca1c7268 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T7388.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE CApiFFI #-} +module T7388 where + +import Foreign.C + +foreign import capi "stdio.h printf" printfb :: CString -> CInt -> IO () diff --git a/testsuite/tests/ghci/scripts/T7388.script b/testsuite/tests/ghci/scripts/T7388.script new file mode 100644 index 0000000000..7f02d86453 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T7388.script @@ -0,0 +1,2 @@ +:l T7388 +withCString "I am a working CApi FFI call\n" $ \str -> printfb str 0 diff --git a/testsuite/tests/ghci/scripts/T7388.stdout b/testsuite/tests/ghci/scripts/T7388.stdout new file mode 100644 index 0000000000..b9ac187b44 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T7388.stdout @@ -0,0 +1 @@ +I am a working CApi FFI call diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 80f3eb8f02..4db3ba2f7b 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -346,3 +346,4 @@ test('T20019', normal, ghci_script, ['T20019.script']) test('T20101', normal, ghci_script, ['T20101.script']) test('T20206', normal, ghci_script, ['T20206.script']) test('T20217', normal, ghci_script, ['T20217.script']) +test('T7388', normal, ghci_script, ['T7388.script']) |