cc1plus 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. # Save the original
  24. cp -fp $source $source.real
  25. # Trap exit signals to restore the original source file
  26. trap restore_source EXIT TERM HUP INT QUIT ABRT KILL
  27. restore_source() {
  28. # Restore the original file
  29. cp -fp $source.real $source
  30. rm -f $source.real
  31. }
  32. # 'stringfix' the source file into a temporary
  33. $stringfix $source.real $source
  34. $(${COLLECT_GCC} --print-prog-name=cc1plus) $@
  35. exit $?