This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


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

patch: various missing includes


This patch adds lots of missing includes. Most of them are straight from
POSIX 1003.1. Exceptions: all the reent.h things, strdup (assumption: from
string.h) and gettimeofday (assumption: from sys/time.h).

85 warnings left ...

- Werner

---------------------------------- ChangeLog ----------------------------------

2000-08-23  Werner Almesberger  <Werner.Almesberger@epfl.ch>
	* libc/stdlib/abort.c: changed description: uses "raise" instead of
	"getpid" and "kill"; added: uses "write" and "_exit"
	* libc/stdlib/abort.c: included unistd.h for "_exit" prototype
	* libc/stdlib/system.c: included unistd.h for "execve" prototype,
	reent.h for "_fork_r" and "_wait_r" prototypes
	* libc/stdlib/system.c (do_system): changed  extern char *environ[];
	to POSIX-friendly extern char **environ;
	* libc/stdlib/wctomb_r.c: included string.h for "strlen" and "strcmp"
	prototypes
	* libc/stdlib/remove.c: included reent.h for "_unlink_r" prototype
	* libc/reent/execr.c: included sys/wait.h for "wait" prototype
	* libc/reent/fstatr.c: included sys/stat.h for "fstat" prototype
	* libc/reent/openr.c: included fcntl.h for "open" prototype
	* libc/reent/signalr.c: included signal.h for "kill" prototype,
	unistd.h for "getpid" prototype
	* libc/reent/statr.c: included sys/stat.h for "stat" prototype
	* libc/reent/timer.c: included sys/time.h for "gettimeofday" prototype
	* libc/unix/getut.c (utmpname): removed local, incorrect "strdup"
	prototype
	* libc/unix/getut.c: included stdlib.h for "abort", string.h for
	"strdup" and "strncmp" prototypes
	* libc/unix/getlogin.c: included string.h for "strncmp", "memset", and
	"strncpy", unistd.h for "read" and "close" prototypes
	* libc/posix/execvp.c: included string.h for "strchr", "strlen", and
	"strcat" prototypes

------------------------------------ patch ------------------------------------

--- orig/newlib/libc/stdlib/abort.c	Thu Feb 17 20:39:47 2000
+++ src/newlib/libc/stdlib/abort.c	Wed Aug 23 15:12:17 2000
@@ -43,10 +43,11 @@
 PORTABILITY
 ANSI C requires <<abort>>.
 
-Supporting OS subroutines required: <<getpid>>, <<kill>>.
+Supporting OS subroutines required: <<write>>, <<raise>>, <<_exit>>.
 */
 
 #include <stdlib.h>
+#include <unistd.h>
 #include <signal.h>
 
 _VOID
--- orig/newlib/libc/stdlib/system.c	Thu Feb 17 20:39:48 2000
+++ src/newlib/libc/stdlib/system.c	Wed Aug 23 15:23:18 2000
@@ -56,7 +56,9 @@
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <_syslist.h>
+#include <reent.h>
 
 #if defined (unix) || defined (__CYGWIN32__)
 static int do_system ();
@@ -112,7 +114,7 @@
 {
   char *argv[4];
   int pid, status;
-  extern char *environ[];
+  extern char **environ;
 
   argv[0] = "sh";
   argv[1] = "-c";
--- orig/newlib/libc/stdlib/wctomb_r.c	Thu Feb 17 20:39:48 2000
+++ src/newlib/libc/stdlib/wctomb_r.c	Wed Aug 23 15:16:48 2000
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include <string.h>
 #include <locale.h>
 #include "mbctype.h"
 
--- orig/newlib/libc/stdio/remove.c	Thu Feb 17 20:39:47 2000
+++ src/newlib/libc/stdio/remove.c	Wed Aug 23 15:25:55 2000
@@ -45,6 +45,7 @@
 */
 
 #include <stdio.h>
+#include <reent.h>
 
 int
 _remove_r (ptr, filename)
--- orig/newlib/libc/reent/execr.c	Thu Feb 17 20:39:47 2000
+++ src/newlib/libc/reent/execr.c	Wed Aug 23 15:27:38 2000
@@ -3,6 +3,7 @@
 
 #include <reent.h>
 #include <unistd.h>
+#include <sys/wait.h>
 #include <_syslist.h>
 
 /* Some targets provides their own versions of these functions.  Those
--- orig/newlib/libc/reent/fstatr.c	Thu Feb 17 20:39:47 2000
+++ src/newlib/libc/reent/fstatr.c	Wed Aug 23 15:29:20 2000
@@ -3,6 +3,7 @@
 
 #include <reent.h>
 #include <unistd.h>
+#include <sys/stat.h>
 #include <_syslist.h>
 
 /* Some targets provides their own versions of these functions.  Those
--- orig/newlib/libc/reent/openr.c	Thu Feb 17 20:39:47 2000
+++ src/newlib/libc/reent/openr.c	Wed Aug 23 15:31:16 2000
@@ -2,6 +2,7 @@
 
 #include <reent.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include <_syslist.h>
 
 /* Some targets provides their own versions of this functions.  Those
--- orig/newlib/libc/reent/signalr.c	Thu Feb 17 20:39:47 2000
+++ src/newlib/libc/reent/signalr.c	Wed Aug 23 15:35:10 2000
@@ -2,6 +2,8 @@
    These implementations just call the usual system calls.  */
 
 #include <reent.h>
+#include <signal.h>
+#include <unistd.h>
 #include <_syslist.h>
 
 /* Some targets provides their own versions of these functions.  Those
--- orig/newlib/libc/reent/statr.c	Thu Feb 17 20:39:47 2000
+++ src/newlib/libc/reent/statr.c	Wed Aug 23 15:38:23 2000
@@ -3,6 +3,7 @@
 
 #include <reent.h>
 #include <unistd.h>
+#include <sys/stat.h>
 #include <_syslist.h>
 
 /* Some targets provides their own versions of these functions.  Those
--- orig/newlib/libc/reent/timer.c	Thu Feb 17 20:39:47 2000
+++ src/newlib/libc/reent/timer.c	Wed Aug 23 15:40:28 2000
@@ -6,6 +6,7 @@
 
 #include <reent.h>
 #include <time.h>
+#include <sys/time.h>
 #include <sys/times.h>
 #include <_syslist.h>
 
--- orig/newlib/libc/unix/getut.c	Tue Aug 22 21:04:49 2000
+++ src/newlib/libc/unix/getut.c	Wed Aug 23 15:44:15 2000
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+#include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <utmp.h>
@@ -29,8 +31,6 @@
 void
 utmpname (_CONST char *file)
 {
-  extern char *strdup (char *);
-
   utmp_file = strdup (file);
 }
 
--- orig/newlib/libc/unix/getlogin.c	Thu Feb 17 20:39:51 2000
+++ src/newlib/libc/unix/getlogin.c	Wed Aug 23 15:47:48 2000
@@ -1,3 +1,5 @@
+#include <string.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <utmp.h>
 #include <fcntl.h>
--- orig/newlib/libc/posix/execvp.c	Sun Apr 16 12:53:02 2000
+++ src/newlib/libc/posix/execvp.c	Wed Aug 23 15:49:31 2000
@@ -6,6 +6,7 @@
 #include <_ansi.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <string.h>
 #include <errno.h>
 #include <ctype.h>
 
-- 
  _________________________________________________________________________
 / Werner Almesberger, ICA, EPFL, CH       werner.almesberger@ica.epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/

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