diff src/compiler.sml @ 1558:6fe6bda2b928

Disable C optimization in debug mode
author Adam Chlipala <adam@chlipala.net>
date Sun, 11 Sep 2011 11:37:26 -0400
parents 659a2f71f5e5
children 154cfe2eb366
line wrap: on
line diff
--- a/src/compiler.sml	Sat Sep 03 12:56:05 2011 -0400
+++ b/src/compiler.sml	Sun Sep 11 11:37:26 2011 -0400
@@ -1322,11 +1322,17 @@
                   else
                       "-L" ^ Config.lib ^ "/.. -lurweb " ^ #linkDynamic proto
 
-        val compile = Config.ccompiler ^ " " ^ Config.ccArgs ^ " " ^ Config.pthreadCflags ^ " -Wimplicit -Werror -Wno-unused-value -O3 -I " ^ Config.includ
+        val opt = if debug then
+                      ""
+                  else
+                      " -O3"
+
+        val compile = Config.ccompiler ^ " " ^ Config.ccArgs ^ " " ^ Config.pthreadCflags ^ " -Wimplicit -Werror -Wno-unused-value"
+                      ^ opt ^ " -I " ^ Config.includ
                       ^ " " ^ #compile proto
                       ^ " -c " ^ escapeFilename cname ^ " -o " ^ escapeFilename oname
 
-        val link = Config.ccompiler ^ " -Werror -O3 -lm " ^ Config.ccArgs ^ " " ^ Config.pthreadCflags ^ " " ^ Config.pthreadLibs
+        val link = Config.ccompiler ^ " -Werror" ^ opt ^ " -lm " ^ Config.ccArgs ^ " " ^ Config.pthreadCflags ^ " " ^ Config.pthreadLibs
                    ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ escapeFilename oname ^ " -o " ^ escapeFilename ename ^ " " ^ libs
 
         val (compile, link) =