From 4cdf72233bf62dc514506547a73231914d50c42f Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Fri, 17 Sep 2004 17:07:43 +0000 Subject: [PATCH] gfortran.h (struct gfc_linebuf): Don't use C99 empty arrays. * 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 | 6 ++++++ gcc/fortran/gfortran.h | 6 ++++-- gcc/fortran/scanner.c | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fb2306967e3..4d4b445cc34 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2004-09-17 Paul Brook + + * 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 * array.c, data.c, decl.c, dependency.c, error.c, f95-lang.c, diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 8ec92157755..94d5374e8a3 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -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; diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 9f03c77d996..3c6ca19abd9 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -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 -- 2.30.2