Commit 7a561142 by Gabriel Dos Reis Committed by Gabriel Dos Reis

spew.c (struct uinparsed_test): Replace 'filename' and 'lineno' members with 'locus'.

        * spew.c (struct uinparsed_test): Replace 'filename' and 'lineno'
        members with 'locus'.  Adjust use throughout.
        (struct feed):  Likewise.
        (alloc_unparsed_test): Change prototype, take a 'const location_t *'.
        Adjust use.
        (snarf_defarg): Use error(), not error_with_file_and_line().

From-SVN: r55610
parent 3d1fc129
2002-07-20 Gabriel Dos Reis <gdr@nerim.net>
* spew.c (struct uinparsed_test): Replace 'filename' and 'lineno'
members with 'locus'. Adjust use throughout.
(struct feed): Likewise.
(alloc_unparsed_test): Change prototype, take a 'const location_t *'.
Adjust use.
(snarf_defarg): Use error(), not error_with_file_and_line().
2002-07-19 Chris Demetriou <cgd@broadcom.com> 2002-07-19 Chris Demetriou <cgd@broadcom.com>
* lang-specs.h (@c++): Include "%2" (cc1plus_spec) wherever * lang-specs.h (@c++): Include "%2" (cc1plus_spec) wherever
......
...@@ -79,8 +79,7 @@ struct unparsed_text GTY(()) ...@@ -79,8 +79,7 @@ struct unparsed_text GTY(())
{ {
struct unparsed_text *next; /* process this one next */ struct unparsed_text *next; /* process this one next */
tree decl; /* associated declaration */ tree decl; /* associated declaration */
const char *filename; /* name of file we were processing */ location_t locus; /* location we got the text from */
int lineno; /* line number we got the text from */
int interface; /* remembering interface_unknown and interface_only */ int interface; /* remembering interface_unknown and interface_only */
struct token_chunk * tokens; /* Start of the token list. */ struct token_chunk * tokens; /* Start of the token list. */
...@@ -98,8 +97,7 @@ struct unparsed_text GTY(()) ...@@ -98,8 +97,7 @@ struct unparsed_text GTY(())
struct feed GTY(()) struct feed GTY(())
{ {
struct unparsed_text *input; struct unparsed_text *input;
const char *filename; location_t locus;
int lineno;
int yychar; int yychar;
YYSTYPE GTY ((desc ("%1.yychar"))) yylval; YYSTYPE GTY ((desc ("%1.yychar"))) yylval;
int first_token; int first_token;
...@@ -131,7 +129,7 @@ static SPEW_INLINE struct token * space_for_token ...@@ -131,7 +129,7 @@ static SPEW_INLINE struct token * space_for_token
static SPEW_INLINE struct token * remove_last_token static SPEW_INLINE struct token * remove_last_token
PARAMS ((struct unparsed_text *t)); PARAMS ((struct unparsed_text *t));
static struct unparsed_text * alloc_unparsed_text static struct unparsed_text * alloc_unparsed_text
PARAMS ((const char *fn, int li, tree decl, int interface)); PARAMS ((const location_t *, tree decl, int interface));
static void snarf_block PARAMS ((struct unparsed_text *t)); static void snarf_block PARAMS ((struct unparsed_text *t));
static tree snarf_defarg PARAMS ((void)); static tree snarf_defarg PARAMS ((void));
...@@ -403,20 +401,20 @@ feed_input (input) ...@@ -403,20 +401,20 @@ feed_input (input)
#ifdef SPEW_DEBUG #ifdef SPEW_DEBUG
if (spew_debug) if (spew_debug)
fprintf (stderr, "\tfeeding %s:%d [%d tokens]\n", fprintf (stderr, "\tfeeding %s:%d [%d tokens]\n",
input->filename, input->lineno, input->limit - input->pos); input->locus.file, input->locus.line, input->limit - input->pos);
#endif #endif
f->input = input; f->input = input;
f->filename = input_filename; f->locus.file = input_filename;
f->lineno = lineno; f->locus.line = lineno;
f->yychar = yychar; f->yychar = yychar;
f->yylval = yylval; f->yylval = yylval;
f->first_token = first_token; f->first_token = first_token;
f->token_obstack = token_obstack; f->token_obstack = token_obstack;
f->next = feed; f->next = feed;
input_filename = input->filename; input_filename = input->locus.file;
lineno = input->lineno; lineno = input->locus.line;
yychar = YYEMPTY; yychar = YYEMPTY;
yylval.ttype = NULL_TREE; yylval.ttype = NULL_TREE;
first_token = 0; first_token = 0;
...@@ -429,8 +427,8 @@ end_input () ...@@ -429,8 +427,8 @@ end_input ()
{ {
struct feed *f = feed; struct feed *f = feed;
input_filename = f->filename; input_filename = f->locus.file;
lineno = f->lineno; lineno = f->locus.line;
yychar = f->yychar; yychar = f->yychar;
yylval = f->yylval; yylval = f->yylval;
first_token = f->first_token; first_token = f->first_token;
...@@ -1070,17 +1068,15 @@ remove_last_token (t) ...@@ -1070,17 +1068,15 @@ remove_last_token (t)
/* Allocate an 'unparsed_text' structure, ready to use space_for_token. */ /* Allocate an 'unparsed_text' structure, ready to use space_for_token. */
static struct unparsed_text * static struct unparsed_text *
alloc_unparsed_text (fn, li, decl, interface) alloc_unparsed_text (locus, decl, interface)
const char *fn; const location_t *locus;
int li;
tree decl; tree decl;
int interface; int interface;
{ {
struct unparsed_text *r; struct unparsed_text *r;
r = ggc_alloc_cleared (sizeof (*r)); r = ggc_alloc_cleared (sizeof (*r));
r->decl = decl; r->decl = decl;
r->filename = fn; r->locus = *locus;
r->lineno = li;
r->interface = interface; r->interface = interface;
r->tokens = r->last_chunk = ggc_alloc_cleared (sizeof (*r->tokens)); r->tokens = r->last_chunk = ggc_alloc_cleared (sizeof (*r->tokens));
return r; return r;
...@@ -1166,8 +1162,7 @@ snarf_block (t) ...@@ -1166,8 +1162,7 @@ snarf_block (t)
} }
else if (yyc == 0) else if (yyc == 0)
{ {
error_with_file_and_line (t->filename, t->lineno, error ("%Hend of file read inside definition", &t->locus);
"end of file read inside definition");
break; break;
} }
} }
...@@ -1179,13 +1174,13 @@ void ...@@ -1179,13 +1174,13 @@ void
snarf_method (decl) snarf_method (decl)
tree decl; tree decl;
{ {
int starting_lineno = lineno;
const char *starting_filename = input_filename;
struct unparsed_text *meth; struct unparsed_text *meth;
location_t starting;
starting.file = input_filename;
starting.line = lineno;
meth = alloc_unparsed_text (starting_filename, starting_lineno, decl, meth = alloc_unparsed_text (&starting, decl, (interface_unknown ? 1
(interface_unknown ? 1 : (interface_only ? 0 : 2)));
: (interface_only ? 0 : 2)));
snarf_block (meth); snarf_block (meth);
...@@ -1198,8 +1193,7 @@ snarf_method (decl) ...@@ -1198,8 +1193,7 @@ snarf_method (decl)
#ifdef SPEW_DEBUG #ifdef SPEW_DEBUG
if (spew_debug) if (spew_debug)
fprintf (stderr, "\tsaved method of %d tokens from %s:%d\n", fprintf (stderr, "\tsaved method of %d tokens from %s:%d\n",
meth->limit, meth->limit, starting.file, starting.line);
starting_filename, starting_lineno);
#endif #endif
DECL_PENDING_INLINE_INFO (decl) = meth; DECL_PENDING_INLINE_INFO (decl) = meth;
...@@ -1218,14 +1212,15 @@ snarf_method (decl) ...@@ -1218,14 +1212,15 @@ snarf_method (decl)
static tree static tree
snarf_defarg () snarf_defarg ()
{ {
int starting_lineno = lineno;
const char *starting_filename = input_filename;
int yyc; int yyc;
int plev = 0; int plev = 0;
struct unparsed_text *buf; struct unparsed_text *buf;
tree arg; tree arg;
location_t starting;
starting.file = input_filename;
starting.line = lineno;
buf = alloc_unparsed_text (starting_filename, starting_lineno, 0, 0); buf = alloc_unparsed_text (&starting, 0, 0);
for (;;) for (;;)
{ {
...@@ -1239,8 +1234,7 @@ snarf_defarg () ...@@ -1239,8 +1234,7 @@ snarf_defarg ()
--plev; --plev;
else if (yyc == 0) else if (yyc == 0)
{ {
error_with_file_and_line (starting_filename, starting_lineno, error ("%Hend of file read inside default argument", &starting);
"end of file read inside default argument");
goto done; goto done;
} }
} }
...@@ -1252,8 +1246,7 @@ snarf_defarg () ...@@ -1252,8 +1246,7 @@ snarf_defarg ()
#ifdef SPEW_DEBUG #ifdef SPEW_DEBUG
if (spew_debug) if (spew_debug)
fprintf (stderr, "\tsaved defarg of %d tokens from %s:%d\n", fprintf (stderr, "\tsaved defarg of %d tokens from %s:%d\n",
buf->limit, buf->limit, starting.file, starting.line);
starting_filename, starting_lineno);
#endif #endif
arg = make_node (DEFAULT_ARG); arg = make_node (DEFAULT_ARG);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment