# HG changeset patch # User Adam Chlipala # Date 1308145926 14400 # Node ID d40066b387102c78ee783d22f0ecd039763d460f # Parent 18d18a70821e5b959c5a11ca17f2a092f5960db8 Handle spaces in filenames passed to GCC (caught by Zachary Tatlock) diff -r 18d18a70821e -r d40066b38710 src/compiler.sml --- a/src/compiler.sml Tue Jun 14 08:54:45 2011 -0400 +++ b/src/compiler.sml Wed Jun 15 09:52:06 2011 -0400 @@ -1307,6 +1307,8 @@ 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 @@ 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 -r 18d18a70821e -r d40066b38710 tests/has space.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/has space.ur Wed Jun 15 09:52:06 2011 -0400 @@ -0,0 +1,2 @@ +fun main () : transaction page = return Hehe + diff -r 18d18a70821e -r d40066b38710 tests/spacey.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/spacey.ur Wed Jun 15 09:52:06 2011 -0400 @@ -0,0 +1,1 @@ +fun main () : transaction page = return diff -r 18d18a70821e -r d40066b38710 tests/spacey.urp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/spacey.urp Wed Jun 15 09:52:06 2011 -0400 @@ -0,0 +1,3 @@ +exe has space.exe + +spacey