X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f Date: Thu, 22 Feb 2007 21:02:16 -0500 Message-Id: <200702230202.l1N22GmD017924@envy.delorie.com> From: DJ Delorie To: djgpp-workers AT delorie DOT com Subject: cross compilation patch Reply-To: djgpp-workers AT delorie DOT com Just finished cross-compiling djgpp with gcc trunk, binutils head, on an x86-64 linux host. Various patches were required. To summarize: * "long" is not the right size for COFF headers, hook added. * "NULL" can no longer be 0 or (void*)0 under C++ * gcc is much more strict about syntax now. * changes in gcc command line options. * two-staged builds Comments? Index: include/coff.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/coff.h,v retrieving revision 1.2 diff -p -U3 -r1.2 include/coff.h --- include/coff.h 4 Feb 2003 20:22:55 -0000 1.2 +++ include/coff.h 23 Feb 2007 01:49:56 -0000 @@ -18,18 +18,25 @@ extern "C" { #ifndef _POSIX_SOURCE +#ifndef __dj_coff_short_type +#define __dj_coff_short_type unsigned short +#endif +#ifndef __dj_coff_long_type +#define __dj_coff_long_type unsigned long +#endif + /*** coff information for Intel 386/486. */ /********************** FILE HEADER **********************/ struct external_filehdr { - unsigned short f_magic; /* magic number */ - unsigned short f_nscns; /* number of sections */ - unsigned long f_timdat; /* time & date stamp */ - unsigned long f_symptr; /* file pointer to symtab */ - unsigned long f_nsyms; /* number of symtab entries */ - unsigned short f_opthdr; /* sizeof(optional hdr) */ - unsigned short f_flags; /* flags */ + __dj_coff_short_type f_magic; /* magic number */ + __dj_coff_short_type f_nscns; /* number of sections */ + __dj_coff_long_type f_timdat; /* time & date stamp */ + __dj_coff_long_type f_symptr; /* file pointer to symtab */ + __dj_coff_long_type f_nsyms; /* number of symtab entries */ + __dj_coff_short_type f_opthdr; /* sizeof(optional hdr) */ + __dj_coff_short_type f_flags; /* flags */ }; @@ -62,27 +69,27 @@ struct external_filehdr { typedef struct { - unsigned short magic; /* type of file */ - unsigned short vstamp; /* version stamp */ - unsigned long tsize; /* text size in bytes, padded to FW bdry*/ - unsigned long dsize; /* initialized data " " */ - unsigned long bsize; /* uninitialized data " " */ - unsigned long entry; /* entry pt. */ - unsigned long text_start; /* base of text used for this file */ - unsigned long data_start; /* base of data used for this file */ + __dj_coff_short_type magic; /* type of file */ + __dj_coff_short_type vstamp; /* version stamp */ + __dj_coff_long_type tsize; /* text size in bytes, padded to FW bdry*/ + __dj_coff_long_type dsize; /* initialized data " " */ + __dj_coff_long_type bsize; /* uninitialized data " " */ + __dj_coff_long_type entry; /* entry pt. */ + __dj_coff_long_type text_start; /* base of text used for this file */ + __dj_coff_long_type data_start; /* base of data used for this file */ } AOUTHDR; typedef struct gnu_aout { - unsigned long info; - unsigned long tsize; - unsigned long dsize; - unsigned long bsize; - unsigned long symsize; - unsigned long entry; - unsigned long txrel; - unsigned long dtrel; + __dj_coff_long_type info; + __dj_coff_long_type tsize; + __dj_coff_long_type dsize; + __dj_coff_long_type bsize; + __dj_coff_long_type symsize; + __dj_coff_long_type entry; + __dj_coff_long_type txrel; + __dj_coff_long_type dtrel; } GNU_AOUT; #define AOUTSZ (sizeof(AOUTHDR)) @@ -97,16 +104,16 @@ typedef struct gnu_aout { struct external_scnhdr { - char s_name[8]; /* section name */ - unsigned long s_paddr; /* physical address, aliased s_nlib */ - unsigned long s_vaddr; /* virtual address */ - unsigned long s_size; /* section size */ - unsigned long s_scnptr; /* file ptr to raw data for section */ - unsigned long s_relptr; /* file ptr to relocation */ - unsigned long s_lnnoptr; /* file ptr to line numbers */ - unsigned short s_nreloc; /* number of relocation entries */ - unsigned short s_nlnno; /* number of line number entries*/ - unsigned long s_flags; /* flags */ + char s_name[8]; /* section name */ + __dj_coff_long_type s_paddr; /* physical address, aliased s_nlib */ + __dj_coff_long_type s_vaddr; /* virtual address */ + __dj_coff_long_type s_size; /* section size */ + __dj_coff_long_type s_scnptr; /* file ptr to raw data for section */ + __dj_coff_long_type s_relptr; /* file ptr to relocation */ + __dj_coff_long_type s_lnnoptr; /* file ptr to line numbers */ + __dj_coff_short_type s_nreloc; /* number of relocation entries */ + __dj_coff_short_type s_nlnno; /* number of line number entries*/ + __dj_coff_long_type s_flags; /* flags */ }; #define SCNHDR struct external_scnhdr @@ -137,10 +144,10 @@ struct external_scnhdr { */ struct external_lineno { union { - unsigned long l_symndx __attribute__((packed)); /* function name symbol index, iff l_lnno == 0 */ - unsigned long l_paddr __attribute__((packed)); /* (physical) address of line number */ + __dj_coff_long_type l_symndx __attribute__((packed)); /* function name symbol index, iff l_lnno == 0 */ + __dj_coff_long_type l_paddr __attribute__((packed)); /* (physical) address of line number */ } l_addr; - unsigned short l_lnno; /* line number */ + __dj_coff_short_type l_lnno; /* line number */ }; @@ -159,13 +166,13 @@ struct external_syment union { char e_name[E_SYMNMLEN]; struct { - unsigned long e_zeroes __attribute__((packed)); - unsigned long e_offset __attribute__((packed)); + __dj_coff_long_type e_zeroes __attribute__((packed)); + __dj_coff_long_type e_offset __attribute__((packed)); } e; } e; - unsigned long e_value __attribute__((packed)); + __dj_coff_long_type e_value __attribute__((packed)); short e_scnum; - unsigned short e_type; + __dj_coff_short_type e_type; unsigned char e_sclass; unsigned char e_numaux; }; @@ -177,44 +184,44 @@ struct external_syment union external_auxent { struct { - unsigned long x_tagndx __attribute__((packed)); /* str, un, or enum tag indx */ + __dj_coff_long_type x_tagndx __attribute__((packed)); /* str, un, or enum tag indx */ union { struct { - unsigned short x_lnno; /* declaration line number */ - unsigned short x_size; /* str/union/array size */ + __dj_coff_short_type x_lnno; /* declaration line number */ + __dj_coff_short_type x_size; /* str/union/array size */ } x_lnsz; - unsigned long x_fsize __attribute__((packed)); /* size of function */ + __dj_coff_long_type x_fsize __attribute__((packed)); /* size of function */ } x_misc; union { struct { /* if ISFCN, tag, or .bb */ - unsigned long x_lnnoptr __attribute__((packed)); /* ptr to fcn line # */ - unsigned long x_endndx __attribute__((packed)); /* entry ndx past block end */ + __dj_coff_long_type x_lnnoptr __attribute__((packed)); /* ptr to fcn line # */ + __dj_coff_long_type x_endndx __attribute__((packed)); /* entry ndx past block end */ } x_fcn; struct { /* if ISARY, up to 4 dimen. */ - unsigned short x_dimen[E_DIMNUM]; + __dj_coff_short_type x_dimen[E_DIMNUM]; } x_ary; } x_fcnary; - unsigned short x_tvndx; /* tv index */ + __dj_coff_short_type x_tvndx; /* tv index */ } x_sym; union { char x_fname[E_FILNMLEN]; struct { - unsigned long x_zeroes __attribute__((packed)); - unsigned long x_offset __attribute__((packed)); + __dj_coff_long_type x_zeroes __attribute__((packed)); + __dj_coff_long_type x_offset __attribute__((packed)); } x_n; } x_file; struct { - unsigned long x_scnlen __attribute__((packed)); /* section length */ - unsigned short x_nreloc; /* # relocation entries */ - unsigned short x_nlinno; /* # line numbers */ + __dj_coff_long_type x_scnlen __attribute__((packed)); /* section length */ + __dj_coff_short_type x_nreloc; /* # relocation entries */ + __dj_coff_short_type x_nlinno; /* # line numbers */ } x_scn; struct { - unsigned long x_tvfill __attribute__((packed)); /* tv fill value */ - unsigned short x_tvlen; /* length of .tv */ - unsigned short x_tvran[2]; /* tv range */ + __dj_coff_long_type x_tvfill __attribute__((packed)); /* tv fill value */ + __dj_coff_short_type x_tvlen; /* length of .tv */ + __dj_coff_short_type x_tvran[2]; /* tv range */ } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ @@ -254,9 +261,9 @@ union external_auxent { #define T_ENUM 10 /* enumeration */ #define T_MOE 11 /* member of enumeration*/ #define T_UCHAR 12 /* unsigned character */ -#define T_USHORT 13 /* unsigned short */ +#define T_USHORT 13 /* __dj_coff_short_type */ #define T_UINT 14 /* unsigned integer */ -#define T_ULONG 15 /* unsigned long */ +#define T_ULONG 15 /* __dj_coff_long_type */ #define T_LNGDBL 16 /* long double */ /* @@ -313,9 +320,9 @@ union external_auxent { struct external_reloc { - unsigned long r_vaddr __attribute__((packed)); - unsigned long r_symndx __attribute__((packed)); - unsigned short r_type; + __dj_coff_long_type r_vaddr __attribute__((packed)); + __dj_coff_long_type r_symndx __attribute__((packed)); + __dj_coff_short_type r_type; }; Index: include/locale.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/locale.h,v retrieving revision 1.6 diff -p -U3 -r1.6 include/locale.h --- include/locale.h 4 Feb 2003 20:23:53 -0000 1.6 +++ include/locale.h 23 Feb 2007 01:49:56 -0000 @@ -13,13 +13,15 @@ extern "C" { #ifndef __dj_ENFORCE_ANSI_FREESTANDING +#include + #define LC_ALL 0x1f #define LC_COLLATE 0x01 #define LC_CTYPE 0x02 #define LC_MONETARY 0x04 #define LC_NUMERIC 0x08 #define LC_TIME 0x10 -#define NULL 0 +#define NULL __DJ_null struct lconv { char *currency_symbol; Index: include/stddef.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/stddef.h,v retrieving revision 1.5 diff -p -U3 -r1.5 include/stddef.h --- include/stddef.h 11 Mar 2003 20:46:30 -0000 1.5 +++ include/stddef.h 23 Feb 2007 01:49:56 -0000 @@ -12,7 +12,7 @@ namespace std { #include -#define NULL 0 +#define NULL __DJ_null #ifdef __cplusplus #define offsetof(s_type, mbr) ((std::size_t) &((s_type *)0)->mbr) #else Index: include/stdio.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/stdio.h,v retrieving revision 1.10 diff -p -U3 -r1.10 include/stdio.h --- include/stdio.h 20 Feb 2003 19:05:17 -0000 1.10 +++ include/stdio.h 23 Feb 2007 01:49:56 -0000 @@ -29,7 +29,7 @@ extern "C" { #define FILENAME_MAX 260 #define FOPEN_MAX 20 #define L_tmpnam 260 -#define NULL 0 +#define NULL __DJ_null #define TMP_MAX 999999 #define SEEK_SET 0 Index: include/stdlib.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/stdlib.h,v retrieving revision 1.17 diff -p -U3 -r1.17 include/stdlib.h --- include/stdlib.h 20 Feb 2003 19:06:14 -0000 1.17 +++ include/stdlib.h 23 Feb 2007 01:49:56 -0000 @@ -22,7 +22,7 @@ extern "C" { #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 #define MB_CUR_MAX __dj_mb_cur_max -#define NULL 0 +#define NULL __DJ_null #define RAND_MAX 2147483647 extern int __dj_mb_cur_max; Index: include/string.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/string.h,v retrieving revision 1.9 diff -p -U3 -r1.9 include/string.h --- include/string.h 7 Jan 2005 17:07:16 -0000 1.9 +++ include/string.h 23 Feb 2007 01:49:56 -0000 @@ -17,7 +17,7 @@ extern "C" { /* Some programs think they know better... */ #undef NULL -#define NULL 0 +#define NULL __DJ_null #ifndef _SIZE_T __DJ_size_t Index: include/time.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/time.h,v retrieving revision 1.9 diff -p -U3 -r1.9 include/time.h --- include/time.h 9 Jan 2005 14:56:13 -0000 1.9 +++ include/time.h 23 Feb 2007 01:49:56 -0000 @@ -22,7 +22,7 @@ extern "C" { /* Some programs think they know better... */ #undef NULL -#define NULL 0 +#define NULL __DJ_null #ifndef _CLOCK_T __DJ_clock_t #define _CLOCK_T Index: include/unistd.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/unistd.h,v retrieving revision 1.18 diff -p -U3 -r1.18 include/unistd.h --- include/unistd.h 26 Mar 2003 19:40:04 -0000 1.18 +++ include/unistd.h 23 Feb 2007 01:49:56 -0000 @@ -40,7 +40,7 @@ extern "C" { /* Some programs think they know better... */ #undef NULL -#define NULL 0 +#define NULL __DJ_null #define F_OK 0x01 #define R_OK 0x02 Index: include/libc/ttyprvt.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/libc/ttyprvt.h,v retrieving revision 1.9 diff -p -U3 -r1.9 include/libc/ttyprvt.h --- include/libc/ttyprvt.h 4 Feb 2003 20:25:17 -0000 1.9 +++ include/libc/ttyprvt.h 23 Feb 2007 01:49:56 -0000 @@ -167,7 +167,6 @@ struct tty_screen_interface extern unsigned char __libc_tty_queue_buffer[]; extern struct tty __libc_tty_internal; extern struct tty *__libc_tty_p; -extern struct tty_editline __libc_tty_editline; extern struct tty_screen_interface __tty_direct_intface; extern struct tty_screen_interface __tty_vbios_intface; extern struct tty_screen_interface *__tty_screen_intface; Index: include/sys/djtypes.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/sys/djtypes.h,v retrieving revision 1.12 diff -p -U3 -r1.12 include/sys/djtypes.h --- include/sys/djtypes.h 29 Jan 2003 01:25:16 -0000 1.12 +++ include/sys/djtypes.h 23 Feb 2007 01:49:56 -0000 @@ -35,4 +35,10 @@ #define __DJ_wint_t typedef int wint_t; +#if defined(__cplusplus) +#define __DJ_null __null +#else +#define __DJ_null ((void *)0) +#endif + #endif Index: src/gcc.opt =================================================================== RCS file: /cvs/djgpp/djgpp/src/gcc.opt,v retrieving revision 1.4 diff -p -U3 -r1.4 src/gcc.opt --- src/gcc.opt 3 Apr 2002 16:22:25 -0000 1.4 +++ src/gcc.opt 23 Feb 2007 01:49:57 -0000 @@ -1,11 +1,12 @@ -MD -O2 --mcpu=pentium +-mtune=pentium -march=i386 -Wall -Wbad-function-cast -Wcast-qual -Werror +-fdiagnostics-show-option -Wmissing-declarations -Wmissing-prototypes -Wpointer-arith @@ -15,5 +16,8 @@ -Wundef -Wcast-align -Wsign-compare +-Wno-pointer-sign +-fno-strict-aliasing +-fno-builtin -nostdinc Index: src/gpp.sed =================================================================== RCS file: /cvs/djgpp/djgpp/src/gpp.sed,v retrieving revision 1.2 diff -p -U3 -r1.2 src/gpp.sed --- src/gpp.sed 27 Oct 2004 15:51:04 -0000 1.2 +++ src/gpp.sed 23 Feb 2007 01:49:57 -0000 @@ -7,3 +7,4 @@ s:-Wbad-function-cast::g s:-Wmissing-declarations::g s:-Wmissing-prototypes::g s:-Wstrict-prototypes::g +s:-Wno-pointer-sign::g Index: src/makefile =================================================================== RCS file: /cvs/djgpp/djgpp/src/makefile,v retrieving revision 1.10 diff -p -U3 -r1.10 src/makefile --- src/makefile 28 Jul 2003 20:11:45 -0000 1.10 +++ src/makefile 23 Feb 2007 01:49:57 -0000 @@ -20,7 +20,10 @@ DIRS = \ ../info \ ../lib -all : misc.exe $(DIRS) makemake.exe subs ../lib/libg.a ../lib/libpc.a +all : xnative subs ../lib/libg.a ../lib/libpc.a + +gpp.opt : gcc.opt + sed -f gpp.sed $< > $@ misc.exe : misc.c gcc -O2 misc.c -o misc.exe @@ -34,11 +37,14 @@ makemake.exe : makemake.c copyrite.exe : copyrite.cc gcc -O2 copyrite.cc -o copyrite.exe -subs: +native: gpp.opt misc.exe $(DIRS) makemake.exe $(MAKE) -C djasm native $(MAKE) -C stub native $(MAKE) -C utils native +xnative: native $(MAKE) -C dxe native + +subs: $(MAKE) -C mkdoc $(MAKE) -C libc $(MAKE) -C debug Index: src/makefile.inc =================================================================== RCS file: /cvs/djgpp/djgpp/src/makefile.inc,v retrieving revision 1.10 diff -p -U3 -r1.10 src/makefile.inc --- src/makefile.inc 28 Jul 2003 20:11:45 -0000 1.10 +++ src/makefile.inc 23 Feb 2007 01:49:57 -0000 @@ -60,13 +60,13 @@ ASFLAGS += -DGAS_MINORMINOR=$(GAS_MINORM # Moved setting of $(GCC{L}_OPT) to top of file # ifneq ($(CROSS_BUILD),1) -XGCC = $(CROSS_GCC) @$(TOP)/../gcc.opt -I. -I- -isystem $(TOP)/../../include $(CFLAGS) -XGPP = $(CROSS_GCC) @$(TOP)/../gpp.opt -I. -I- -isystem $(TOP)/../../include $(CFLAGS) -XLGCC = $(CROSS_GCC) -s @$(TOP)/../gcc-l.opt -I. -I- -isystem $(TOP)/../../include $(CFLAGS) +XGCC = $(CROSS_GCC) @$(TOP)/../gcc.opt -I. -isystem $(TOP)/../../include $(CFLAGS) +XGPP = $(CROSS_GCC) @$(TOP)/../gpp.opt -I. -isystem $(TOP)/../../include $(CFLAGS) +XLGCC = $(CROSS_GCC) -s @$(TOP)/../gcc-l.opt -I. -isystem $(TOP)/../../include $(CFLAGS) else -XGCC = $(CROSS_GCC) $(GCC_OPT) -I. -I- -isystem $(TOP)/../../include $(CFLAGS) -XGPP = $(CROSS_GCC) $(GPP_OPT) -I. -I- -isystem $(TOP)/../../include $(CFLAGS) -XLGCC = $(CROSS_GCC) $(GCCL_OPT) -I. -I- -isystem $(TOP)/../../include $(CFLAGS) +XGCC = $(CROSS_GCC) $(GCC_OPT) -I. -isystem $(TOP)/../../include $(CFLAGS) +XGPP = $(CROSS_GCC) $(GPP_OPT) -I. -isystem $(TOP)/../../include $(CFLAGS) +XLGCC = $(CROSS_GCC) $(GCCL_OPT) -I. -isystem $(TOP)/../../include $(CFLAGS) endif # Find the necessary gcc options for building the profiling Index: src/debug/common/dbgcom.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/debug/common/dbgcom.c,v retrieving revision 1.26 diff -p -U3 -r1.26 src/debug/common/dbgcom.c --- src/debug/common/dbgcom.c 9 Nov 2004 11:56:53 -0000 1.26 +++ src/debug/common/dbgcom.c 23 Feb 2007 01:49:57 -0000 @@ -77,8 +77,8 @@ TSS a_tss; static jmp_buf jumper; static int my_ds,my_cs,app_cs,app_exit_cs,app_ds; -static unsigned int app_ds_size[DS_SIZE_COUNT]; -static int app_ds_index = 0; +static volatile unsigned int app_ds_size[DS_SIZE_COUNT]; +static volatile int app_ds_index = 0; static jmp_buf load_state; static int nset, breakhandle[4]; Index: src/dxe/dxe3gen.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/dxe/dxe3gen.c,v retrieving revision 1.7 diff -p -U3 -r1.7 src/dxe/dxe3gen.c --- src/dxe/dxe3gen.c 4 Nov 2003 17:41:46 -0000 1.7 +++ src/dxe/dxe3gen.c 23 Feb 2007 01:49:57 -0000 @@ -19,6 +19,11 @@ #include #include #include +#include + +#if INT_MAX != LONG_MAX +#define __dj_coff_long_type unsigned int +#endif #ifndef DXE_LD /* Cross compile ld name/location */ #define DXE_LD "ld" @@ -512,7 +517,7 @@ static int write_dxe (FILE *inf, FILE *o unsigned int startbss; char *data; SYMENT *sym; - size_t stsz; + __dj_coff_long_type stsz; char *strings; RELOC *relocs; unsigned i, j, errcount; Index: src/libc/ansi/stdio/doprnt.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/doprnt.c,v retrieving revision 1.19 diff -p -U3 -r1.19 src/libc/ansi/stdio/doprnt.c --- src/libc/ansi/stdio/doprnt.c 17 Mar 2005 19:00:40 -0000 1.19 +++ src/libc/ansi/stdio/doprnt.c 23 Feb 2007 01:49:57 -0000 @@ -288,9 +288,9 @@ _doprnt(const char *fmt0, va_list argp, /* * cvt may have to round up past the "start" of the * buffer, i.e. ``intf("%.2f", (double)9.999);''; - * if the first char isn't NULL, it did. + * if the first char isn't NUL, it did. */ - *buf = NULL; + *buf = 0; size = cvtl(_ldouble, prec, flags, &softsign, *fmt, buf, buf + sizeof(buf)); /* Index: src/libc/ansi/stdio/fprintf.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/fprintf.c,v retrieving revision 1.2 diff -p -U3 -r1.2 src/libc/ansi/stdio/fprintf.c --- src/libc/ansi/stdio/fprintf.c 8 Jun 2002 10:14:23 -0000 1.2 +++ src/libc/ansi/stdio/fprintf.c 23 Feb 2007 01:49:57 -0000 @@ -22,7 +22,7 @@ fprintf(register FILE *iop, const char * fflush(iop); iop->_flag |= _IONBF; iop->_base = NULL; - iop->_bufsiz = NULL; + iop->_bufsiz = 0; iop->_cnt = 0; } else Index: src/libc/ansi/stdio/fputs.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/fputs.c,v retrieving revision 1.3 diff -p -U3 -r1.3 src/libc/ansi/stdio/fputs.c --- src/libc/ansi/stdio/fputs.c 3 Jun 1999 17:27:33 -0000 1.3 +++ src/libc/ansi/stdio/fputs.c 23 Feb 2007 01:49:57 -0000 @@ -29,7 +29,7 @@ fputs(const char *s, FILE *f) r = EOF; f->_flag |= _IONBF; f->_base = NULL; - f->_bufsiz = NULL; + f->_bufsiz = 0; f->_cnt = 0; } Index: src/libc/compat/mntent/mntent.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/compat/mntent/mntent.c,v retrieving revision 1.9 diff -p -U3 -r1.9 src/libc/compat/mntent/mntent.c --- src/libc/compat/mntent/mntent.c 10 May 2003 15:32:40 -0000 1.9 +++ src/libc/compat/mntent/mntent.c 23 Feb 2007 01:49:57 -0000 @@ -865,7 +865,7 @@ endmntent(FILE *filep) if (filep != (FILE *)1) { errno = EBADF; /* fake errno for invalid handle */ - return NULL; + return 0; } drive_number = 0; skip_drive_b = 0; Index: src/libc/compat/stdlib/alloca.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/compat/stdlib/alloca.c,v retrieving revision 1.1 diff -p -U3 -r1.1 src/libc/compat/stdlib/alloca.c --- src/libc/compat/stdlib/alloca.c 11 Jan 1996 04:02:06 -0000 1.1 +++ src/libc/compat/stdlib/alloca.c 23 Feb 2007 01:49:57 -0000 @@ -34,8 +34,6 @@ #define ADDRESS_FUNCTION(arg) &(arg) -#define NULL 0 - /* Define STACK_DIRECTION if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. Index: src/libc/compat/time/select.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/compat/time/select.c,v retrieving revision 1.7 diff -p -U3 -r1.7 src/libc/compat/time/select.c --- src/libc/compat/time/select.c 26 Mar 2003 19:46:05 -0000 1.7 +++ src/libc/compat/time/select.c 23 Feb 2007 01:49:57 -0000 @@ -160,6 +160,11 @@ select(int nfds, then.tv_sec = timeout->tv_sec + now.tv_sec + then.tv_usec / 1000000; then.tv_usec %= 1000000; } + else + { + then.tv_usec = 0; + then.tv_sec = 0; + } do { int i; Index: src/libc/posix/sys/stat/lstat.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/lstat.c,v retrieving revision 1.12 diff -p -U3 -r1.12 src/libc/posix/sys/stat/lstat.c --- src/libc/posix/sys/stat/lstat.c 14 Jun 2002 14:26:15 -0000 1.12 +++ src/libc/posix/sys/stat/lstat.c 23 Feb 2007 01:49:58 -0000 @@ -140,10 +140,10 @@ int __findnext(struct ffblk *); it to be sure it will still work for future versions of GCC. */ struct full_dirent { - char fname[8] __attribute__ ((packed)); - char fext[3] __attribute__ ((packed)); - unsigned char fattr __attribute__ ((packed)); - unsigned char freserved[10] __attribute__ ((packed)); + char fname[8]; + char fext[3]; + unsigned char fattr; + unsigned char freserved[10]; unsigned short ftime __attribute__ ((packed)); unsigned short fdate __attribute__ ((packed)); unsigned short fcluster __attribute__ ((packed)); Index: src/libc/posix/unistd/chdir.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/chdir.c,v retrieving revision 1.5 diff -p -U3 -r1.5 src/libc/posix/unistd/chdir.c --- src/libc/posix/unistd/chdir.c 3 Oct 2001 03:56:15 -0000 1.5 +++ src/libc/posix/unistd/chdir.c 23 Feb 2007 01:49:58 -0000 @@ -24,16 +24,16 @@ __chdir (const char *mydirname) char real_name[FILENAME_MAX]; char path[FILENAME_MAX]; - if (!__solve_symlinks(mydirname, real_name)) - return -1; - _fixpath(real_name, path); - - if (path == 0) + if (mydirname == 0) { errno = EINVAL; return -1; } + if (!__solve_symlinks(mydirname, real_name)) + return -1; + _fixpath(real_name, path); + if (path[0] == 0) { errno = ENOENT; Index: src/libemu/src/emu387.cc =================================================================== RCS file: /cvs/djgpp/djgpp/src/libemu/src/emu387.cc,v retrieving revision 1.14 diff -p -U3 -r1.14 src/libemu/src/emu387.cc --- src/libemu/src/emu387.cc 23 Jun 2003 09:53:19 -0000 1.14 +++ src/libemu/src/emu387.cc 23 Feb 2007 01:49:58 -0000 @@ -185,18 +185,22 @@ static int compare(reg& a, reg& b) if (a_inf || b_inf) { if (a_inf == 1) - if (b_inf == 1) - return COMP_A_EQ_B; - else - return COMP_A_GT_B; + { + if (b_inf == 1) + return COMP_A_EQ_B; + else + return COMP_A_GT_B; + } if (b_inf == 1) return COMP_A_LT_B; if (a_inf == -1) - if (b_inf == -1) - return COMP_A_EQ_B; - else - return COMP_A_LT_B; + { + if (b_inf == -1) + return COMP_A_EQ_B; + else + return COMP_A_LT_B; + } if (b_inf == -1) return COMP_A_GT_B; } @@ -1078,11 +1082,13 @@ static void round_to_int(reg& r) // r ge { case RC_RND: if (half_or_more) - if (more_than_half) // nearest - (*(long long *)(&r.sigl)) ++; - else - if (r.sigl & 1) // odd? - (*(long long *)(&r.sigl)) ++; + { + if (more_than_half) // nearest + (*(long long *)(&r.sigl)) ++; + else + if (r.sigl & 1) // odd? + (*(long long *)(&r.sigl)) ++; + } break; case RC_DOWN: if ((half_or_more||more_than_half) && r.sign) @@ -2161,7 +2167,7 @@ static void fpatan() return; } if (st(1).tag == TW_S - && val_same(st(1), CONST_NINF) || val_same(st(1), CONST_PINF)) + && (val_same(st(1), CONST_NINF) || val_same(st(1), CONST_PINF))) { char nsign = st(1).sign; st(1) = CONST_PI2; Index: src/stub/stubedit.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/stub/stubedit.c,v retrieving revision 1.7 diff -p -U3 -r1.7 src/stub/stubedit.c --- src/stub/stubedit.c 5 Jan 2003 17:59:26 -0000 1.7 +++ src/stub/stubedit.c 23 Feb 2007 01:49:58 -0000 @@ -89,7 +89,7 @@ char *pose_question(char *question, char static char response[200]; printf("%s ? [%s] ", question, default_answer); fflush(stdout); - gets(response); + fgets(response, 200, stdin); if (response[0] == '\0') return 0; return response; Index: zoneinfo/src/zic.c =================================================================== RCS file: /cvs/djgpp/djgpp/zoneinfo/src/zic.c,v retrieving revision 1.5 diff -p -U3 -r1.5 zoneinfo/src/zic.c --- zoneinfo/src/zic.c 24 Dec 1999 21:11:24 -0000 1.5 +++ zoneinfo/src/zic.c 23 Feb 2007 01:49:58 -0000 @@ -7,13 +7,13 @@ static char elsieid[] = "@(#)zic.c 7.94" #include "private.h" #include "locale.h" #include "tzfile.h" -#ifdef unix + #include "sys/stat.h" /* for umask manifest constants */ #include "sys/wait.h" #ifndef WEXITSTATUS #define WEXITSTATUS(x) (((x) >> 8) & 0xff) #endif -#endif /* defined unix */ + /* ** Portable testing for absolute file names.