summaryrefslogtreecommitdiff
path: root/testsuite
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
parent2b3f4718502465e2b4dfa4a7868ed7a3ad5e4ff1 (diff)
downloadhaskell-97502be8bda9199ac058b9677b4b6ba028022936.tar.gz
Add `-optcxx` option (#16477)
Diffstat (limited to 'testsuite')
-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)