diff options
author | Adam Chlipala <adam@chlipala.net> | 2012-09-19 14:20:47 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2012-09-19 14:20:47 -0400 |
commit | 133b90755868210fee267f146b67475d5df3dc50 (patch) | |
tree | 4e8b5af14dec9b90670068201fea0935640d3217 /src/compiler.sml | |
parent | ad5056f7acfe0693bfcb5da50b0c0d2f9d139d69 (diff) |
Edward Z. Yang's patch to avoid repeating linker arguments
Diffstat (limited to 'src/compiler.sml')
-rw-r--r-- | src/compiler.sml | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/compiler.sml b/src/compiler.sml index 603dd298..78999a4b 100644 --- a/src/compiler.sml +++ b/src/compiler.sml @@ -1442,6 +1442,11 @@ val escapeFilename = String.translate (fn #" " => "\\ " | #"\"" => "\\\"" | #"'" val beforeC = ref (fn () => ()) +structure StringSet = BinarySetFn(struct + type ord_key = string + val compare = String.compare + end) + fun compileC {cname, oname, ename, libs, profile, debug, linker, link = link'} = let val proto = Settings.currentProtocol () @@ -1478,7 +1483,14 @@ fun compileC {cname, oname, ename, libs, profile, debug, linker, link = link'} = else (compile, link) - val link = foldl (fn (s, link) => link ^ " " ^ s) link link' + val link = #1 (foldl + (fn (s, (link, set)) => + if StringSet.member (set, s) then + (link, set) + else + ((link ^ " " ^ s), StringSet.add (set, s))) + (link, StringSet.empty) + link') fun system s = (if debug then |