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]

Re: bcopy -> memcpy/memmove transition proposal [patch]


OK, let's try using libiberty.  Here is the first, trivial patch,
which links in *host* libiberty.  This does not handle programs
that run in the *build* environment, but it does allow us to
start changing the old BSD calls to POSIX calls in most of the
code.

Comments?  Some subtlety I'm missing?

	--Per Bothner
Cygnus Solutions     bothner@cygnus.com     http://www.cygnus.com/~bothner

	* Makefile.in (LIBS):  Link in libiberty.a.
	* c-common.c, gcc.c, toplev.c:  Repalce (some) bcopy calls by memcpy.
Index: Makefile.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/Makefile.in,v
retrieving revision 1.171
diff -u -r1.171 Makefile.in
--- Makefile.in	1998/09/16 13:51:44	1.171
+++ Makefile.in	1998/09/21 02:08:33
@@ -547,7 +547,8 @@
 
 # How to link with both our special library facilities
 # and the system's installed libraries.
-LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(VFPRINTF) $(DOPRINT) $(CLIB)
+LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(VFPRINTF) $(DOPRINT) $(CLIB) \
+	../libiberty/libiberty.a
 
 # Likewise, for use in the tools that must run on this machine
 # even if we are cross-building GCC.
Index: c-common.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/c-common.c,v
retrieving revision 1.31
diff -u -r1.31 c-common.c
--- c-common.c	1998/09/02 09:59:54	1.31
+++ c-common.c	1998/09/21 02:08:33
@@ -270,7 +270,7 @@
 			? wchar_bytes : 1));
 	  if ((TREE_TYPE (t) == wchar_array_type_node) == wide_flag)
 	    {
-	      bcopy (TREE_STRING_POINTER (t), q, len);
+	      memcpy (q, TREE_STRING_POINTER (t), len);
 	      q += len;
 	    }
 	  else
Index: gcc.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/gcc.c,v
retrieving revision 1.54
diff -u -r1.54 gcc.c
--- gcc.c	1998/09/04 12:58:40	1.54
+++ gcc.c	1998/09/21 02:08:34
@@ -1884,7 +1884,7 @@
   /* Add a new environment variable */
   environ = (char **) xmalloc (sizeof (char *) * (num_envs+2));
   *environ = str;
-  bcopy ((char *) old_environ, (char *) (environ + 1),
+  memcpy ((char *) (environ + 1), (char *) old_environ,
 	 sizeof (char *) * (num_envs+1));
 
 #endif	/* VMS */
@@ -4584,8 +4584,8 @@
   /* Construct the path from the two parts.  Ensure the string ends with "/.".
      The resulting path will be a directory even if the given path is a
      symbolic link.  */
-  bcopy (path1, path, len1);
-  bcopy (path2, path + len1, len2);
+  memcpy (path, path1, len1);
+  memcpy (path + len1, path2, len2);
   cp = path + len1 + len2;
   if (cp[-1] != '/' && cp[-1] != DIR_SEPARATOR)
     *cp++ = DIR_SEPARATOR;
Index: toplev.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/toplev.c,v
retrieving revision 1.95
diff -u -r1.95 toplev.c
--- toplev.c	1998/09/18 20:54:54	1.95
+++ toplev.c	1998/09/21 02:08:36
@@ -2295,10 +2295,10 @@
 
   float_handled = 1;
   if (was_handled)
-    bcopy ((char *) float_handler, (char *) old_handler,
+    memcpy ((char *) old_handler, (char *) float_handler,
 	   sizeof (float_handler));
 
-  bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
+  memcpy ((char *) float_handler, (char *) handler, sizeof (float_handler));
   return was_handled;
 }
 


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