2003-06-16 Danny Smith PR other/5620 * gcc.c (do_spec_1): Use (HOST_FILE_ID_CMP), if defined, rather than stat. * config/i386/mingw32-1.c: New file. (w32_file_id_cmp): Define. * config/i386/xm-mingw32.h (w32_file_id_cmp): Declare. (HOST_FILE_ID_CMP): Define as w32_file_id_cmp. Update copyright year and GCC notice. * config/i386/x-mingw32: Set EXTRA_GCC_OBJS to mingw32-1.o. Add rule for compiling mingw32-1.o Index: gcc/gcc.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/gcc.c,v retrieving revision 1.379 diff -c -3 -p -r1.379 gcc.c *** gcc/gcc.c 4 Jun 2003 17:50:40 -0000 1.379 --- gcc/gcc.c 16 Jun 2003 23:51:02 -0000 *************** static int basename_length; *** 4174,4180 **** --- 4174,4182 ---- static int suffixed_basename_length; static const char *input_basename; static const char *input_suffix; + #ifndef HOST_FILE_ID_CMP static struct stat input_stat; + #endif static int input_stat_set; /* The compiler used to process the current input file. */ *************** do_spec_1 (spec, inswitch, soft_matched_ *** 4733,4739 **** *((char *) temp_filename + temp_filename_length) = '\0'; if (strcmp (temp_filename, input_filename) != 0) { ! struct stat st_temp; /* Note, set_input() resets input_stat_set to 0. */ if (input_stat_set == 0) --- 4735,4744 ---- *((char *) temp_filename + temp_filename_length) = '\0'; if (strcmp (temp_filename, input_filename) != 0) { ! #if defined HOST_FILE_ID_CMP ! if (HOST_FILE_ID_CMP(input_filename, temp_filename) != 0) ! #else ! struct stat st_temp; /* Note, set_input() resets input_stat_set to 0. */ if (input_stat_set == 0) *************** do_spec_1 (spec, inswitch, soft_matched_ *** 4752,4757 **** --- 4757,4763 ---- || stat (temp_filename, &st_temp) < 0 || input_stat.st_dev != st_temp.st_dev || input_stat.st_ino != st_temp.st_ino) + #endif { temp_filename = save_string (temp_filename, temp_filename_length + 1); --- 864,866 ---- Index: gcc/config/i386/x-mingw32 =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/i386/x-mingw32,v retrieving revision 1.2 diff -c -3 -p -r1.2 x-mingw32 *** gcc/config/i386/x-mingw32 28 May 2003 21:06:23 -0000 1.2 --- gcc/config/i386/x-mingw32 16 Jun 2003 23:51:03 -0000 *************** *** 2,4 **** --- 2,15 ---- # Make local_includedir relative to EXEC_PREFIX # local_includedir=$(libsubdir)/$(unlibsubdir)/..`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'`/include + + # + # For HOST_FILE_ID_CMP for mingw32. + # + EXTRA_GCC_OBJS = mingw32-1.o + + mingw32-1.o: $(srcdir)/config/i386/mingw32-1.c \ + $(srcdir)/config/i386/xm-mingw32.h + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(srcdir)/config/i386/mingw32-1.c + Index: gcc/config/i386/xm-mingw32.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/i386/xm-mingw32.h,v retrieving revision 1.15 diff -c -3 -p -r1.15 xm-mingw32.h *** gcc/config/i386/xm-mingw32.h 10 Jan 2002 22:21:39 -0000 1.15 --- gcc/config/i386/xm-mingw32.h 16 Jun 2003 23:51:03 -0000 *************** *** 1,23 **** /* Configuration for GNU C-compiler for hosting on Windows32. using GNU tools and the Windows32 API Library. ! Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc. ! This file is part of GNU CC. ! GNU CC is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2, or (at your option) ! any later version. ! ! GNU CC is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. You should have received a copy of the GNU General Public License ! along with GNU CC; see the file COPYING. If not, write to ! the Free Software Foundation, 59 Temple Place - Suite 330, ! Boston, MA 02111-1307, USA. */ /* Even though we support "/", allow "\" since everybody tests both. */ #define DIR_SEPARATOR '\\' --- 1,24 ---- /* Configuration for GNU C-compiler for hosting on Windows32. using GNU tools and the Windows32 API Library. ! Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003 Free Software ! Foundation, Inc. ! This file is part of GCC. ! GCC is free software; you can redistribute it and/or modify it under ! the terms of the GNU General Public License as published by the Free ! Software Foundation; either version 2, or (at your option) any later ! version. ! ! GCC is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or ! FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ! for more details. You should have received a copy of the GNU General Public License ! along with GCC; see the file COPYING. If not, write to the Free ! Software Foundation, 59 Temple Place - Suite 330, Boston, MA ! 02111-1307, USA. */ /* Even though we support "/", allow "\" since everybody tests both. */ #define DIR_SEPARATOR '\\' *************** Boston, MA 02111-1307, USA. */ *** 31,33 **** --- 32,41 ---- #undef PATH_SEPARATOR #define PATH_SEPARATOR ';' + + /* This replaces the use of stat to determine if files are different + in gcc.c (do_spec_1) handling of --save-temps switch. */ + + extern int + w32_file_id_cmp (const char *, const char *); + #define HOST_FILE_ID_CMP(SRC,DST) w32_file_id_cmp (SRC, DST) *** /dev/null Tue Jun 17 00:51:56 2003 --- gcc/config/i386/mingw32-1.c Mon Jun 16 22:26:35 2003 *************** *** 0 **** --- 1,40 ---- + /* This replaces the use of stat and struct stat.st_ino to determine if + files are different in gcc.c (do_spec_1) handling of --save-temps + switch. + Contributed by Danny Smith (dannysmith@users.sourceforge.net) + Copyright 2003 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2, or (at your option) any later + version. + + GCC is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + + #include "i386/xm-mingw32.h" + #define WIN32_LEAN_AND_MEAN + #include + + /* Return non-zero if src and dst filenames do not refer to same files. */ + + int + w32_file_id_cmp (const char * src, const char * dst) + { + char fullpath_src[MAX_PATH]; + char fullpath_dst[MAX_PATH]; + char* pfilename; + + /* Just compare full pathnames, without regard to case. */ + GetFullPathName (src, MAX_PATH, fullpath_src, &pfilename); + GetFullPathName (dst, MAX_PATH, fullpath_dst, &pfilename); + return (lstrcmpi (fullpath_src, fullpath_dst)); + }