(ffewhere_file_kill): Remove prototype.
* where.c: Include ggc.h.
(struct _ffewhere_ll_, struct _ffewhere_root_ll_): Mark GTY.
(ffewhere_root_ll_): Ditto. Change type from struct
_ffewhere_root_ll_ to struct _ffewhere_root_ll_*. All uses
changed.
(ffewhere_file_kill): Remove.
(ffewhere_file_new): Use GC to allocate ffewhereFile objects.
(ffewhere_file_set): Use GC to allocate ffewhereLL_ objects.
(ffewhere_init_1): Use GC to allocate ffewhere_root_ll_ sentinel.
Include gt-f-where.h.
* lex.c (ffelex_current_wf_, ffelex_include_wherefile_): Mark GTY.
Include gt-f-lex.h.
* std.c (ffestd_S3P4): Don't call ffewhere_file_kill.
* config-lang.in (gtfiles): Add f/where.h f/where.c and f/lex.c.
* Make-lang.in (gt-f-lex.h gt-f-where.h): Add to dependents of
s-gtype.
(f/lex.o): Depend on gt-f-lex.h.
(f/where.o): Depend on gt-f-where.h.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56502
138bc75d-0d04-0410-961f-
82ee72b054a4
+2002-08-22 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * where.h (struct _ffewhere_file_): Mark GTY.
+ (ffewhere_file_kill): Remove prototype.
+ * where.c: Include ggc.h.
+ (struct _ffewhere_ll_, struct _ffewhere_root_ll_): Mark GTY.
+ (ffewhere_root_ll_): Ditto. Change type from struct
+ _ffewhere_root_ll_ to struct _ffewhere_root_ll_*. All uses
+ changed.
+ (ffewhere_file_kill): Remove.
+ (ffewhere_file_new): Use GC to allocate ffewhereFile objects.
+ (ffewhere_file_set): Use GC to allocate ffewhereLL_ objects.
+ (ffewhere_init_1): Use GC to allocate ffewhere_root_ll_ sentinel.
+ Include gt-f-where.h.
+ * lex.c (ffelex_current_wf_, ffelex_include_wherefile_): Mark GTY.
+ Include gt-f-lex.h.
+ * std.c (ffestd_S3P4): Don't call ffewhere_file_kill.
+ * config-lang.in (gtfiles): Add f/where.h f/where.c and f/lex.c.
+ * Make-lang.in (gt-f-lex.h gt-f-where.h): Add to dependents of
+ s-gtype.
+ (f/lex.o): Depend on gt-f-lex.h.
+ (f/where.o): Depend on gt-f-where.h.
+
Tue Aug 20 16:49:40 2002 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* where.c (ffewhere_track): Remove impossible if-then clause.
$(HOST_CC) $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
-c $(srcdir)/f/fini.c $(OUTPUT_OPTION)
-gt-f-com.h gt-f-ste.h gtype-f.h : s-gtype; @true
+gt-f-lex.h gt-f-where.h gt-f-com.h gt-f-ste.h gtype-f.h : s-gtype; @true
#\f
# Build hooks:
f/bld-op.def f/bit.h f/info.h f/info-b.def f/info-k.def f/info-w.def \
f/target.h f/lex.h f/type.h f/intrin.h f/intrin.def f/lab.h f/symbol.h \
f/symbol.def f/equiv.h f/storag.h f/global.h f/name.h f/src.h flags.h \
- debug.h input.h toplev.h output.h $(GGC_H)
+ debug.h input.h toplev.h output.h $(GGC_H) gt-f-lex.h
f/malloc.o: f/malloc.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/malloc.h
f/name.o: f/name.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/bad.h f/bad.def f/where.h \
glimits.h f/top.h f/malloc.h f/name.h f/global.h f/info.h f/info-b.def \
f/type.o: f/type.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/type.h f/malloc.h
f/version.o: f/version.c f/version.h
f/where.o: f/where.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/where.h glimits.h f/top.h \
- f/malloc.h f/lex.h $(GGC_H)
+ f/malloc.h f/lex.h $(GGC_H) gt-f-where.h
# Top level configure fragment for GNU FORTRAN.
-# Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1995, 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
#This file is part of GNU Fortran.
target_libs=target-libf2c
-gtfiles="\$(srcdir)/f/com.c \$(srcdir)/f/com.h \$(srcdir)/f/ste.c"
+gtfiles="\$(srcdir)/f/com.c \$(srcdir)/f/com.h \$(srcdir)/f/ste.c \$(srcdir)/f/where.h \$(srcdir)/f/where.c \$(srcdir)/f/lex.c"
/* The wf argument of the most recent active ffelex_file_(fixed,free)
function. */
-static ffewhereFile ffelex_current_wf_;
+static GTY (()) ffewhereFile ffelex_current_wf_;
/* TRUE if an INCLUDE statement can be processed (ffelex_set_include
can be called). */
/* Information on the pending INCLUDE file. */
static FILE *ffelex_include_file_;
static bool ffelex_include_free_form_;
-static ffewhereFile ffelex_include_wherefile_;
+static GTY(()) ffewhereFile ffelex_include_wherefile_;
/* Current master line count. */
static ffewhereLineNumber ffelex_linecount_current_;
t->uses++;
return t;
}
+
+#include "gt-f-lex.h"
/* std.c -- Implementation File (module.c template V1.0)
- Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 2000, 2002 Free Software Foundation, Inc.
Contributed by James Craig Burley.
This file is part of GNU Fortran.
fi = ffecom_open_include (ffewhere_file_name (wf),
ffelex_token_where_line (ffesta_tokens[0]),
ffelex_token_where_column (ffesta_tokens[0]));
- if (fi == NULL)
- ffewhere_file_kill (wf);
- else
+ if (fi != NULL)
ffelex_set_include (wf, (ffelex_token_type (ffesta_tokens[0])
== FFELEX_typeNAME), fi);
}
/* where.c -- Implementation File (module.c template V1.0)
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2002 Free Software Foundation, Inc.
Contributed by James Craig Burley.
This file is part of GNU Fortran.
#include "where.h"
#include "lex.h"
#include "malloc.h"
+#include "ggc.h"
/* Externals defined here. */
/* Internal structure definitions. */
-struct _ffewhere_ll_
+struct _ffewhere_ll_ GTY (())
{
ffewhereLL_ next;
ffewhereLL_ previous;
ffewhereLineNumber offset; /* User-desired offset (usually 1). */
};
-struct _ffewhere_root_ll_
+struct _ffewhere_root_ll_ GTY (())
{
ffewhereLL_ first;
ffewhereLL_ last;
/* Static objects accessed by functions in this module. */
-static struct _ffewhere_root_ll_ ffewhere_root_ll_;
+static GTY (()) struct _ffewhere_root_ll_ *ffewhere_root_ll_;
static struct _ffewhere_root_line_ ffewhere_root_line_;
/* Static functions (internal). */
ffewhereLL_ ll;
if (ln == 0)
- return ffewhere_root_ll_.first;
+ return ffewhere_root_ll_->first;
- for (ll = ffewhere_root_ll_.last;
- ll != (ffewhereLL_) &ffewhere_root_ll_.first;
+ for (ll = ffewhere_root_ll_->last;
+ ll != (ffewhereLL_) &ffewhere_root_ll_->first;
ll = ll->previous)
{
if (ll->line_no <= ln)
return NULL;
}
-/* Kill file object.
-
- Note that this object must not have been passed in a call
- to any other ffewhere function except ffewhere_file_name and
- ffewhere_file_namelen. */
-
-void
-ffewhere_file_kill (ffewhereFile wf)
-{
- malloc_kill_ks (ffe_pool_file (), wf,
- offsetof (struct _ffewhere_file_, text)
- + wf->length + 1);
-}
-
/* Create file object. */
ffewhereFile
ffewhere_file_new (const char *name, size_t length)
{
ffewhereFile wf;
-
- wf = malloc_new_ks (ffe_pool_file (), "ffewhereFile",
- offsetof (struct _ffewhere_file_, text)
- + length + 1);
+ wf = ggc_alloc (offsetof (struct _ffewhere_file_, text) + length + 1);
wf->length = length;
memcpy (&wf->text[0], name, length);
wf->text[length] = '\0';
ffewhere_file_set (ffewhereFile wf, bool have_num, ffewhereLineNumber ln)
{
ffewhereLL_ ll;
-
- ll = malloc_new_kp (ffe_pool_file (), "ffewhereLL_", sizeof (*ll));
- ll->next = (ffewhereLL_) &ffewhere_root_ll_.first;
- ll->previous = ffewhere_root_ll_.last;
+ ll = ggc_alloc (sizeof (*ll));
+ ll->next = (ffewhereLL_) &ffewhere_root_ll_->first;
+ ll->previous = ffewhere_root_ll_->last;
ll->next->previous = ll;
ll->previous->next = ll;
if (wf == NULL)
= (ffewhereLine) &ffewhere_root_line_.first;
ffewhere_root_line_.none = 0;
- ffewhere_root_ll_.first = ffewhere_root_ll_.last
- = (ffewhereLL_) &ffewhere_root_ll_.first;
+ /* The sentinel is (must be) GGC-allocated. It is accessed as a
+ struct _ffewhere_ll_/ffewhereLL_ though its type contains just the
+ first two fields (layout-wise). */
+ ffewhere_root_ll_ = ggc_alloc_cleared (sizeof (struct _ffewhere_ll_));
+ ffewhere_root_ll_->first = ffewhere_root_ll_->last
+ = (ffewhereLL_) &ffewhere_root_ll_->first;
}
/* Return the textual content of the line. */
}
}
}
+
+#include "gt-f-where.h"
/* where.h -- Public #include File (module.h template V1.0)
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2002 Free Software Foundation, Inc.
Contributed by James Craig Burley.
This file is part of GNU Fortran.
/* Structure definitions. */
-struct _ffewhere_file_
+struct _ffewhere_file_ GTY (())
{
size_t length;
char text[1];
/* Declare functions with prototypes. */
-void ffewhere_file_kill (ffewhereFile wf);
ffewhereFile ffewhere_file_new (const char *name, size_t length);
void ffewhere_file_set (ffewhereFile wf, bool have_num, ffewhereLineNumber ln);
void ffewhere_init_1 (void);