ChangeLog

	2001-05-17  Danny Smith  <danny_r_smith_2001@yahoo.com.nz>

	* gcc/config/i386/mingw32.h (NATIVE_MINGW): Define before including
	cygwin.h.
	(CPP_PREDEFINES): Update __MINGW32__ to 0.5.
	(STANDARD_INCLUDE_DIR): Get rid of i386- in dir name. 
	(CPLUSPLUS_CPP_SPEC): Undefine.
	* gcc/config/i386/cygwin.h: (NATIVE_MINGW): Guard undefs of
	spec defines when building for native mingw.
	* gcc/config/i386/xm-mingw32.h (DIR_SEPARATOR[_2]): Make '/' default.
	* gcc/configure.in (tm-file): Make msvcrt default for mingw.
	* gcc/configure: Regenerate.
	* gcc/libgcc2.c (MAXPATHLEN): If not defined, define as MAX_PATH if
	available, else 1024.
	* gcc/version.c: Add "-mingw" to string. 
	* gcc/gthr-win32.h (__gthread_getspecific): Save and restore last error. 
	* libio/gen-params(VTABLE_LABEL_PREFIX): Fix sed script to handle
	vtable_thunk decoration. 

	Fix libio header/implementation type mismatches.
	2000-09-29  J. David Anglin  <dave@hiauly1.hia.nrc.ca>

	* libio/fileops.c (_IO_file_fopen): Change implementation to match
	prototype in libioP.h.
	(_IO_file_seekoff): Likewise.
	(_IO_file_seek): Likewise.
	* libio/genops.c (_IO_default_seekpos): Likewise.
	(_IO_default_seekoff): Likewise.
	(_IO_default_seek): Likewise.
	* libio/ioseekoff.c (_IO_seekoff): Likewise.
	* libio/ioseekpos.c (_IO_seekpos): Likewise.
	* libio/strops.c (_IO_str_seekoff): Likewise.
	* libio/libioP.h: Always check that _G_IO_IO_FILE_VERSION is defined
	before testing version.



diff -urpb gcc-2.95.3-4\gcc\config\i386\cygwin.h gcc-2.95.3-4m\gcc\config\i386\cygwin.h
--- gcc-2.95.3-4\gcc\config\i386\cygwin.h	Thu Apr 26 11:04:24 2001
+++ gcc-2.95.3-4m\gcc\config\i386\cygwin.h	Wed May 16 19:38:20 2001
@@ -592,6 +592,8 @@ extern void i386_pe_asm_file_end STDIO_P
 #define SET_ASM_OP "\t.set"
 #endif
 
+/*  these undefs break mingw, which currently uses built-in specs */
+#ifndef NATIVE_MINGW  
 #undef MD_STARTFILE_PREFIX
 #if 0
 #define MD_STARTFILE_PREFIX     CYGWIN_LIB
@@ -611,3 +613,4 @@ extern void i386_pe_asm_file_end STDIO_P
 #undef STANDARD_INCLUDE_DIR
 #define STANDARD_INCLUDE_DIR 0
 #endif
+#endif /* ndef NATIVE_MINGW */
Only in gcc-2.95.3-4m\gcc\config\i386: cygwin.mk.h
diff -urpb gcc-2.95.3-4\gcc\config\i386\mingw32.h gcc-2.95.3-4m\gcc\config\i386\mingw32.h
--- gcc-2.95.3-4\gcc\config\i386\mingw32.h	Wed Jan 19 19:20:40 2000
+++ gcc-2.95.3-4m\gcc\config\i386\mingw32.h	Wed May 16 19:38:20 2001
@@ -23,7 +23,10 @@ Boston, MA 02111-1307, USA. */
 
 /* Most of this is the same as for cygwin, except for changing some
    specs.  */
-
+#ifndef NATIVE_MINGW
+ /* this is to quard against some undefs of command-line defines by cygwin.h */
+#define NATIVE_MINGW
+#endif
 #include "i386/cygwin.h"
 
 /* Please keep changes to CPP_PREDEFINES in sync with i386/crtdll. The
@@ -31,7 +34,7 @@ Boston, MA 02111-1307, USA. */
    distinguish MSVC from CRTDLL runtime in mingw headers. */
 #undef CPP_PREDEFINES
 #define CPP_PREDEFINES "-Di386 -D_WIN32 -DWIN32 -D__WIN32__ \
-  -D__MINGW32__=0.2 -D__MSVCRT__ -DWINNT  -D_X86_=1 -D__STDC__=1\
+  -D__MINGW32__=0.5 -D__MSVCRT__ -DWINNT  -D_X86_=1 -D__STDC__=1\
   -D__stdcall=__attribute__((__stdcall__)) \
   -D_stdcall=__attribute__((__stdcall__)) \
   -D__cdecl=__attribute__((__cdecl__)) \
@@ -40,7 +43,7 @@ Boston, MA 02111-1307, USA. */
 
 /* Specific a different directory for the standard include files.  */
 #undef STANDARD_INCLUDE_DIR
-#define STANDARD_INCLUDE_DIR "/usr/local/i386-mingw32/include"
+#define STANDARD_INCLUDE_DIR "/usr/local/mingw32/include"
 
 #define STANDARD_INCLUDE_COMPONENT "MINGW32"
 
@@ -48,6 +51,9 @@ Boston, MA 02111-1307, USA. */
 #define CPP_SPEC \
   "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}"
 
+/* Override Cygwin definition, which is conditional on -mno-cygwin  */
+#undef CPLUSPLUS_CPP_SPEC
+
 /* For Windows applications, include more libraries, but always include
    kernel32.  */
 #undef LIB_SPEC
@@ -105,4 +111,3 @@ do {						\
 /* Override Cygwin's definition. This is necessary now due to the way
    Cygwin profiling code is written. Once "fixed", we can remove this.  */
 #undef SUBTARGET_PROLOGUE
-
diff -urpb gcc-2.95.3-4\gcc\config\i386\xm-mingw32.h gcc-2.95.3-4m\gcc\config\i386\xm-mingw32.h
--- gcc-2.95.3-4\gcc\config\i386\xm-mingw32.h	Fri Nov 05 14:09:56 1999
+++ gcc-2.95.3-4m\gcc\config\i386\xm-mingw32.h	Thu May 17 13:41:45 2001
@@ -35,8 +35,8 @@ Boston, MA 02111-1307, USA. */
 #define environ _environ
 
 /* Even though we support "/", allow "\" since everybody tests both.  */
-#define DIR_SEPARATOR '\\'
-#define DIR_SEPARATOR_2 '/'
+#define DIR_SEPARATOR '/'
+#define DIR_SEPARATOR_2 '\\'
 
 /* Mingw32 does not try to hide the underlying DOS-based file system
    like Cygwin does.  */
Only in gcc-2.95.3-4m\gcc\config\i386: xm-mingw32.h.$$$
diff -urpb gcc-2.95.3-4\gcc\configure gcc-2.95.3-4m\gcc\configure
--- gcc-2.95.3-4\gcc\configure	Sat Mar 17 06:42:52 2001
+++ gcc-2.95.3-4m\gcc\configure	Thu May 17 10:20:46 2001
@@ -3896,10 +3896,10 @@ for machine in $build $host $target; do
 		fi
 		exeext=.exe
 		case $machine in
-			*mingw32msv*)
-				;;
-			*minwg32crt* | *mingw32*)
+			*mingw32crt*)
 				tm_file="${tm_file} i386/crtdll.h"
+ 				;;
+			*mingw32msv* | *mingw32*)
 				;;
 		esac
 		;;
diff -urpb gcc-2.95.3-4\gcc\configure.in gcc-2.95.3-4m\gcc\configure.in
--- gcc-2.95.3-4\gcc\configure.in	Sat Mar 17 06:39:40 2001
+++ gcc-2.95.3-4m\gcc\configure.in	Wed May 16 19:38:16 2001
@@ -1552,11 +1552,11 @@ changequote([,])dnl
 		fi
 		exeext=.exe
 		case $machine in
-			*mingw32msv*)
-				;;
-			*minwg32crt* | *mingw32*)
+				*minwg32crt* )
 				tm_file="${tm_file} i386/crtdll.h"
 				;;
+				*mingw32msv* | *mingw32*)
+					;;
 		esac
 		;;
 changequote(,)dnl
diff -urpb gcc-2.95.3-4\gcc\gthr-win32.h gcc-2.95.3-4m\gcc\gthr-win32.h
--- gcc-2.95.3-4\gcc\gthr-win32.h	Fri Nov 05 21:39:46 1999
+++ gcc-2.95.3-4m\gcc\gthr-win32.h	Wed May 16 19:38:16 2001
@@ -172,7 +172,11 @@ __gthread_key_delete (__gthread_key_t ke
 static inline void *
 __gthread_getspecific (__gthread_key_t key)
 {
-  return TlsGetValue (key);
+  void *ptr;
+  int lasterror = GetLastError();
+  ptr = TlsGetValue (key);
+  SetLastError( lasterror );
+  return ptr;
 }
 
 static inline int
diff -urpb gcc-2.95.3-4\gcc\libgcc2.c gcc-2.95.3-4m\gcc\libgcc2.c
--- gcc-2.95.3-4\gcc\libgcc2.c	Wed Jan 31 10:36:06 2001
+++ gcc-2.95.3-4m\gcc\libgcc2.c	Wed May 16 23:08:29 2001
@@ -48,6 +48,15 @@ Boston, MA 02111-1307, USA.  */
 #include <stddef.h>
 #endif
 
+#ifndef MAXPATHLEN
+#ifdef MAX_PATH
+#define MAXPATHLEN MAX_PATH
+#else
+#define MAXPATHLEN 1024
+#endif
+#endif
+
+
 /* Don't use `fancy_abort' here even if config.h says to use it.  */
 #ifdef abort
 #undef abort
Only in gcc-2.95.3-4m\gcc: sjlj.diff
diff -urpb gcc-2.95.3-4\gcc\version.c gcc-2.95.3-4m\gcc\version.c
--- gcc-2.95.3-4\gcc\version.c	Thu Apr 26 04:36:00 2001
+++ gcc-2.95.3-4m\gcc\version.c	Thu May 17 11:42:53 2001
@@ -1 +1 @@
-char *version_string = "2.95.3-4 (cygwin special)";
+char *version_string = "2.95.3-4 (cygwin-mingw special)";
diff -urpb gcc-2.95.3-4\libiberty\strerror.c gcc-2.95.3-4m\libiberty\strerror.c
--- gcc-2.95.3-4\libiberty\strerror.c	Tue May 30 09:45:32 2000
+++ gcc-2.95.3-4m\libiberty\strerror.c	Wed May 16 19:38:47 2001
@@ -464,10 +464,10 @@ static int sys_nerr;
 static const char **sys_errlist;
 
 #else
-
+#if !(defined  __MINGW32__ ) /* don't override the __dllimport attribute */
 extern int sys_nerr;
 extern char *sys_errlist[];
-
+#endif
 #endif
 
 
diff -urpb gcc-2.95.3-4\libio\fileops.c gcc-2.95.3-4m\libio\fileops.c
--- gcc-2.95.3-4\libio\fileops.c	Fri Nov 05 14:10:16 1999
+++ gcc-2.95.3-4m\libio\fileops.c	Wed May 16 19:38:47 2001
@@ -260,7 +260,7 @@ _IO_do_write (fp, data, to_do)
     fp->_offset = _IO_pos_BAD;
   else if (fp->_IO_read_end != fp->_IO_write_base)
     {
-      _IO_pos_t new_pos
+      _IO_off_t new_pos
 	= _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
       if (new_pos == _IO_pos_BAD)
 	return EOF;
@@ -419,14 +419,14 @@ _IO_file_sync (fp)
   return retval;
 }
 
-_IO_pos_t
+_IO_off_t
 _IO_file_seekoff (fp, offset, dir, mode)
      _IO_FILE *fp;
      _IO_off_t offset;
      int dir;
      int mode;
 {
-  _IO_pos_t result;
+  _IO_off_t result;
   _IO_off_t delta, new_offset;
   long count;
   /* POSIX.1 8.2.3.7 says that after a call the fflush() the file
@@ -489,7 +489,7 @@ _IO_file_seekoff (fp, offset, dir, mode)
       && !_IO_in_backup (fp))
     {
       /* Offset relative to start of main get area. */
-      _IO_pos_t rel_offset = (offset - fp->_offset
+      _IO_off_t rel_offset = (offset - fp->_offset
 			      + (fp->_IO_read_end - fp->_IO_read_base));
       if (rel_offset >= 0)
 	{
@@ -587,7 +587,7 @@ _IO_file_read (fp, buf, size)
   return read (fp->_fileno, buf, size);
 }
 
-_IO_pos_t
+_IO_off_t
 _IO_file_seek (fp, offset, dir)
      _IO_FILE *fp;
      _IO_off_t offset;
diff -urpb gcc-2.95.3-4\libio\gen-params gcc-2.95.3-4m\libio\gen-params
--- gcc-2.95.3-4\libio\gen-params	Fri Nov 05 14:10:16 1999
+++ gcc-2.95.3-4m\libio\gen-params	Wed May 16 19:38:47 2001
@@ -126,11 +126,11 @@ if test -z "${NAMES_HAVE_UNDERSCORE}" \
       # Now we get rid of the <>, and any other junk on the nm output line.
       # (We get rid of <filebuf> in case nm included debugging output for
       # class filebuf itself.)  On windows32, we also need to delete the 
-      # unique sections (.data$_vt$*), otherwise we get the wrong result.
+      # unique sections (.data\$_*vt[$_]), otherwise we get the wrong result.
       # Finally, we select the first line of the result, and hope that's 
       # what we wanted!
       vtab_name=`${SED} -n -e '/<filebuf>/d' \
-        -e '/\.data[$_.]<_vt\$7filebuf>/d' \
+        -e '/\.data[$_.]<_*vt[$_]7filebuf>/d' \
         -e 's/^.*<\(.*\)>.*$/\1/p' \
         <dummy.out | ${SED} -n -e '1p'`
       case "${vtab_name}" in
diff -urpb gcc-2.95.3-4\libio\genops.c gcc-2.95.3-4m\libio\genops.c
--- gcc-2.95.3-4\libio\genops.c	Fri Nov 05 14:10:16 1999
+++ gcc-2.95.3-4m\libio\genops.c	Wed May 16 19:38:47 2001
@@ -467,10 +467,10 @@ _IO_default_setbuf (fp, p, len)
     return fp;
 }
 
-_IO_pos_t
+_IO_off_t
 _IO_default_seekpos (fp, pos, mode)
      _IO_FILE *fp;
-     _IO_pos_t pos;
+     _IO_off_t pos;
      int mode;
 {
   return _IO_SEEKOFF (fp, _IO_pos_as_off (pos), 0, mode);
@@ -551,7 +551,7 @@ _IO_default_finish (fp, dummy)
   _IO_un_link (fp);
 }
 
-_IO_pos_t
+_IO_off_t
 _IO_default_seekoff (fp, offset, dir, mode)
      _IO_FILE *fp;
      _IO_off_t offset;
@@ -882,7 +882,7 @@ _IO_default_pbackfail (fp, c)
   return (unsigned char) *fp->_IO_read_ptr;
 }
 
-_IO_pos_t
+_IO_off_t
 _IO_default_seek (fp, offset, dir)
      _IO_FILE *fp;
      _IO_off_t offset;
diff -urpb gcc-2.95.3-4\libio\ioftell.c gcc-2.95.3-4m\libio\ioftell.c
--- gcc-2.95.3-4\libio\ioftell.c	Fri Nov 05 14:10:16 1999
+++ gcc-2.95.3-4m\libio\ioftell.c	Wed May 16 19:38:47 2001
@@ -31,7 +31,7 @@ long int
 _IO_ftell (fp)
      _IO_FILE *fp;
 {
-  _IO_pos_t pos;
+  _IO_off_t pos;
   CHECK_FILE (fp, -1L);
   _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
   _IO_flockfile (fp);
diff -urpb gcc-2.95.3-4\libio\ioseekoff.c gcc-2.95.3-4m\libio\ioseekoff.c
--- gcc-2.95.3-4\libio\ioseekoff.c	Fri Nov 05 14:10:16 1999
+++ gcc-2.95.3-4m\libio\ioseekoff.c	Wed May 16 19:38:47 2001
@@ -25,14 +25,14 @@
 
 #include <libioP.h>
 
-_IO_pos_t
+_IO_off_t
 _IO_seekoff (fp, offset, dir, mode)
      _IO_FILE *fp;
      _IO_off_t offset;
      int dir;
      int mode;
 {
-  _IO_pos_t retval;
+  _IO_off_t retval;
 
   /* If we have a backup buffer, get rid of it, since the __seekoff
      callback may not know to do the right thing about it.
diff -urpb gcc-2.95.3-4\libio\ioseekpos.c gcc-2.95.3-4m\libio\ioseekpos.c
--- gcc-2.95.3-4\libio\ioseekpos.c	Fri Nov 05 14:10:16 1999
+++ gcc-2.95.3-4m\libio\ioseekpos.c	Wed May 16 19:38:47 2001
@@ -25,13 +25,13 @@
 
 #include <libioP.h>
 
-_IO_pos_t
+_IO_off_t
 _IO_seekpos (fp, pos, mode)
      _IO_FILE *fp;
-     _IO_pos_t pos;
+     _IO_off_t pos;
      int mode;
 {
-  _IO_pos_t retval;
+  _IO_off_t retval;
 
   /* If we have a backup buffer, get rid of it, since the __seekoff
      callback may not know to do the right thing about it.
diff -urpb gcc-2.95.3-4\libio\streambuf.cc gcc-2.95.3-4m\libio\streambuf.cc
--- gcc-2.95.3-4\libio\streambuf.cc	Fri Nov 05 14:10:18 1999
+++ gcc-2.95.3-4m\libio\streambuf.cc	Wed May 16 19:38:47 2001
@@ -150,12 +150,12 @@ static int _IO_sb_stat(_IO_FILE *fp, voi
 static int _IO_sb_doallocate(_IO_FILE *fp)
 { return ((streambuf*)fp)->doallocate(); }
 
-static _IO_pos_t _IO_sb_seekoff(_IO_FILE *fp, _IO_off_t pos, int dir, int mode)
+static _IO_off_t _IO_sb_seekoff(_IO_FILE *fp, _IO_off_t pos, int dir, int mode)
 {
   return ((streambuf*)fp)->seekoff(pos, (ios::seek_dir)dir, mode);
 }
 
-static _IO_pos_t _IO_sb_seekpos(_IO_FILE *fp, _IO_pos_t pos, int mode)
+static _IO_off_t _IO_sb_seekpos(_IO_FILE *fp, _IO_pos_t pos, int mode)
 {
   return ((streambuf*)fp)->seekpos(pos, mode);
 }
diff -urpb gcc-2.95.3-4\libio\strops.c gcc-2.95.3-4m\libio\strops.c
--- gcc-2.95.3-4\libio\strops.c	Fri Nov 05 14:10:18 1999
+++ gcc-2.95.3-4m\libio\strops.c	Wed May 16 19:38:47 2001
@@ -205,7 +205,7 @@ _IO_str_count (fp)
 	  - fp->_IO_read_base);
 }
 
-_IO_pos_t
+_IO_off_t
 _IO_str_seekoff (fp, offset, dir, mode)
      _IO_FILE *fp;
      _IO_off_t offset;
@@ -213,7 +213,7 @@ _IO_str_seekoff (fp, offset, dir, mode)
      int mode;
 {
   _IO_ssize_t cur_size = _IO_str_count (fp);
-  _IO_pos_t new_pos = EOF;
+  _IO_off_t new_pos = EOF;
 
   /* Move the get pointer, if requested. */
   if (mode & _IOS_INPUT)
