1
0

cc1plus 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. ### Is this a pipe or not? ###
  24. # Determine the last argument
  25. for i
  26. do
  27. third_last="$third_last $second_last"
  28. second_last=$last
  29. last=$i
  30. done
  31. # If the last param is *.ii, there's no pipe
  32. case $last in
  33. *.ii)
  34. piping=0
  35. ;;
  36. *)
  37. piping=1
  38. ;;
  39. esac
  40. if [ $piping -eq 1 ]; then
  41. exec $(${COLLECT_GCC} --print-prog-name=cc1plus) "$@" | $STRINGFIX
  42. else
  43. gcc_status=$($(${COLLECT_GCC} --print-prog-name=cc1plus) "$@")
  44. TEMPFILE=`(umask 077 && mktemp -t "ccXXXXXX") 2>/dev/null`
  45. $STRINGFIX < $last > $TEMPFILE
  46. mv -f $TEMPFILE $last
  47. exit $gcc_status
  48. fi