summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi
diff options
context:
space:
mode:
authorYuriy Syrovetskiy <cblp@cblp.su>2019-04-02 12:59:49 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-04-08 14:41:51 -0400
commit97502be8bda9199ac058b9677b4b6ba028022936 (patch)
tree36ed855bd07d08f4127c45265d5e4f27ea8dbcac /testsuite/tests/ffi
parent2b3f4718502465e2b4dfa4a7868ed7a3ad5e4ff1 (diff)
downloadhaskell-97502be8bda9199ac058b9677b4b6ba028022936.tar.gz
Add `-optcxx` option (#16477)
Diffstat (limited to 'testsuite/tests/ffi')
-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
3 files changed, 29 insertions, 1 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) ],