delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/12/02/08:56:40

Message-ID: <3A290D90.C424D8F4@softhome.net>
Date: Sat, 02 Dec 2000 15:56:16 +0100
From: Laurynas Biveinis <lauras AT softhome DOT net>
X-Mailer: Mozilla 4.76 [en] (Win98; U)
X-Accept-Language: lt,en
MIME-Version: 1.0
To: DJGPP Workers <djgpp-workers AT delorie DOT com>
Subject: Patch: make GCC & DJGPP headers compatible
Reply-To: djgpp-workers AT delorie DOT com

I hope this is the last time I have to raise this issue...

The major obstacle about header compatibility has vanished - we
can be sure that GCC headers define size_t etc. in the right way.

So the only thing left to do is to avoid redefinition warnings,
and my patch does that. Tested under DOS with GCC 2.95.2 and with
a GCC 2.97 cross-compiler from Linux.

OK to apply this time?

Laurynas

Index: djgpp/include/glob.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/glob.h,v
retrieving revision 1.1
diff -u -r1.1 glob.h
--- glob.h      1995/03/21 09:01:00     1.1
+++ glob.h      2000/12/02 13:51:37
@@ -12,9 +12,10 @@

 #include <sys/djtypes.h>

+#ifndef _SIZE_T
 __DJ_size_t
-#undef __DJ_size_t
-#define __DJ_size_t
+#define _SIZE_T
+#endif

 typedef struct {
   size_t gl_pathc;
Index: djgpp/include/go32.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/go32.h,v
retrieving revision 1.2
diff -u -r1.2 go32.h
--- go32.h      1998/11/15 14:14:42     1.2
+++ go32.h      2000/12/02 13:51:37
@@ -16,9 +16,10 @@
 #include <sys/version.h>
 #include <sys/djtypes.h>

+#ifndef _SIZE_T
 __DJ_size_t
-#undef __DJ_size_t
-#define __DJ_size_t
+#define _SIZE_T
+#endif

 typedef struct {
   unsigned long  size_of_this_structure_in_bytes;
Index: djgpp/include/grp.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/grp.h,v
retrieving revision 1.1
diff -u -r1.1 grp.h
--- grp.h       1995/04/01 22:29:54     1.1
+++ grp.h       2000/12/02 13:51:37
@@ -11,9 +11,11 @@
 #ifndef __STRICT_ANSI__

 #include <sys/djtypes.h>
+
+#ifndef _GID_T
 __DJ_gid_t
-#undef __DJ_gid_t
-#define __DJ_gid_t
+#define _GID_T
+#endif

 struct group {
   gid_t                gr_gid;
Index: djgpp/include/pwd.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/pwd.h,v
retrieving revision 1.1
diff -u -r1.1 pwd.h
--- pwd.h       1995/02/27 03:31:44     1.1
+++ pwd.h       2000/12/02 13:51:38
@@ -12,12 +12,14 @@

 #include <sys/djtypes.h>

+#ifndef _GID_T
 __DJ_gid_t
-#undef __DJ_gid_t
-#define __DJ_gid_t
+#define _GID_T
+#endif
+#ifndef _UID_T
 __DJ_uid_t
-#undef __DJ_uid_t
-#define __DJ_uid_t
+#define _UID_T
+#endif

 struct passwd {
   char *       pw_name;
Index: djgpp/include/signal.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/signal.h,v
retrieving revision 1.3
diff -u -r1.3 signal.h
--- signal.h    1998/07/13 08:12:04     1.3
+++ signal.h    2000/12/02 13:51:38
@@ -24,9 +24,10 @@
 #define SIG_ERR        ((void (*)(int))(1))
 #define SIG_IGN        ((void (*)(int))(-1))

+#ifndef _PID_T
 __DJ_pid_t
-#undef __DJ_pid_t
-#define __DJ_pid_t
+#define _PID_T
+#endif

 typedef int sig_atomic_t;

Index: djgpp/include/stdarg.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/stdarg.h,v
retrieving revision 1.5
diff -u -r1.5 stdarg.h
--- stdarg.h    2000/06/20 20:51:38     1.5
+++ stdarg.h    2000/12/02 13:51:38
@@ -16,9 +16,10 @@

 #include <sys/djtypes.h>

+#ifndef _VA_LIST
 __DJ_va_list
-#undef __DJ_va_list
-#define __DJ_va_list
+#define _VA_LIST
+#endif

 /* New va_list builtins from GCC 2.96 or later */
 #if ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 96)) || (__GNUC__ >= 3)
Index: djgpp/include/stddef.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/stddef.h,v
retrieving revision 1.1
diff -u -r1.1 stddef.h
--- stddef.h    1994/12/07 07:02:08     1.1
+++ stddef.h    2000/12/02 13:51:38
@@ -10,14 +10,21 @@

 #define NULL 0
 #define offsetof(s_type, mbr) ((size_t) &((s_type *)0)->mbr)
+
+#ifndef _PTRDIFF_T
 typedef int ptrdiff_t;
+#define _PTRDIFF_T
+#endif

+#ifndef _SIZE_T
 __DJ_size_t
-#undef __DJ_size_t
-#define __DJ_size_t
+#define _SIZE_T
+#endif
+
+#ifndef _WCHAR_T
 __DJ_wchar_t
-#undef __DJ_wchar_t
-#define __DJ_wchar_t
+#define _WCHAR_T
+#endif

 #ifndef __dj_ENFORCE_ANSI_FREESTANDING

Index: djgpp/include/stdio.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/stdio.h,v
retrieving revision 1.2
diff -u -r1.2 stdio.h
--- stdio.h     1998/11/15 13:37:28     1.2
+++ stdio.h     2000/12/02 13:51:39
@@ -32,12 +32,15 @@
 #define SEEK_CUR       1
 #define SEEK_END       2

+#ifndef _VA_LIST
 __DJ_va_list
-#undef __DJ_va_list
-#define __DJ_va_list
+#define _VA_LIST
+#endif
+
+#ifndef _SIZE_T
 __DJ_size_t
-#undef __DJ_size_t
-#define __DJ_size_t
+#define _SIZE_T
+#endif

 /* Note that the definitions of these fields are NOT guaranteed!  They
    may change with any release without notice!  The fact that they
Index: djgpp/include/stdlib.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/stdlib.h,v
retrieving revision 1.5
diff -u -r1.5 stdlib.h
--- stdlib.h    1999/06/03 17:22:28     1.5
+++ stdlib.h    2000/12/02 13:51:39
@@ -33,12 +33,15 @@
   long rem;
 } ldiv_t;

+#ifndef _SIZE_T
 __DJ_size_t
-#undef __DJ_size_t
-#define __DJ_size_t
+#define _SIZE_T
+#endif
+
+#ifndef _WCHAR_T
 __DJ_wchar_t
-#undef __DJ_wchar_t
-#define __DJ_wchar_t
+#define _WCHAR_T
+#endif

 void   abort(void) __attribute__((noreturn));
 int    abs(int _i);
Index: djgpp/include/string.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/string.h,v
retrieving revision 1.4
diff -u -r1.4 string.h
--- string.h    2000/07/24 15:52:44     1.4
+++ string.h    2000/12/02 13:51:40
@@ -16,9 +16,11 @@
 #undef NULL

 #define NULL 0
+
+#ifndef _SIZE_T
 __DJ_size_t
-#undef __DJ_size_t
-#define __DJ_size_t
+#define _SIZE_T
+#endif

 void * memchr(const void *_s, int _c, size_t _n);
 int    memcmp(const void *_s1, const void *_s2, size_t _n);
Index: djgpp/include/time.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/time.h,v
retrieving revision 1.4
diff -u -r1.4 time.h
--- time.h      1999/06/03 17:22:28     1.4
+++ time.h      2000/12/02 13:51:40
@@ -21,15 +21,18 @@
 #undef NULL

 #define NULL 0
+#ifndef _CLOCK_T
 __DJ_clock_t
-#undef __DJ_clock_t
-#define __DJ_clock_t
+#define _CLOCK_T
+#endif
+#ifndef _SIZE_T
 __DJ_size_t
-#undef __DJ_size_t
-#define __DJ_size_t
+#define _SIZE_T
+#endif
+#ifndef _TIME_T
 __DJ_time_t
-#undef __DJ_time_t
-#define __DJ_time_t
+#define _TIME_T
+#endif

 struct tm {
   int tm_sec;
Index: djgpp/include/unistd.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/unistd.h,v
retrieving revision 1.8
diff -u -r1.8 unistd.h
--- unistd.h    2000/08/11 11:16:16     1.8
+++ unistd.h    2000/12/02 13:51:41
@@ -60,13 +60,15 @@
 #define _SC_STREAM_MAX         8
 #define _SC_TZNAME_MAX         9
 #define _SC_VERSION            10
-
+
+#ifndef _SIZE_T
 __DJ_size_t
-#undef __DJ_size_t
-#define __DJ_size_t
+#define _SIZE_T
+#endif
+#ifndef _SSIZE_T
 __DJ_ssize_t
-#undef __DJ_ssize_t
-#define __DJ_ssize_t
+#define _SSIZE_T
+#endif

 extern char *optarg;
 extern int optind, opterr, optopt;
Index: djgpp/include/utime.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/utime.h,v
retrieving revision 1.1
diff -u -r1.1 utime.h
--- utime.h     1995/03/21 09:04:36     1.1
+++ utime.h     2000/12/02 13:51:41
@@ -11,9 +11,11 @@
 #ifndef __STRICT_ANSI__

 #include <sys/djtypes.h>
+
+#ifndef _TIME_T
 __DJ_time_t
-#undef __DJ_time_t
-#define __DJ_time_t
+#define _TIME_T
+#endif

 struct utimbuf {
   time_t actime;
Index: djgpp/include/varargs.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/varargs.h,v
retrieving revision 1.3
diff -u -r1.3 varargs.h
--- varargs.h   2000/06/20 20:51:38     1.3
+++ varargs.h   2000/12/02 13:51:41
@@ -15,9 +15,10 @@

 #include <sys/djtypes.h>

+#ifndef _VA_LIST
 __DJ_va_list
-#undef __DJ_va_list
-#define __DJ_va_list
+#define _VA_LIST
+#endif

 /* For GCC 2.96 or later we use its builtin va_list */
 #if ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 96)) || (__GNUC__ >= 3)
Index: djgpp/include/wchar.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/wchar.h,v
retrieving revision 1.3
diff -u -r1.3 wchar.h
--- wchar.h     1999/06/03 17:22:28     1.3
+++ wchar.h     2000/12/02 13:51:41
@@ -13,9 +13,10 @@

 #include <stddef.h>

+#ifndef _WINT_T
 __DJ_wint_t
-#undef __DJ_wint_t
-#define __DJ_wint_t
+#define _WINT_T
+#endif

 #ifndef WEOF
 #define WEOF ((wint_t)(-1))
Index: djgpp/include/wctype.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/wctype.h,v
retrieving revision 1.4
diff -u -r1.4 wctype.h
--- wctype.h    1999/06/03 17:22:28     1.4
+++ wctype.h    2000/12/02 13:51:41
@@ -13,12 +13,14 @@

 #include <sys/djtypes.h>

+#ifndef _WCHAR_T
 __DJ_wchar_t
-#undef __DJ_wchar_t
-#define __DJ_wchar_t
+#define _WCHAR_T
+#endif
+#ifndef _WINT_T
 __DJ_wint_t
-#undef __DJ_wint_t
-#define __DJ_wint_t
+#define _WINT_T
+#endif

 #ifndef WEOF
 #define WEOF ((wint_t)(-1))
Index: djgpp/include/libc/symlink.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/libc/symlink.h,v
retrieving revision 1.3
diff -u -r1.3 symlink.h
--- symlink.h   2000/08/31 08:18:34     1.3
+++ symlink.h   2000/12/02 13:51:42
@@ -19,15 +19,16 @@

 #include <sys/djtypes.h>

+#ifndef _SIZE_T
 __DJ_size_t
-#undef __DJ_size_t
-#define __DJ_size_t
+#define _SIZE_T
+#endif

 /* Semi-internal library function which reads symlink contents given  */
 /* either a file name or its handle.  Used by readlink(), fstat() and */
 /* user supplied (if any) file fstat handler.                         */

-int __internal_readlink(const char * __path, int __fhandle, char * __buf,
+int __internal_readlink(const char * __path, int __fhandle, char * __buf,
                         size_t  __max);

 /* A prototype for internal library function for fully resolving symlink   */
Index: djgpp/include/sys/movedata.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/sys/movedata.h,v
retrieving revision 1.2
diff -u -r1.2 movedata.h
--- movedata.h  1998/01/01 23:38:48     1.2
+++ movedata.h  2000/12/02 13:51:42
@@ -15,9 +15,10 @@

 #include <sys/djtypes.h>

+#ifndef _SIZE_T
 __DJ_size_t
-#undef __DJ_size_t
-#define __DJ_size_t
+#define _SIZE_T
+#endif

 /* This header is intended to be included only by other
    headers, like <go32.h> and <string.h>.  You may
Index: djgpp/include/sys/stat.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/sys/stat.h,v
retrieving revision 1.3
diff -u -r1.3 stat.h
--- stat.h      2000/08/15 17:38:40     1.3
+++ stat.h      2000/12/02 13:51:43
@@ -34,9 +34,10 @@

 #include <sys/types.h>
 #include <sys/djtypes.h>
+#ifndef _TIME_T
 __DJ_time_t
-#undef __DJ_time_t
-#define __DJ_time_t
+#define _TIME_T
+#endif

 struct stat {
   time_t       st_atime;
Index: djgpp/include/sys/timeb.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/sys/timeb.h,v
retrieving revision 1.1
diff -u -r1.1 timeb.h
--- timeb.h     1995/04/02 04:05:16     1.1
+++ timeb.h     2000/12/02 13:51:43
@@ -14,9 +14,10 @@

 #include <sys/djtypes.h>

+#ifndef _TIME_T
 __DJ_time_t
-#undef __DJ_time_t
-#define __DJ_time_t
+#define _TIME_T
+#endif

 struct timeb
 {
Index: djgpp/include/sys/times.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/sys/times.h,v
retrieving revision 1.1
diff -u -r1.1 times.h
--- times.h     1995/05/10 03:59:06     1.1
+++ times.h     2000/12/02 13:51:43
@@ -11,9 +11,11 @@
 #ifndef __STRICT_ANSI__

 #include <sys/djtypes.h>
+
+#ifndef _CLOCK_T
 __DJ_clock_t
-#undef __DJ_clock_t
-#define __DJ_clock_t
+#define _CLOCK_T
+#endif

 struct tms {
   clock_t tms_utime;
Index: djgpp/include/sys/types.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/sys/types.h,v
retrieving revision 1.5
diff -u -r1.5 types.h
--- types.h     2000/06/19 18:00:55     1.5
+++ types.h     2000/12/02 13:51:44
@@ -19,27 +19,34 @@
 typedef int            mode_t;
 typedef int            nlink_t;

+#ifndef _GID_T
 __DJ_gid_t
-#undef __DJ_gid_t
-#define __DJ_gid_t
+#define _GID_T
+#endif
+#ifndef _OFF_T
 __DJ_off_t
-#undef __DJ_off_t
-#define __DJ_off_t
+#define _OFF_T
+#endif
+#ifndef _OFFSET_T
 __DJ_offset_t
-#undef __DJ_offset_t
-#define __DJ_offset_t
+#define _OFFSET_T
+#endif
+#ifndef _PID_T
 __DJ_pid_t
-#undef __DJ_pid_t
-#define __DJ_pid_t
+#define _PID_T
+#endif
+#ifndef _SIZE_T
 __DJ_size_t
-#undef __DJ_size_t
-#define __DJ_size_t
+#define _SIZE_T
+#endif
+#ifndef _SSIZE_T
 __DJ_ssize_t
-#undef __DJ_ssize_t
-#define __DJ_ssize_t
+#define _SSIZE_T
+#endif
+#ifndef _UID_T
+#define _UID_T
 __DJ_uid_t
-#undef __DJ_uid_t
-#define __DJ_uid_t
+#endif

 #ifndef _POSIX_SOURCE

@@ -57,9 +64,10 @@
 #define FD_ISSET(n, p) ((p)->fd_bits[(n) / 8] & (1 << ((n) & 7)))
 #define FD_ZERO(p)     memset ((void *)(p), 0, sizeof (*(p)))

+#ifndef _TIME_T
 __DJ_time_t
-#undef __DJ_time_t
-#define __DJ_time_t
+#define _TIME_T
+#endif

 #endif /* !_POSIX_SOURCE */
 #endif /* !__STRICT_ANSI__ */
Index: djgpp/include/sys/wait.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/sys/wait.h,v
retrieving revision 1.3
diff -u -r1.3 wait.h
--- wait.h      1998/07/12 16:55:36     1.3
+++ wait.h      2000/12/02 13:51:44
@@ -22,9 +22,10 @@
 #define WTERMSIG(stat_val)     ( ((stat_val) >> 8 ) & 0x3ff)
 #define WUNTRACED              0

+#ifndef _PID_T
 __DJ_pid_t
-#undef __DJ_pid_t
-#define __DJ_pid_t
+#define _PID_T
+#endif

 pid_t wait(int *stat_loc);
 pid_t waitpid(pid_t pid, int *stat_loc, int options);
Index: djgpp/src/docs/kb/wc204.txi
===================================================================
RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc204.txi,v
retrieving revision 1.28
diff -u -r1.28 wc204.txi
--- wc204.txi   2000/11/25 11:06:02     1.28
+++ wc204.txi   2000/12/02 13:51:46
@@ -137,3 +137,7 @@
 preservation.  Its source can now be compiled on a Unix or GNU/Linux
 system.

+@cindex header files and GCC
+The protection against multiple redefinitions of various
+types like @code{size_t} has been rewriten to make DJGPP
+header files compatible with GCC provided ones.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019