cppfiles.c (STAT_SIZE_TOO_BIG): Define.
authorDouglas B Rupp <rupp@gnat.com>
Wed, 21 Nov 2001 22:03:27 +0000 (17:03 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Wed, 21 Nov 2001 22:03:27 +0000 (17:03 -0500)
* cppfiles.c (STAT_SIZE_TOO_BIG): Define.
(read_include_file): Use STAT_SIZE_TOO_BIG.

From-SVN: r47245

gcc/ChangeLog
gcc/cppfiles.c

index 351c21e0e69c080f657269bb4fa977ee2b85cefa..3e0ad011f51e64e382880d252ef86fc6435e024f 100644 (file)
@@ -1,5 +1,8 @@
 Wed Nov 21 16:44:01 2001  Douglas B. Rupp  <rupp@gnat.com>
 
+       * cppfiles.c (STAT_SIZE_TOO_BIG): Define.
+       (read_include_file): Use STAT_SIZE_TOO_BIG.
+
        * cppinit.c (INO_T_COPY): Define.
        (INO_T_EQ): Uppercase parameters.
        (append_include_chain): Use INO_T_COPY.
index bacb8e18ef97d06087b897bcf9fc13440b2ca547..32994f7256eab4d026064e5819cedeee9463847a 100644 (file)
@@ -73,6 +73,15 @@ struct include_file
   unsigned char mapped;                /* file buffer is mmapped */
 };
 
+/* Variable length record files on VMS will have a stat size that includes
+   record control characters that won't be included in the read size. */
+#ifdef VMS
+# define FAB_C_VAR 2 /* variable length records (see Starlet fabdef.h) */
+# define STAT_SIZE_TOO_BIG(ST) ((ST).st_fab_rfm == FAB_C_VAR)
+#else
+# define STAT_SIZE_TOO_BIG(ST) 0
+#endif
+
 /* The cmacro works like this: If it's NULL, the file is to be
    included again.  If it's NEVER_REREAD, the file is never to be
    included again.  Otherwise it is a macro hashnode, and the file is
@@ -392,7 +401,11 @@ read_include_file (pfile, inc)
                goto perror_fail;
              if (count == 0)
                {
-                 cpp_warning (pfile, "%s is shorter than expected", inc->name);
+                 if (!STAT_SIZE_TOO_BIG (inc->st))
+                   cpp_warning
+                     (pfile, "%s is shorter than expected", inc->name);
+                 buf = xrealloc (buf, offset);
+                 inc->st.st_size = offset;
                  break;
                }
              offset += count;