summaryrefslogtreecommitdiff
path: root/src/compiler.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-06-15 09:52:06 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-06-15 09:52:06 -0400
commit8a0782976c0c8da839876166013b84756dae493a (patch)
tree0c3cdd6f2a931a079df5760829f443a1e574cf6c /src/compiler.sml
parentdc4bc877932313f593178372f2ec8c33d29cdbdf (diff)
Handle spaces in filenames passed to GCC (caught by Zachary Tatlock)
Diffstat (limited to 'src/compiler.sml')
-rw-r--r--src/compiler.sml8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler.sml b/src/compiler.sml
index 6d9c8166..27529251 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -1307,6 +1307,8 @@ val sqlify = {
val toSqlify = transform sqlify "sqlify" o toMono_opt2
+val escapeFilename = String.translate (fn #" " => "\\ " | #"\"" => "\\\"" | #"'" => "\\'" | ch => str ch)
+
fun compileC {cname, oname, ename, libs, profile, debug, link = link'} =
let
val proto = Settings.currentProtocol ()
@@ -1318,10 +1320,10 @@ fun compileC {cname, oname, ename, libs, profile, debug, link = link'} =
val compile = "gcc " ^ Config.gccArgs ^ " -Wimplicit -Werror -O3 -fno-inline -I " ^ Config.includ
^ " " ^ #compile proto
- ^ " -c " ^ cname ^ " -o " ^ oname
+ ^ " -c " ^ escapeFilename cname ^ " -o " ^ escapeFilename oname
- val link = "gcc -Werror -O3 -lm -pthread " ^ Config.gccArgs ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ oname
- ^ " -o " ^ ename ^ " " ^ libs
+ val link = "gcc -Werror -O3 -lm -pthread " ^ Config.gccArgs ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ escapeFilename oname
+ ^ " -o " ^ escapeFilename ename ^ " " ^ libs
val (compile, link) =
if profile then