summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/ffi/should_compile/all.T9
-rw-r--r--testsuite/tests/ffi/should_compile/cc017.hs19
-rw-r--r--testsuite/tests/ffi/should_run/all.T2
-rw-r--r--testsuite/tests/th/T13366.hs2
4 files changed, 30 insertions, 2 deletions
diff --git a/testsuite/tests/ffi/should_compile/all.T b/testsuite/tests/ffi/should_compile/all.T
index 0f2f3901c4..1aa32c87d5 100644
--- a/testsuite/tests/ffi/should_compile/all.T
+++ b/testsuite/tests/ffi/should_compile/all.T
@@ -32,3 +32,12 @@ test('cc016', normal, compile, [''])
test('T10460', normal, compile, [''])
test('T11983', [omit_ways(['ghci'])], compile, ['T11983.c'])
test('T14125', normal, compile, [''])
+test(
+ 'cc017',
+ normal,
+ compile,
+ [
+ '-optc=-DC -optcxx=-DCXX -optcxx=-std=c++11'
+ + (' -optcxx=-stdlib=libc++' if opsys('darwin') else '')
+ ],
+)
diff --git a/testsuite/tests/ffi/should_compile/cc017.hs b/testsuite/tests/ffi/should_compile/cc017.hs
new file mode 100644
index 0000000000..a0ff8163db
--- /dev/null
+++ b/testsuite/tests/ffi/should_compile/cc017.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+import Language.Haskell.TH.Syntax
+
+-- Check -optc and -optcxx options passing.
+-- This file must be compiled with -optc=-DC -optcxx=-DCXX
+
+do addForeignSource LangC
+ "int CXX = 0; // -DCXX must not be passed to C \n\
+ \_Static_assert(C, \"name C must come from -DC\"); "
+
+ addForeignSource LangCxx
+ "int C = 0; // -DC must not be passed to C++ \n\
+ \static_assert(CXX, \"name CXX must come from -DCXX\"); "
+
+ pure []
+
+main :: IO ()
+main = pure ()
diff --git a/testsuite/tests/ffi/should_run/all.T b/testsuite/tests/ffi/should_run/all.T
index 96ab5062b7..d780fb809d 100644
--- a/testsuite/tests/ffi/should_run/all.T
+++ b/testsuite/tests/ffi/should_run/all.T
@@ -28,7 +28,7 @@ test('ffi004', skip, compile_and_run, [''])
# On x86, the test suffers from floating-point differences due to the
# use of 80-bit internal precision when using the native code generator.
#
-test('ffi005', [ omit_ways(prof_ways),
+test('ffi005', [ omit_ways(prof_ways),
when(arch('i386'), skip),
when(platform('i386-apple-darwin'), expect_broken(4105)),
exit_code(3) ],
diff --git a/testsuite/tests/th/T13366.hs b/testsuite/tests/th/T13366.hs
index 6a3bda3d09..7d998f2ae8 100644
--- a/testsuite/tests/th/T13366.hs
+++ b/testsuite/tests/th/T13366.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE TemplateHaskell #-}
-{-# OPTIONS_GHC -optc-DA_MACRO=1 #-}
+{-# OPTIONS_GHC -optc-DA_MACRO=1 -optcxx-DA_MACRO=1 #-}
import Language.Haskell.TH.Syntax
import System.IO (hFlush, stdout)