Browse Source

Remove cc1plus and just preprocess first into an .i file

The cc1plus was clever but does not work with clang
Bryan Drewery 12 năm trước cách đây
mục cha
commit
3fe27824a9
3 tập tin đã thay đổi với 11 bổ sung63 xóa
  1. 10 4
      build/build.mk
  2. 0 58
      build/cc1plus
  3. 1 1
      src/.gitignore

+ 10 - 4
build/build.mk

@@ -1,15 +1,21 @@
 depcomp = /bin/sh $(top_srcdir)/build/autotools/depcomp
 
-%.o: %.c $(top_srcdir)/src/stringfix $(top_srcdir)/build/cc1plus
+%.o: %.c $(top_srcdir)/src/stringfix
 	@echo -e "Compiling: \033[1m$*\033[0m"
 	if [ "$(CCDEPMODE)" = "gcc3" ]; then \
-	  if STRINGFIX='$(top_srcdir)/$(STRINGFIX)' $(CXX) -MT '$@' -MD -MP -MF '.deps/$*.TPo' -DSTRINGFIX=$(STRINGFIX) -B$(top_srcdir)/build $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@; then \
+	  if $(CXX) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CXXFLAGS) $(CPPFLAGS) -E $< | $(top_srcdir)/src/stringfix > $<.i; then \
 	    mv '.deps/$*.TPo' '.deps/$*.Po'; \
 	  else \
 	    rm -f '.deps/$*.Tpo'; \
 	    exit 1; \
 	  fi; \
 	else \
-	  STRINGFIX="$(top_srcdir)/$(STRINGFIX)" libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
-	  $(CXX) -DSTRINGFIX=$(STRINGFIX) -B$(top_srcdir)/build $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@; \
+	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
+	  $(CXX) $(CXXFLAGS) $(CPPFLAGS) -E $< | $(top_srcdir)/src/stringfix > $<.i; \
+	fi; \
+	if ! $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<.i -o $@; then \
+	  rm -f $<.i; \
+	  exit 1; \
+	else \
+	  rm -f $<.i; \
 	fi

+ 0 - 58
build/cc1plus

@@ -1,58 +0,0 @@
-#! /bin/sh
-
-# This file intercepts the pre-processor and runs 'stringfix' on the source file before it is processed.
-# This avoids the need for the old _*.c temp files.
-
-# Only capture pre-processing
-if [ $1 != "-E" -o -z "$STRINGFIX" -o ! -f "$STRINGFIX" ]; then
-  exec $(${COLLECT_GCC} --print-prog-name=cc1plus) "$@"
-fi
-
-
-# Check for '-MD' as this may be the 'depcomp' call
-depcomp=0
-for arg; do
-  case "$arg" in
-    -MD)
-      depcomp=1
-      ;;
-    *)
-      ;;
-  esac
-done
-
-# Only continue if running in depcomp (avoiding a 2nd pass for -dD/-g3)
-if [ $depcomp -eq 0 ]; then
-  exec $(${COLLECT_GCC} --print-prog-name=cc1plus) "$@"
-fi
-
-### Is this a pipe or not? ###
-
-# Determine the last argument
-for i
-do
-  third_last="$third_last $second_last"
-  second_last=$last
-  last=$i
-done
-
-# If the last param is *.ii, there's no pipe
-case $last in
-  *.ii)
-    piping=0
-    ;;
-  *)
-    piping=1
-    ;;
-esac
-
-if [ $piping -eq 1 ]; then
-  exec $(${COLLECT_GCC} --print-prog-name=cc1plus) "$@" | $STRINGFIX
-else
-  gcc_status=$($(${COLLECT_GCC} --print-prog-name=cc1plus) "$@")
-
-  TEMPFILE=`(umask 077 && mktemp -t "ccXXXXXX") 2>/dev/null`
-  $STRINGFIX < $last > $TEMPFILE
-  mv -f $TEMPFILE $last
-  exit $gcc_status
-fi

+ 1 - 1
src/.gitignore

@@ -1,6 +1,5 @@
 /Makefile
 /buildinfo.h
-/*.c.real
 /_*.c
 /*~
 /help.h
@@ -15,3 +14,4 @@
 /makeset
 /set_default.h
 *.o
+*.i