From 24c0aad7e700242c21cf050b3e0f9454b4d2ccb5 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Tue, 18 Jun 2002 09:55:35 +0000 Subject: [PATCH] * src/symtab.h, src/symtab.c (symbol_t): destructor_location is a new member. (symbol_destructor_set): Adjust. * src/output.c (symbol_destructors_output): Output the destructor locations. Output the symbol name. * data/bison.simple (b4_symbol_destructor): Adjust. --- ChangeLog | 10 ++++++++++ data/bison.simple | 14 ++++++++++---- src/output.c | 12 +++++++++--- src/symtab.c | 5 ++++- src/symtab.h | 5 +++-- 5 files changed, 36 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 96774cbc..6e1e722c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-06-18 Akim Demaille + + * src/symtab.h, src/symtab.c (symbol_t): destructor_location is a + new member. + (symbol_destructor_set): Adjust. + * src/output.c (symbol_destructors_output): Output the destructor + locations. + Output the symbol name. + * data/bison.simple (b4_symbol_destructor): Adjust. + 2002-06-18 Cris Bailiff and Akim Demaille diff --git a/data/bison.simple b/data/bison.simple index 7b48459a..12710369 100644 --- a/data/bison.simple +++ b/data/bison.simple @@ -1267,7 +1267,11 @@ yyreturn: return yyresult; ]} -/* Release the memory associated to SYMBOL-NUMBER. */ + +/*-------------------------------------------------. +| Release the memory associated to SYMBOL-NUMBER. | +`-------------------------------------------------*/ + m4_divert_push([KILL])# M4 code. # b4_eval # ------- @@ -1280,9 +1284,11 @@ m4_define([b4_eval], # b4_symbol_destructor(SYMBOL-NUMBER, DESTRUCTOR, TYPE-NAME) # ---------------------------------------------------------- m4_define([b4_symbol_destructor], -[m4_pushdef([b4_dollar_dollar], [symbol_value.$3])dnl - case $1: - b4_eval($2); +[m4_pushdef([b4_dollar_dollar], [symbol_value.$6])dnl + case $4: /* $3 */ +#line $2 "$1" + b4_eval($5); +#line __oline__ "__ofile__" break; m4_popdef([b4_dollar_dollar])]) diff --git a/src/output.c b/src/output.c index 78113fd1..a2049ce4 100644 --- a/src/output.c +++ b/src/output.c @@ -622,10 +622,16 @@ symbol_destructors_output (FILE *out) { symbol_t *symbol = symbols[i]; - /* Symbol-number, destructor. */ - fprintf (out, "%s[[[%d]], [[%s]], [[%s]]]", + /* Filename, lineno, + Symbol-name, Symbol-number, + destructor, typename. */ + fprintf (out, "%s[[[%s]], [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]", first ? "" : ",\n", - symbol->number, symbol->destructor, symbol->type_name); + infile, symbol->destructor_location.first_line, + symbol_tag_get (symbol), + symbol->number, + symbol->destructor, + symbol->type_name); first = 0; } diff --git a/src/symtab.c b/src/symtab.c index 0d8e1f49..655b8fa9 100644 --- a/src/symtab.c +++ b/src/symtab.c @@ -47,9 +47,11 @@ symbol_new (const char *tag, location_t location) symbol_t *res = XMALLOC (symbol_t, 1); res->tag = xstrdup (tag); + res->location = location; + res->type_name = NULL; res->destructor = NULL; - res->location = location; + res->number = NUMBER_UNDEFINED; res->prec = 0; res->assoc = right_assoc; @@ -130,6 +132,7 @@ symbol_destructor_set (symbol_t *symbol, location_t location, char *destructor) _("destructor redeclaration for %s"), symbol_tag_get (symbol)); symbol->destructor = destructor; + symbol->destructor_location = location; } } diff --git a/src/symtab.h b/src/symtab.h index 54ff80fa..b7cf6be2 100644 --- a/src/symtab.h +++ b/src/symtab.h @@ -56,13 +56,14 @@ struct symbol_s { /* The key, name of the symbol. */ char *tag; + /* The location of its first occurence. */ + location_t location; /* Its %type and associated destructor. */ char *type_name; char *destructor; + location_t destructor_location; - /* The location of its first occurence. */ - location_t location; symbol_number_t number; short prec; -- 2.45.2