This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

patch: Fix gengtype to really detect same files


Hi,

I just hit this problem where gengtype thought an existing gt-*.h header 
was the same as what it wanted to write because its prefix was indeed 
equal to the buffer, but contained some additional things afterwards.  
gengtype simply forgot to check that the file end is reached at buffer 
end.  Done with the below obivious patch.  Fixed the problem I have on 
x86_64-linux, otherwise creates same gt files, regstrapped with some other 
patches, no regressions.  Applied as r204015.


Ciao,
Michael.
-- 
	* gengtype.c (is_file_equal): Check that files will be same
	length.

Index: gengtype.c
===================================================================
--- gengtype.c	(revision 204007)
+++ gengtype.c	(working copy)
@@ -2344,6 +2344,8 @@ is_file_equal (outf_p of)
 	  break;
 	}
     }
+  if (equal && EOF != fgetc (newfile))
+    equal = false;
   fclose (newfile);
   return equal;
 }


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