浏览代码

* Run stringfix over the pre-processed output

This fixes the src/mod files which #include other source files. Their
strings were not getting garbled.

It also introduces a major performance penalty to the compiling,
as stringfix is very slow on these large processed files.
Bryan Drewery 14 年之前
父节点
当前提交
fb072f5865
共有 2 个文件被更改,包括 17 次插入14 次删除
  1. 15 14
      build/cc1plus
  2. 2 0
      src/garble.h

+ 15 - 14
build/cc1plus

@@ -26,20 +26,21 @@ if [ $depcomp -eq 0 ]; then
   exec $(${COLLECT_GCC} --print-prog-name=cc1plus) $@
 fi
 
-
-# Save the original
-cp -fp $source $source.real
-
-# Trap exit signals to restore the original source file
-trap restore_source EXIT TERM HUP INT QUIT ABRT KILL
-restore_source() {
-  # Restore the original file
-  cp -fp $source.real $source
-  rm -f $source.real
+TMPFILE=`(umask 077 && mktemp ".sfXXXXXX")`
+# Trap exit signals to cleanup
+trap cleanup_temp EXIT TERM HUP INT QUIT ABRT KILL
+cleanup_temp() {
+  rm -f $TMPFILE $TMPFILE.garbled > /dev/null 2>&1
 }
 
-# 'stringfix' the source file into a temporary
-$stringfix $source.real $source
+$(${COLLECT_GCC} --print-prog-name=cc1plus) $@ > $TMPFILE
+stat=$?
+
+if [ $stat -eq 0 ]; then
+  $stringfix $TMPFILE $TMPFILE.garbled
+  cat $TMPFILE.garbled
+else
+  cat $TMPFILE
+fi
 
-$(${COLLECT_GCC} --print-prog-name=cc1plus) $@
-exit $?
+exit $stat

+ 2 - 0
src/garble.h

@@ -1,7 +1,9 @@
 #ifndef _GARBLE_H
 #define _GARBLE_H
 
+#ifdef DEBUG
 #define STR(x) x
+#endif
 
 const char *degarble(int, const char *);