diff options
-rw-r--r-- | compiler/main/SysTools/Tasks.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/T17471.hs | 9 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/T17471.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/T17471_c.c | 7 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/all.T | 3 |
5 files changed, 22 insertions, 3 deletions
diff --git a/compiler/main/SysTools/Tasks.hs b/compiler/main/SysTools/Tasks.hs index 5b0cb1cfa2..96a5b291da 100644 --- a/compiler/main/SysTools/Tasks.hs +++ b/compiler/main/SysTools/Tasks.hs @@ -127,10 +127,9 @@ runCc mLanguage dflags args = traceToolCommand dflags "cc" $ do Nothing -> ([], userOpts_c) Just language -> ([Option "-x", Option languageName], opts) where - s = settings dflags (languageName, opts) = case language of - LangC -> ("c", sOpt_c s ++ userOpts_c) - LangCxx -> ("c++", sOpt_cxx s ++ userOpts_cxx) + LangC -> ("c", userOpts_c) + LangCxx -> ("c++", userOpts_cxx) LangObjc -> ("objective-c", userOpts_c) LangObjcxx -> ("objective-c++", userOpts_cxx) LangAsm -> ("assembler", []) diff --git a/testsuite/tests/ffi/should_run/T17471.hs b/testsuite/tests/ffi/should_run/T17471.hs new file mode 100644 index 0000000000..bcaebc59cd --- /dev/null +++ b/testsuite/tests/ffi/should_run/T17471.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE ForeignFunctionInterface #-} +module Main where + +import Foreign.C.Types + +foreign import ccall "foo" foo :: IO CInt + +main :: IO () +main = foo >>= print diff --git a/testsuite/tests/ffi/should_run/T17471.stdout b/testsuite/tests/ffi/should_run/T17471.stdout new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/testsuite/tests/ffi/should_run/T17471.stdout @@ -0,0 +1 @@ +1 diff --git a/testsuite/tests/ffi/should_run/T17471_c.c b/testsuite/tests/ffi/should_run/T17471_c.c new file mode 100644 index 0000000000..64a9445a62 --- /dev/null +++ b/testsuite/tests/ffi/should_run/T17471_c.c @@ -0,0 +1,7 @@ +int foo() { +#if defined(FOO) + return 1; +#else + return 0; +#endif +} diff --git a/testsuite/tests/ffi/should_run/all.T b/testsuite/tests/ffi/should_run/all.T index d379191548..a0984a28fe 100644 --- a/testsuite/tests/ffi/should_run/all.T +++ b/testsuite/tests/ffi/should_run/all.T @@ -213,3 +213,6 @@ test('PrimFFIWord16', [omit_ways(['ghci'])], compile_and_run, ['PrimFFIWord16_c. test('T493', [omit_ways(['ghci'])], compile_and_run, ['T493_c.c']) test('UnliftedNewtypesByteArrayOffset', [omit_ways(['ghci'])], compile_and_run, ['UnliftedNewtypesByteArrayOffset_c.c']) + +test('T17471', [omit_ways(['ghci'])], compile_and_run, + ['T17471_c.c -optc-D -optcFOO']) |