diff options
author | Adam Chlipala <adam@chlipala.net> | 2011-06-15 09:52:06 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2011-06-15 09:52:06 -0400 |
commit | 8a0782976c0c8da839876166013b84756dae493a (patch) | |
tree | 0c3cdd6f2a931a079df5760829f443a1e574cf6c | |
parent | dc4bc877932313f593178372f2ec8c33d29cdbdf (diff) |
Handle spaces in filenames passed to GCC (caught by Zachary Tatlock)
-rw-r--r-- | src/compiler.sml | 8 | ||||
-rw-r--r-- | tests/has space.ur | 2 | ||||
-rw-r--r-- | tests/spacey.ur | 1 | ||||
-rw-r--r-- | tests/spacey.urp | 3 |
4 files changed, 11 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 diff --git a/tests/has space.ur b/tests/has space.ur new file mode 100644 index 00000000..4dec8c0c --- /dev/null +++ b/tests/has space.ur @@ -0,0 +1,2 @@ +fun main () : transaction page = return <xml>Hehe</xml> + diff --git a/tests/spacey.ur b/tests/spacey.ur new file mode 100644 index 00000000..22c5e3ae --- /dev/null +++ b/tests/spacey.ur @@ -0,0 +1 @@ +fun main () : transaction page = return <xml/> diff --git a/tests/spacey.urp b/tests/spacey.urp new file mode 100644 index 00000000..47ba25cb --- /dev/null +++ b/tests/spacey.urp @@ -0,0 +1,3 @@ +exe has space.exe + +spacey |