gfortran.h (struct gfc_linebuf): Don't use C99 empty arrays.
authorPaul Brook <paul@codesourcery.com>
Fri, 17 Sep 2004 17:07:43 +0000 (17:07 +0000)
committerPaul Brook <pbrook@gcc.gnu.org>
Fri, 17 Sep 2004 17:07:43 +0000 (17:07 +0000)
* gfortran.h (struct gfc_linebuf): Don't use C99 empty arrays.
(gfc_linebuf_header_size): Define.
* scanner.c (load_file): Use it.

From-SVN: r87655

gcc/fortran/ChangeLog
gcc/fortran/gfortran.h
gcc/fortran/scanner.c

index fb2306967e3611e1bd6d6421deec34450bab20c9..4d4b445cc34895c5068e8c719f19881bcffd6de9 100644 (file)
@@ -1,3 +1,9 @@
+2004-09-17  Paul Brook  <paul@codesourcery.com>
+
+       * gfortran.h (struct gfc_linebuf): Don't use C99 empty arrays.
+       (gfc_linebuf_header_size): Define.
+       * scanner.c (load_file): Use it.
+
 2004-09-16  Kazu Hirata  <kazu@cs.umass.edu>
 
        * array.c, data.c, decl.c, dependency.c, error.c, f95-lang.c,
index 8ec9215775538f207653f0b9f57e115401073ca5..94d5374e8a3d1f9d34356f03a21b49f90e20f98d 100644 (file)
@@ -469,9 +469,11 @@ typedef struct gfc_linebuf
   struct gfc_file *file;
   struct gfc_linebuf *next;
 
-  char line[];
+  char line[1];
 } gfc_linebuf;
-  
+
+#define gfc_linebuf_header_size (offsetof (gfc_linebuf, line))
+
 typedef struct 
 {
   char *nextc;
index 9f03c77d9963456d0bb611d2d3f1b57d55dd1a7a..3c6ca19abd9df36e09c01d342757db76d62d3977 100644 (file)
@@ -1034,7 +1034,7 @@ load_file (char *filename, bool initial)
 
       /* Add line.  */
 
-      b = gfc_getmem (sizeof (gfc_linebuf) + len + 1);
+      b = gfc_getmem (gfc_linebuf_header_size + len + 1);
 
 #ifdef USE_MAPPED_LOCATION
       b->location