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]

Implicit declaration fixes, libiberty


This is a wee bit hairier than the fixes in the target only libraries.
I've not made any effort to find prototypes in non-ANSI headers
(strings.h, memory.h, etc), but the defaults should be sane.

zw


	* hashtab.c, partition.c, sort.c, xmemdup.c: Include string.h
	if HAVE_STRING_H.
	* pexecute.c, xexit.c: Include stdlib.h if HAVE_STDLIB_H.
	* objalloc.c: Include config.h.  Include stdlib.h and don't
	declare malloc or free if HAVE_STDLIB_H.
	* strerror.c, strsignal.c: Include stdlib.h if HAVE_STDLIB_H,
	else declare malloc without prototype.  Include string.h if
	HAVE_STRING_H, else declare memset without prototype.  Don't
	include stddef.h.

===================================================================
Index: hashtab.c
--- hashtab.c	2000/05/16 16:59:20	1.15
+++ hashtab.c	2000/05/28 05:09:08
@@ -41,6 +41,10 @@ Boston, MA 02111-1307, USA.  */
 #include <stdlib.h>
 #endif
 
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
 #include <stdio.h>
 
 #include "libiberty.h"
===================================================================
Index: objalloc.c
--- objalloc.c	1999/01/11 13:51:12	1.4
+++ objalloc.c	2000/05/28 05:09:08
@@ -18,6 +18,8 @@ Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
 #include "ansidecl.h"
+#include "config.h"
+
 #include "objalloc.h"
 
 /* Get a definition for NULL.  */
@@ -33,9 +35,14 @@ Boston, MA 02111-1307, USA.  */
 #include <stddef.h>
 #endif
 
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#else
 /* For systems with larger pointers than ints, this must be declared.  */
 extern PTR malloc PARAMS ((size_t));
 extern void free PARAMS ((PTR));
+#endif
+
 #endif
 
 /* These routines allocate space for an object.  Freeing allocated
===================================================================
Index: partition.c
--- partition.c	2000/03/10 08:16:55	1.1
+++ partition.c	2000/05/28 05:09:08
@@ -27,6 +27,10 @@
 #include <stdlib.h>
 #endif
 
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
 #include "libiberty.h"
 #include "partition.h"
 
===================================================================
Index: pexecute.c
--- pexecute.c	2000/03/24 21:32:08	1.16
+++ pexecute.c	2000/05/28 05:09:09
@@ -35,6 +35,9 @@ Boston, MA 02111-1307, USA.  */
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 #define ISSPACE (x) isspace(x)
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
===================================================================
Index: sort.c
--- sort.c	2000/05/04 15:40:25	1.3
+++ sort.c	2000/05/28 05:09:09
@@ -28,6 +28,9 @@ Boston, MA 02111-1307, USA.  */
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 
 #ifndef UCHAR_MAX
 #define UCHAR_MAX ((unsigned char)(-1))
===================================================================
Index: strerror.c
--- strerror.c	1998/05/15 23:42:41	1.3
+++ strerror.c	2000/05/28 05:09:09
@@ -25,14 +25,17 @@
 
 /*  Routines imported from standard C runtime libraries. */
 
-#ifdef __STDC__
-#include <stddef.h>
-extern void *malloc (size_t size);				/* 4.10.3.3 */
-extern void *memset (void *s, int c, size_t n);			/* 4.11.6.1 */
-#else	/* !__STDC__ */
-extern char *malloc ();		/* Standard memory allocater */
-extern char *memset ();
-#endif	/* __STDC__ */
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#else
+extern PTR malloc ();
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+extern PTR memset ();
+#endif
 
 #ifndef MAX
 #  define MAX(a,b) ((a) > (b) ? (a) : (b))
===================================================================
Index: strsignal.c
--- strsignal.c	1998/05/15 23:42:42	1.5
+++ strsignal.c	2000/05/28 05:09:09
@@ -23,14 +23,17 @@
 
 /*  Routines imported from standard C runtime libraries. */
 
-#ifdef __STDC__
-#include <stddef.h>
-extern void *malloc (size_t size);				/* 4.10.3.3 */
-extern void *memset (void *s, int c, size_t n);			/* 4.11.6.1 */
-#else	/* !__STDC__ */
-extern char *malloc ();		/* Standard memory allocater */
-extern char *memset ();
-#endif	/* __STDC__ */
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#else
+extern PTR malloc ();
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+extern PTR memset ();
+#endif
 
 /* Undefine the macro we used to hide the definition of sys_siglist
    found in the system header files.  */
===================================================================
Index: xexit.c
--- xexit.c	1998/05/15 23:14:58	1.2
+++ xexit.c	2000/05/28 05:09:09
@@ -21,6 +21,9 @@ Boston, MA 02111-1307, USA.  */
 #include "libiberty.h"
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 
 /* This variable is set by xatexit if it is called.  This way, xmalloc
    doesn't drag xatexit into the link.  */
===================================================================
Index: xmemdup.c
--- xmemdup.c	1999/09/09 00:11:39	1.2
+++ xmemdup.c	2000/05/28 05:09:09
@@ -9,6 +9,9 @@
 #include "libiberty.h"
 
 #include <sys/types.h> /* For size_t. */
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 
 PTR
 xmemdup (input, copy_size, alloc_size)

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