summaryrefslogtreecommitdiff
path: root/compiler/main/SysTools/Tasks.hs
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2019-11-13 10:35:11 -0500
committerRyan Scott <ryan.gl.scott@gmail.com>2019-11-13 10:35:42 -0500
commit9a896a555242b7fe55be7215744ed38fd2ee6dfd (patch)
tree2b21b4b1ca9d2c9f3b739bfd0d8fc997ea940cac /compiler/main/SysTools/Tasks.hs
parenta06cfb59d21c9cf6f53a8b1acedb075988a6c5ca (diff)
downloadhaskell-wip/T17471.tar.gz
Prevent -optc arguments from being duplicated in reverse order (#17471)wip/T17471
This reverts a part of commit 7bc5d6c6578ab9d60a83b81c7cc14819afef32ba that causes all arguments to `-optc` (and `-optcxx`) to be passed twice to the C/C++ compiler, once in reverse order and then again in the correct order. While passing duplicate arguments is usually harmless it can cause breakage in this pattern, which is employed by Hackage libraries in the wild: ``` ghc Foo.hs foo.c -optc-D -optcFOO ``` As `FOO -D -D FOO` will cause compilers to error. Fixes #17471.
Diffstat (limited to 'compiler/main/SysTools/Tasks.hs')
-rw-r--r--compiler/main/SysTools/Tasks.hs5
1 files changed, 2 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", [])