You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/07/01 08:20:27 UTC

[lucy-commits] svn commit: r1141829 - in /incubator/lucy/branches/0.1: ./ charmonizer/src/Charmonizer/Core/Compiler.c

Author: marvin
Date: Fri Jul  1 06:20:27 2011
New Revision: 1141829

URL: http://svn.apache.org/viewvc?rev=1141829&view=rev
Log:
LUCY-169 Clean up after MSVC exe compiles.

Clean up a bunch of junk that MSVC leaves behind when it links an executable.

Modified:
    incubator/lucy/branches/0.1/   (props changed)
    incubator/lucy/branches/0.1/charmonizer/src/Charmonizer/Core/Compiler.c

Propchange: incubator/lucy/branches/0.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul  1 06:20:27 2011
@@ -1 +1 @@
-/incubator/lucy/trunk:1126586,1134011,1134355,1134472,1134843-1134848,1134953,1134956,1139709,1139711,1139714,1140001,1140287,1140296,1140387,1140393,1140400,1140418,1140420,1140422,1140437,1140440,1140894,1140924,1140930-1140931,1140964
+/incubator/lucy/trunk:1126586,1134011,1134355,1134472,1134843-1134848,1134953,1134956,1139709,1139711,1139714,1140001,1140287,1140296,1140387,1140393,1140400,1140418,1140420,1140422,1140437,1140440,1140894,1140924,1140930-1140931,1140940,1140964

Modified: incubator/lucy/branches/0.1/charmonizer/src/Charmonizer/Core/Compiler.c
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/0.1/charmonizer/src/Charmonizer/Core/Compiler.c?rev=1141829&r1=1141828&r2=1141829&view=diff
==============================================================================
--- incubator/lucy/branches/0.1/charmonizer/src/Charmonizer/Core/Compiler.c (original)
+++ incubator/lucy/branches/0.1/charmonizer/src/Charmonizer/Core/Compiler.c Fri Jul  1 06:20:27 2011
@@ -129,6 +129,8 @@ CC_compile_exe(const char *source_path, 
     const char *exe_ext        = OS_exe_ext();
     size_t   exe_file_buf_size = strlen(exe_name) + strlen(exe_ext) + 1;
     char    *exe_file          = (char*)malloc(exe_file_buf_size);
+    size_t   junk_buf_size     = exe_file_buf_size + 3;
+    char    *junk              = (char*)malloc(junk_buf_size);
     size_t   exe_file_buf_len  = sprintf(exe_file, "%s%s", exe_name, exe_ext);
     char    *inc_dir_string    = S_inc_dir_string();
     size_t   command_max_size  = strlen(cc_command)
@@ -157,6 +159,18 @@ CC_compile_exe(const char *source_path, 
         system(command);
     }
 
+#ifdef _MSC_VER
+    /* Zap MSVC junk. */
+    /* TODO: Key this off the compiler supplied as argument, not the compiler
+     * used to compile Charmonizer. */
+    sprintf(junk, "%s.obj", exe_name);
+    remove(junk);
+    sprintf(junk, "%s.ilk", exe_name);
+    remove(junk);
+    sprintf(junk, "%s.pdb", exe_name);
+    remove(junk);
+#endif
+
     /* See if compilation was successful.  Remove the source file. */
     result = Util_can_open_file(exe_file);
     if (!Util_remove_and_verify(source_path)) {
@@ -165,6 +179,7 @@ CC_compile_exe(const char *source_path, 
 
     free(command);
     free(inc_dir_string);
+    free(junk);
     free(exe_file);
     return result;
 }