If someone puts a .d file in a .gch directory, we will still warn even if the user did not use -Winvalid-PCH. All other reasons why we would reject a PCH including an invalid magic is conditionalized on -Winvalid-PCH so should this warning.
I have a simple fix for 4.4.0: Index: c-pch.c =================================================================== --- c-pch.c (revision 131943) +++ c-pch.c (working copy) @@ -243,8 +243,9 @@ fatal_error ("can%'t read %s: %m", name); else if (sizeread != IDENT_LENGTH + 16) { - cpp_error (pfile, CPP_DL_WARNING, "%s: too short to be a PCH file", - name); + if (cpp_get_options (pfile)->warn_invalid_pch) + cpp_error (pfile, CPP_DL_WARNING, "%s: too short to be a PCH file", + name); return 2; }
Fixed.
Subject: Bug 35027 Author: pinskia Date: Sat Feb 23 17:08:12 2008 New Revision: 132574 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132574 Log: 2008-02-23 Andrew Pinski <andrew_pinski@playstation.sony.com> PR pch/35027 * c-pch.c (c_common_valid_pch): Make the "too short to be a PCH file" warning condtional on -Winvalid-PCH. Modified: trunk/gcc/ChangeLog trunk/gcc/c-pch.c