mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 09:13:04 +00:00
style: rename error functions for clarity
* src/symtab.c (symbol_redeclaration, semantic_type_redeclaration) (user_token_number_redeclaration): Rename as... (complain_symbol_redeclared, complain_semantic_type_redeclared) (complain_user_token_number_redeclared): this.
This commit is contained in:
1
TODO
1
TODO
@@ -10,7 +10,6 @@ Several features are not available in all the backends.
|
|||||||
** consistency
|
** consistency
|
||||||
nonterminal vs non terminal vs non-terminal
|
nonterminal vs non terminal vs non-terminal
|
||||||
token vs terminal
|
token vs terminal
|
||||||
redeclaration vs redefinition
|
|
||||||
|
|
||||||
** yacc.c
|
** yacc.c
|
||||||
Now that ylwrap is fixed, we should include foo.tab.h from foo.tab.c rather
|
Now that ylwrap is fixed, we should include foo.tab.h from foo.tab.c rather
|
||||||
|
|||||||
31
src/symtab.c
31
src/symtab.c
@@ -277,8 +277,8 @@ symbol_id_get (symbol const *sym)
|
|||||||
`------------------------------------------------------------------*/
|
`------------------------------------------------------------------*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
symbol_redeclaration (symbol *s, const char *what, location first,
|
complain_symbol_redeclared (symbol *s, const char *what, location first,
|
||||||
location second)
|
location second)
|
||||||
{
|
{
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
locations_sort (&first, &second);
|
locations_sort (&first, &second);
|
||||||
@@ -290,8 +290,8 @@ symbol_redeclaration (symbol *s, const char *what, location first,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
semantic_type_redeclaration (semantic_type *s, const char *what, location first,
|
complain_semantic_type_redeclared (semantic_type *s, const char *what, location first,
|
||||||
location second)
|
location second)
|
||||||
{
|
{
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
locations_sort (&first, &second);
|
locations_sort (&first, &second);
|
||||||
@@ -335,7 +335,8 @@ symbol_type_set (symbol *sym, uniqstr type_name, location loc)
|
|||||||
if (type_name)
|
if (type_name)
|
||||||
{
|
{
|
||||||
if (sym->content->type_name)
|
if (sym->content->type_name)
|
||||||
symbol_redeclaration (sym, "%type", sym->content->type_location, loc);
|
complain_symbol_redeclared (sym, "%type",
|
||||||
|
sym->content->type_location, loc);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uniqstr_assert (type_name);
|
uniqstr_assert (type_name);
|
||||||
@@ -354,9 +355,9 @@ symbol_code_props_set (symbol *sym, code_props_type kind,
|
|||||||
code_props const *code)
|
code_props const *code)
|
||||||
{
|
{
|
||||||
if (sym->content->props[kind].code)
|
if (sym->content->props[kind].code)
|
||||||
symbol_redeclaration (sym, code_props_type_string (kind),
|
complain_symbol_redeclared (sym, code_props_type_string (kind),
|
||||||
sym->content->props[kind].location,
|
sym->content->props[kind].location,
|
||||||
code->location);
|
code->location);
|
||||||
else
|
else
|
||||||
sym->content->props[kind] = *code;
|
sym->content->props[kind] = *code;
|
||||||
}
|
}
|
||||||
@@ -371,9 +372,9 @@ semantic_type_code_props_set (semantic_type *type,
|
|||||||
code_props const *code)
|
code_props const *code)
|
||||||
{
|
{
|
||||||
if (type->props[kind].code)
|
if (type->props[kind].code)
|
||||||
semantic_type_redeclaration (type, code_props_type_string (kind),
|
complain_semantic_type_redeclared (type, code_props_type_string (kind),
|
||||||
type->props[kind].location,
|
type->props[kind].location,
|
||||||
code->location);
|
code->location);
|
||||||
else
|
else
|
||||||
type->props[kind] = *code;
|
type->props[kind] = *code;
|
||||||
}
|
}
|
||||||
@@ -421,8 +422,8 @@ symbol_precedence_set (symbol *sym, int prec, assoc a, location loc)
|
|||||||
{
|
{
|
||||||
sym_content *s = sym->content;
|
sym_content *s = sym->content;
|
||||||
if (s->prec)
|
if (s->prec)
|
||||||
symbol_redeclaration (sym, assoc_to_string (a),
|
complain_symbol_redeclared (sym, assoc_to_string (a),
|
||||||
s->prec_location, loc);
|
s->prec_location, loc);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s->prec = prec;
|
s->prec = prec;
|
||||||
@@ -656,7 +657,7 @@ symbol_pack_processor (void *this, void *null ATTRIBUTE_UNUSED)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
user_token_number_redeclaration (int num, symbol *first, symbol *second)
|
complain_user_token_number_redeclared (int num, symbol *first, symbol *second)
|
||||||
{
|
{
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
symbols_sort (&first, &second);
|
symbols_sort (&first, &second);
|
||||||
@@ -683,7 +684,7 @@ symbol_translation (symbol *this)
|
|||||||
/* A token which translation has already been set?*/
|
/* A token which translation has already been set?*/
|
||||||
if (token_translations[this->content->user_token_number]
|
if (token_translations[this->content->user_token_number]
|
||||||
!= undeftoken->content->number)
|
!= undeftoken->content->number)
|
||||||
user_token_number_redeclaration
|
complain_user_token_number_redeclared
|
||||||
(this->content->user_token_number,
|
(this->content->user_token_number,
|
||||||
symbols[token_translations[this->content->user_token_number]], this);
|
symbols[token_translations[this->content->user_token_number]], this);
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user