This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Revised patch for C++ additions to libgcc


Jason Merrill was concerned about losing header-file dependencies.
This revised patch uses gcc -M in the mklibgcc script to determine
what those are, and add them to the generated libgcc.mk.

Note that the top-level Makefile.in will not know about those
dependencies, so it's not clear to me how much this helps.

zw

	* Makefile.in (libgcc.mk): Also pass MAKEDEPS to command.
	(libgcc.a): Also pass LIBGCC2_CXXFLAGS to sub-make.
	* mklibgcc.in: Treat the contents of a .txt file in LIB2ADD
	just like we treat literal entries in LIB2ADD.  Know how to
	build .o from .cc.  Run $MAKEDEPS to generate dependencies for
	all entries in LIB2ADD, except those that trigger recursive
	make. Avoid including /./ in paths.
cp:
	* Make-lang.in (CXX_LIB2SRCS): Mention everything that used to
	be in CXX_LIB2FUNCS, but as .cc files, and with cp/ prefixed
	(but not $(srcdir)).
	(CXX_LIB2FUNCS): Remove.
	(cplib2.txt): Put $(CXX_LIB2SRCS) in cplib2.txt.

	(tinfo.o, tinfo2.o, exception.o, new.o, opnew.o, opnewnt.o,
	opvnew.o, opvnewnt.o, opdel.o, opdelnt.o, opvdel.o,
	opvdelnt.o, vec.o): Delete rules.

	* new1.cc, new2.cc: Split into one file per function:
	* opnew.cc, opnewnt.cc, opvnew.cc, opvnewnt.cc, 
	  opdel.cc, opdelnt.cc, opvdel.cc, opvdelnt.cc: ... these.

===================================================================
Index: Makefile.in
--- Makefile.in	2000/06/21 18:41:38	1.469
+++ Makefile.in	2000/06/21 23:11:32
@@ -942,9 +942,12 @@ xlimits.h: glimits.h limitx.h limity.h
 
 LIB2ADD = $(LIB2ADDEH) $(LIB2FUNCS_EXTRA) $(LANG_LIB2FUNCS)
 
+# MAKEDEPS is double quoted because $(LIBGCC2_CFLAGS) may have '' and ``
+# in it.
 libgcc.mk: config.status Makefile mklibgcc $(LIB2ADD) xgcc$(exeext)
 	objext='$(objext)' \
 	OLDCC='$(OLDCC)' \
+	MAKEDEPS="$(GCC_FOR_TARGET) -M $(LIBGCC2_CFLAGS) $(INCLUDES)" \
 	LIBGCC1='$(LIBGCC1)' \
 	LIB1FUNCS='$(LIB1FUNCS)' \
 	LIB1ASMFUNCS='$(LIB1ASMFUNCS)' \
@@ -977,6 +980,7 @@ libgcc.a: $(LIBGCC_DEPS)
 	  RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \
 	  RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \
 	  LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \
+	  LIBGCC2_CXXFLAGS="$(CXXFLAGS) $(GXX_ABI_FLAG)" \
 	  INCLUDES="$(INCLUDES)" MAYBE_USE_COLLECT2="$(MAYBE_USE_COLLECT2)" \
 	  CONFIG_H="$(CONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \
 	  LIB1ASMSRC='$(LIB1ASMSRC)' \
===================================================================
Index: mklibgcc.in
--- mklibgcc.in	2000/06/06 01:56:06	1.13
+++ mklibgcc.in	2000/06/21 23:11:32
@@ -9,6 +9,7 @@
 #
 # objext
 # OLDCC
+# MAKEDEPS
 # LIBGCC1
 # LIB1FUNCS
 # LIB1ASMFUNCS
@@ -25,8 +26,9 @@
 # EXTRA_MULTILIB_PARTS
 
 # Make needs VPATH to be literal.
-echo 'srcdir = @srcdir@'
-echo 'VPATH = @srcdir@'
+srcdir=@srcdir@
+echo "srcdir = $srcdir"
+echo "VPATH = $srcdir"
 echo 'EQ = ='
 echo
 echo 'force:'
@@ -90,9 +92,10 @@ case X"$LIBGCC1" in
   Xlibgcc1-asm.a)
     for name in $LIB1ASMFUNCS; do
       for ml in $MULTILIBS; do
-        dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
+        dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`/
+	[ "$dir" = "./" ] && dir=
         flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
-        out="libgcc/${dir}/${name}${objext}"
+        out="libgcc/${dir}${name}${objext}"
 
         echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
 	echo "	$gcc_compile" $flags -DL$name -xassembler-with-cpp \
@@ -152,9 +155,10 @@ libgcc2_objs=""
 
 for name in $LIB2FUNCS; do
   for ml in $MULTILIBS; do
-    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
+    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`/
+    [ "$dir" = "./" ] && dir=
     flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
-    out="libgcc/${dir}/${name}${objext}"
+    out="libgcc/${dir}${name}${objext}"
 
     echo $out: $libgcc2_c_dep
     echo "	$gcc_compile" '$(MAYBE_USE_COLLECT2)' $flags -DL$name \
@@ -165,9 +169,10 @@ done
 
 for name in $LIB2FUNCS_EH; do
   for ml in $MULTILIBS; do
-    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
+    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`/
+    [ "$dir" = "./" ] && dir=
     flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
-    out="libgcc/${dir}/${name}${objext}"
+    out="libgcc/${dir}${name}${objext}"
 
     echo $out: $libgcc2_c_dep
     echo "	$gcc_compile" '$(MAYBE_USE_COLLECT2)' -fexceptions \
@@ -179,9 +184,10 @@ done
 if [ "$FPBIT" ]; then
   for name in $FPBIT_FUNCS; do
     for ml in $MULTILIBS; do
-      dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
+      dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`/
+      [ "$dir" = "./" ] && dir=
       flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
-      out="libgcc/${dir}/${name}${objext}"
+      out="libgcc/${dir}${name}${objext}"
 
       echo $out: $FPBIT $fpbit_c_dep
       echo "	$gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
@@ -194,9 +200,10 @@ fi
 if [ "$DPBIT" ]; then
   for name in $DPBIT_FUNCS; do
     for ml in $MULTILIBS; do
-      dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
+      dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`/
+      [ "$dir" = "./" ] && dir=
       flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
-      out="libgcc/${dir}/${name}${objext}"
+      out="libgcc/${dir}${name}${objext}"
 
       echo $out: $DPBIT $fpbit_c_dep
       echo "	$gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
@@ -206,71 +213,91 @@ if [ "$DPBIT" ]; then
   done
 fi
 
+XLIB2ADD=
 for file in $LIB2ADD; do
-  name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
-  oname=`echo $name | sed -e 's,.*/,,'`
-
-  if [ ${name}.txt = ${file} ]; then
-    fprime=`cat $file`
-    for f in $fprime; do
+  case $file in
+    *.txt)
+      XLIB2ADD="$XLIB2ADD `cat $file`" ;;
+    *)
+      XLIB2ADD="$XLIB2ADD $file";;
+  esac
+done
 
-      lastout="stmp-dirs $file"
-      for ml in $MULTILIBS; do
-        dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
-        flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
-        out="libgcc/${dir}/${f}"
+for file in $XLIB2ADD; do
+  oname=`echo $file | sed -e 's,^.*/,,' -e 's,\.[^.]*$,,`
+  known=no
+  xflags=
+  yflags=
+  lastout=
+
+  # xflags is applied to dependency calculation, yflags isn't.
+  case $file in
+    *.c)	known=yes;;
+    *.S)	known=yes;;
+    *.asm)	known=yes; xflags="-xassembler-with-cpp";;
+    *.cc)	known=yes; yflags='$(LIBGCC2_CXXFLAGS)';;
+  esac
+
+  # If we know how, calculate dependencies for this file.
+  if [ $known = yes ]; then
+    case $file in
+      $srcdir/*) src=$file ;;
+	      *) src="$srcdir/$file" ;;
+    esac
+    deps=`$MAKEDEPS $xflags $src | \
+	sed -e 's/^[^:]*: //' -e s,"$srcdir",'$(srcdir)',g -e 's/ \\\\//g'`
+  fi
 
-	# Depend on previous out to serialize all sub-makes of this
-	# target file.  This because ./$f is used as a temporary in
-	# each case before being moved to libgcc/$dir/.
-	echo $out: $lastout
-	echo "	$make_compile" \\
-	echo '	  LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
-	echo '	  MULTILIB_CFLAGS="'$flags'"' $f
-	echo "	mv $f $out"
+  for ml in $MULTILIBS; do
+    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`/
+    [ "$dir" = "./" ] && dir=
+    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
 
-	lastout="$out"
-      done
+    if [ $known = yes ]; then
+      out="libgcc/${dir}${oname}${objext}"
+      libgcc2_objs="$libgcc2_objs ${oname}${objext}"
 
-      libgcc2_objs="$libgcc2_objs $f"
-    done
-  else
-    for ml in $MULTILIBS; do
-      dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
-      flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
-      out="libgcc/${dir}/${oname}${objext}"
-      if [ ${name}.asm = ${file} ]; then
-	flags="$flags -xassembler-with-cpp"
-      fi
+      echo $out: stmp-dirs $deps
+      echo "	$gcc_compile" $xflags $yflags $flags -c $src -o $out
+    else
+      out="libgcc/${dir}${file}"
+      libgcc2_objs="$libgcc2_objs $file"
 
-      echo $out: stmp-dirs $file
-      echo "	$gcc_compile" $flags -c $file -o $out
-    done
-    libgcc2_objs="$libgcc2_objs ${oname}${objext}"
-  fi
+      # Depend on previous out to serialize all sub-makes of this
+      # target file.  This because $file is used as a temporary in
+      # each case before being moved to libgcc/$dir/.
+      echo $out: $lastout
+      echo "	$make_compile" \\
+      echo '	  LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
+      echo '	  MULTILIB_CFLAGS="'$flags'"' $file
+      echo "	mv $file $out"
+      lastout="$out"
+    fi
+  done
 done
 
 for ml in $MULTILIBS; do
-  dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
+  dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`/
+  [ "$dir" = "./" ] && dir=
 
   libgcc_objs=""
   for o in $libgcc1_objs; do
     if [ "$LIBGCC1" = libgcc1-asm.a ]; then
-      libgcc_objs="$libgcc_objs libgcc/${dir}/$o"
+      libgcc_objs="$libgcc_objs libgcc/${dir}$o"
     else
       libgcc_objs="$libgcc_objs libgcc/$o"
     fi
   done
   for o in $libgcc2_objs; do
-    libgcc_objs="$libgcc_objs libgcc/${dir}/$o"
+    libgcc_objs="$libgcc_objs libgcc/${dir}$o"
   done
 
   echo ""
-  echo "${dir}/libgcc.a: $libgcc_objs"
-  echo "	-rm -rf ${dir}/libgcc.a"
-  echo '	$(AR_CREATE_FOR_TARGET)' ${dir}/libgcc.a $libgcc_objs
+  echo "${dir}libgcc.a: $libgcc_objs"
+  echo "	-rm -rf ${dir}libgcc.a"
+  echo '	$(AR_CREATE_FOR_TARGET)' ${dir}libgcc.a $libgcc_objs
   echo '	if $(RANLIB_TEST_FOR_TARGET) ; then' \\
-  echo '	  $(RANLIB_FOR_TARGET)' ${dir}/libgcc.a ';' \\
+  echo '	  $(RANLIB_FOR_TARGET)' ${dir}libgcc.a ';' \\
   echo '	else true; fi;'
 done
 
@@ -295,9 +322,10 @@ echo '	if [ -f stmp-dirs ]; then true; e
 for f in $EXTRA_MULTILIB_PARTS; do
   lastout="stmp-dirs force"
   for ml in $MULTILIBS; do
-    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
+    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`/
+    [ "$dir" = "./" ] && dir=
     flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
-    out="$dir/$f"
+    out="${dir}${f}"
 
     # Depend on previous out to serialize all sub-makes of this
     # target file.  This because ./$f is used as a temporary in
===================================================================
Index: cp/Make-lang.in
--- cp/Make-lang.in	2000/06/14 17:26:18	1.55
+++ cp/Make-lang.in	2000/06/21 23:11:32
@@ -61,11 +61,10 @@ CXX_EXTRA_HEADERS = $(srcdir)/cp/inc/typ
 	$(srcdir)/cp/inc/new $(srcdir)/cp/inc/new.h $(srcdir)/cp/inc/cxxabi.h
 
 # Extra code to include in libgcc2.
-CXX_LIB2FUNCS = tinfo.o tinfo2.o new.o opnew.o opnewnt.o opvnew.o opvnewnt.o \
-	opdel.o opdelnt.o opvdel.o opvdelnt.o exception.o vec.o
-CXX_LIB2SRCS = $(srcdir)/cp/new.cc $(srcdir)/cp/new1.cc $(srcdir)/cp/new2.cc \
-	$(srcdir)/cp/exception.cc $(srcdir)/cp/tinfo.cc \
-	$(srcdir)/cp/tinfo2.cc $(srcdir)/cp/tinfo.h
+CXX_LIB2SRCS  = cp/tinfo.cc cp/tinfo2.cc cp/exception.cc cp/vec.cc cp/new.cc \
+		cp/opnew.cc cp/opnewnt.cc cp/opvnew.cc cp/opvnewnt.cc \
+		cp/opdel.cc cp/opdelnt.cc cp/opvdel.cc cp/opvdelnt.cc
+
 #
 # Define the names for selecting c++ in LANGUAGES.
 # Note that it would be nice to move the dependency on g++
@@ -138,52 +137,11 @@ c++.rest.encap: $(DEMANGLER_PROG)
 c++.info:
 c++.dvi:
 
-# C++ language-support library pieces for libgcc.
-tinfo.o: cc1plus$(exeext) $(srcdir)/cp/tinfo.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c $(srcdir)/cp/tinfo.cc
-tinfo2.o: cc1plus$(exeext) $(srcdir)/cp/tinfo2.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c $(srcdir)/cp/tinfo2.cc
-exception.o: cc1plus$(exeext) $(srcdir)/cp/exception.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c -fexceptions $(srcdir)/cp/exception.cc
-new.o: cc1plus$(exeext) $(srcdir)/cp/new.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c $(srcdir)/cp/new.cc
-opnew.o: cc1plus$(exeext) $(srcdir)/cp/new1.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c $(srcdir)/cp/new1.cc -DL_op_new -o opnew.o
-opnewnt.o: cc1plus$(exeext) $(srcdir)/cp/new1.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c $(srcdir)/cp/new1.cc -DL_op_newnt -o opnewnt.o
-opvnew.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c $(srcdir)/cp/new2.cc -DL_op_vnew -o opvnew.o
-opvnewnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c $(srcdir)/cp/new2.cc -DL_op_vnewnt -o opvnewnt.o
-opdel.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c $(srcdir)/cp/new2.cc -DL_op_delete -o opdel.o
-opdelnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c $(srcdir)/cp/new2.cc -DL_op_delnt -o opdelnt.o
-opvdel.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c $(srcdir)/cp/new2.cc -DL_op_vdel -o opvdel.o
-opvdelnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c $(srcdir)/cp/new2.cc -DL_op_vdelnt -o opvdelnt.o
-vec.o: cc1plus$(exeext) $(srcdir)/cp/vec.cc
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-	  -c $(srcdir)/cp/vec.cc -o vec.o
-
 # We want to update cplib2.txt if any of the source files change...
 cplib2.txt: $(CXX_LIB2SRCS) $(CXX_EXTRA_HEADERS)
 	case " $(LANGUAGES) " in \
 	*" "[cC]"++ "*) \
-	  echo $(CXX_LIB2FUNCS) > cplib2.new;; \
+	  echo $(CXX_LIB2SRCS) > cplib2.new;; \
 	*) \
 	  echo "" > cplib2.new;; \
 	esac
===================================================================
Index: cp/new1.cc
--- cp/new1.cc	Wed Jun 21 16:11:34 2000
+++ cp/new1.cc	Tue May  5 13:32:27 1998
@@ -1,91 +0,0 @@
-// Support routines for the -*- C++ -*- dynamic memory management.
-// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
-
-// This file is part of GNU CC.
-
-// GNU CC is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// GNU CC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with GNU CC; see the file COPYING.  If not, write to
-// the Free Software Foundation, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include "new"
-using std::new_handler;
-using std::bad_alloc;
-
-extern "C" void *malloc (size_t);
-extern new_handler __new_handler;
-
-#define WEAK(x) \
-  x __attribute__ ((weak)); \
-  x
-
-#ifdef L_op_newnt
-WEAK (void * operator new (size_t sz, const std::nothrow_t&) throw())
-{
-  void *p;
-
-  /* malloc (0) is unpredictable; avoid it.  */
-  if (sz == 0)
-    sz = 1;
-  p = (void *) malloc (sz);
-  while (p == 0)
-    {
-      new_handler handler = __new_handler;
-      if (! handler)
-	return 0;
-      try
-	{
-	  handler ();
-	}
-      catch (bad_alloc &)
-	{
-	  return 0;
-	}
-
-      p = (void *) malloc (sz);
-    }
-
-  return p;
-}
-#endif
-
-#ifdef L_op_new
-WEAK (void * operator new (size_t sz) throw (std::bad_alloc))
-{
-  void *p;
-
-  /* malloc (0) is unpredictable; avoid it.  */
-  if (sz == 0)
-    sz = 1;
-  p = (void *) malloc (sz);
-  while (p == 0)
-    {
-      new_handler handler = __new_handler;
-      if (! handler)
-	throw bad_alloc ();
-      handler ();
-      p = (void *) malloc (sz);
-    }
-
-  return p;
-}
-#endif
===================================================================
Index: cp/new2.cc
--- cp/new2.cc	Wed Jun 21 16:11:34 2000
+++ cp/new2.cc	Tue May  5 13:32:27 1998
@@ -1,80 +0,0 @@
-// Boilerplate support routines for -*- C++ -*- dynamic memory management.
-// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
-
-// This file is part of GNU CC.
-
-// GNU CC is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// GNU CC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with GNU CC; see the file COPYING.  If not, write to
-// the Free Software Foundation, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include "new"
-
-extern "C" void free (void *);
-
-#define WEAK(x) \
-  x __attribute__ ((weak)); \
-  x
-
-#ifdef L_op_vnew
-WEAK(void * operator new[] (size_t sz) throw (std::bad_alloc))
-{
-  return ::operator new(sz);
-}
-#endif
-
-#ifdef L_op_vnewnt
-WEAK(void *operator new[] (size_t sz, const std::nothrow_t& nothrow) throw())
-{
-  return ::operator new(sz, nothrow);
-}
-#endif
-
-#ifdef L_op_delete
-WEAK (void operator delete (void *ptr) throw ())
-{
-  if (ptr)
-    free (ptr);
-}
-#endif
-
-#ifdef L_op_vdel
-WEAK (void operator delete[] (void *ptr) throw ())
-{
-  ::operator delete (ptr);
-}
-#endif
-
-#ifdef L_op_delnt
-WEAK (void operator delete (void *ptr, const std::nothrow_t&) throw ())
-{
-  if (ptr)
-    free (ptr);
-}
-#endif
-
-#ifdef L_op_vdelnt
-WEAK (void operator delete[] (void *ptr, const std::nothrow_t&) throw ())
-{
-  ::operator delete (ptr);
-}
-#endif
===================================================================
Index: cp/opdel.cc
--- cp/opdel.cc	Tue May  5 13:32:27 1998
+++ cp/opdel.cc	Wed Jun 21 16:11:34 2000
@@ -0,0 +1,42 @@
+// Boilerplate support routines for -*- C++ -*- dynamic memory management.
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+
+// This file is part of GNU CC.
+
+// GNU CC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// GNU CC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GNU CC; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include "new"
+
+extern "C" void free (void *);
+
+#define WEAK(x) \
+  x __attribute__ ((weak)); \
+  x
+
+WEAK (void operator delete (void *ptr) throw ())
+{
+  if (ptr)
+    free (ptr);
+}
===================================================================
Index: cp/opdelnt.cc
--- cp/opdelnt.cc	Tue May  5 13:32:27 1998
+++ cp/opdelnt.cc	Wed Jun 21 16:11:34 2000
@@ -0,0 +1,42 @@
+// Boilerplate support routines for -*- C++ -*- dynamic memory management.
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+
+// This file is part of GNU CC.
+
+// GNU CC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// GNU CC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GNU CC; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include "new"
+
+extern "C" void free (void *);
+
+#define WEAK(x) \
+  x __attribute__ ((weak)); \
+  x
+
+WEAK (void operator delete (void *ptr, const std::nothrow_t&) throw ())
+{
+  if (ptr)
+    free (ptr);
+}
===================================================================
Index: cp/opnew.cc
--- cp/opnew.cc	Tue May  5 13:32:27 1998
+++ cp/opnew.cc	Wed Jun 21 16:11:34 2000
@@ -0,0 +1,59 @@
+// Support routines for the -*- C++ -*- dynamic memory management.
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+
+// This file is part of GNU CC.
+
+// GNU CC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// GNU CC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GNU CC; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include "new"
+using std::new_handler;
+using std::bad_alloc;
+
+extern "C" void *malloc (size_t);
+extern new_handler __new_handler;
+
+#define WEAK(x) \
+  x __attribute__ ((weak)); \
+  x
+
+WEAK (void * operator new (size_t sz) throw (std::bad_alloc))
+{
+  void *p;
+
+  /* malloc (0) is unpredictable; avoid it.  */
+  if (sz == 0)
+    sz = 1;
+  p = (void *) malloc (sz);
+  while (p == 0)
+    {
+      new_handler handler = __new_handler;
+      if (! handler)
+	throw bad_alloc ();
+      handler ();
+      p = (void *) malloc (sz);
+    }
+
+  return p;
+}
===================================================================
Index: cp/opnewnt.cc
--- cp/opnewnt.cc	Tue May  5 13:32:27 1998
+++ cp/opnewnt.cc	Wed Jun 21 16:11:34 2000
@@ -0,0 +1,67 @@
+// Support routines for the -*- C++ -*- dynamic memory management.
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+
+// This file is part of GNU CC.
+
+// GNU CC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// GNU CC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GNU CC; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include "new"
+using std::new_handler;
+using std::bad_alloc;
+
+extern "C" void *malloc (size_t);
+extern new_handler __new_handler;
+
+#define WEAK(x) \
+  x __attribute__ ((weak)); \
+  x
+
+WEAK (void * operator new (size_t sz, const std::nothrow_t&) throw())
+{
+  void *p;
+
+  /* malloc (0) is unpredictable; avoid it.  */
+  if (sz == 0)
+    sz = 1;
+  p = (void *) malloc (sz);
+  while (p == 0)
+    {
+      new_handler handler = __new_handler;
+      if (! handler)
+	return 0;
+      try
+	{
+	  handler ();
+	}
+      catch (bad_alloc &)
+	{
+	  return 0;
+	}
+
+      p = (void *) malloc (sz);
+    }
+
+  return p;
+}
===================================================================
Index: cp/opvdel.cc
--- cp/opvdel.cc	Tue May  5 13:32:27 1998
+++ cp/opvdel.cc	Wed Jun 21 16:11:34 2000
@@ -0,0 +1,41 @@
+// Boilerplate support routines for -*- C++ -*- dynamic memory management.
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+
+// This file is part of GNU CC.
+
+// GNU CC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// GNU CC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GNU CC; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include "new"
+
+extern "C" void free (void *);
+
+#define WEAK(x) \
+  x __attribute__ ((weak)); \
+  x
+
+WEAK (void operator delete[] (void *ptr) throw ())
+{
+  ::operator delete (ptr);
+}
===================================================================
Index: cp/opvdelnt.cc
--- cp/opvdelnt.cc	Tue May  5 13:32:27 1998
+++ cp/opvdelnt.cc	Wed Jun 21 16:11:34 2000
@@ -0,0 +1,41 @@
+// Boilerplate support routines for -*- C++ -*- dynamic memory management.
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+
+// This file is part of GNU CC.
+
+// GNU CC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// GNU CC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GNU CC; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include "new"
+
+extern "C" void free (void *);
+
+#define WEAK(x) \
+  x __attribute__ ((weak)); \
+  x
+
+WEAK (void operator delete[] (void *ptr, const std::nothrow_t&) throw ())
+{
+  ::operator delete (ptr);
+}
===================================================================
Index: cp/opvnew.cc
--- cp/opvnew.cc	Tue May  5 13:32:27 1998
+++ cp/opvnew.cc	Wed Jun 21 16:11:34 2000
@@ -0,0 +1,41 @@
+// Boilerplate support routines for -*- C++ -*- dynamic memory management.
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+
+// This file is part of GNU CC.
+
+// GNU CC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// GNU CC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GNU CC; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include "new"
+
+extern "C" void free (void *);
+
+#define WEAK(x) \
+  x __attribute__ ((weak)); \
+  x
+
+WEAK(void * operator new[] (size_t sz) throw (std::bad_alloc))
+{
+  return ::operator new(sz);
+}
===================================================================
Index: cp/opvnewnt.cc
--- cp/opvnewnt.cc	Tue May  5 13:32:27 1998
+++ cp/opvnewnt.cc	Wed Jun 21 16:11:34 2000
@@ -0,0 +1,41 @@
+// Boilerplate support routines for -*- C++ -*- dynamic memory management.
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+
+// This file is part of GNU CC.
+
+// GNU CC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// GNU CC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GNU CC; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include "new"
+
+extern "C" void free (void *);
+
+#define WEAK(x) \
+  x __attribute__ ((weak)); \
+  x
+
+WEAK(void *operator new[] (size_t sz, const std::nothrow_t& nothrow) throw())
+{
+  return ::operator new(sz, nothrow);
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]