This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch: Fix gengtype to really detect same files
- From: Michael Matz <matz at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 24 Oct 2013 15:59:44 +0200 (CEST)
- Subject: patch: Fix gengtype to really detect same files
- Authentication-results: sourceware.org; auth=none
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;
}