User account creation filtered due to spam.

Bug 35027 - "too short to be a PCH file" warning should be conditional on -Winvalid-PCH
Summary: "too short to be a PCH file" warning should be conditional on -Winvalid-PCH
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: pch (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.4.0
Assignee: Andrew Pinski
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: diagnostic, patch
Depends on:
Blocks: 4.4pending
  Show dependency treegraph
 
Reported: 2008-01-30 00:42 UTC by Andrew Pinski
Modified: 2008-02-23 17:08 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-01-30 00:43:57


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2008-01-30 00:42:16 UTC
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.
Comment 1 Andrew Pinski 2008-01-30 00:43:57 UTC
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;
     }
 

Comment 2 Andrew Pinski 2008-02-23 17:08:21 UTC
Fixed.
Comment 3 Andrew Pinski 2008-02-23 17:08:57 UTC
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