cc1plus 1021 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #! /bin/sh
  2. # This file intercepts the pre-processor and runs 'stringfix' on the source file before it is processed.
  3. # This avoids the need for the old _*.c temp files.
  4. # Only capture pre-processing
  5. if [ $1 != "-E" -o -z "$stringfix" -o ! -f "$stringfix" ]; then
  6. exec $(${COLLECT_GCC} --print-prog-name=cc1plus) $@
  7. fi
  8. # Check for '-MD' as this may be the 'depcomp' call
  9. depcomp=0
  10. for arg; do
  11. case "$arg" in
  12. -MD)
  13. depcomp=1
  14. ;;
  15. *)
  16. ;;
  17. esac
  18. done
  19. # Only continue if running in depcomp (avoiding a 2nd pass for -dD/-g3)
  20. if [ $depcomp -eq 0 ]; then
  21. exec $(${COLLECT_GCC} --print-prog-name=cc1plus) $@
  22. fi
  23. TMPFILE=`(umask 077 && mktemp ".sfXXXXXX")`
  24. # Trap exit signals to cleanup
  25. trap cleanup_temp EXIT TERM HUP INT QUIT ABRT KILL
  26. cleanup_temp() {
  27. rm -f $TMPFILE $TMPFILE.garbled > /dev/null 2>&1
  28. }
  29. $(${COLLECT_GCC} --print-prog-name=cc1plus) $@ > $TMPFILE
  30. stat=$?
  31. if [ $stat -eq 0 ]; then
  32. $stringfix $TMPFILE $TMPFILE.garbled
  33. cat $TMPFILE.garbled
  34. else
  35. cat $TMPFILE
  36. fi
  37. exit $stat