mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
maint: restore ANSI 89 compliance
* data/bison.m4, src/conflicts.c, src/files.c, src/output.c, * src/symtab.c: Use /* ... */ comments only. Declare variables before statements.
This commit is contained in:
@@ -569,7 +569,7 @@ conflicts_print (void)
|
||||
different strings to translate. */
|
||||
{
|
||||
int total = count_sr_conflicts ();
|
||||
// If %expect is not used, but %expect-rr is, then expect 0 sr.
|
||||
/* If %expect is not used, but %expect-rr is, then expect 0 sr. */
|
||||
int expected =
|
||||
(expected_sr_conflicts == -1 && expected_rr_conflicts != -1)
|
||||
? 0
|
||||
@@ -591,7 +591,7 @@ conflicts_print (void)
|
||||
|
||||
{
|
||||
int total = count_rr_conflicts (true);
|
||||
// If %expect-rr is not used, but %expect is, then expect 0 rr.
|
||||
/* If %expect-rr is not used, but %expect is, then expect 0 rr. */
|
||||
int expected =
|
||||
(expected_rr_conflicts == -1 && expected_sr_conflicts != -1)
|
||||
? 0
|
||||
|
||||
@@ -140,8 +140,8 @@ xfdopen (int fd, char const *mode)
|
||||
FILE *res = fdopen (fd, mode);
|
||||
if (! res)
|
||||
error (EXIT_FAILURE, get_errno (),
|
||||
// On a separate line to please the "unmarked_diagnostics"
|
||||
// syntax-check.
|
||||
/* On a separate line to please the "unmarked_diagnostics"
|
||||
syntax-check. */
|
||||
"fdopen");
|
||||
return res;
|
||||
}
|
||||
|
||||
10
src/output.c
10
src/output.c
@@ -318,7 +318,7 @@ type_names_output (FILE *out)
|
||||
fputs ("m4_define([b4_type_names],\n[", out);
|
||||
for (i = 0; i < nsyms; /* nothing */)
|
||||
{
|
||||
// The index of the first symbol of the current type-name.
|
||||
/* The index of the first symbol of the current type-name. */
|
||||
int i0 = i;
|
||||
fputs (i ? ",\n[" : "[", out);
|
||||
for (; i < nsyms && syms[i]->type_name == syms[i0]->type_name; ++i)
|
||||
@@ -415,16 +415,16 @@ prepare_symbol_definitions (void)
|
||||
i, Entry, Suffix); \
|
||||
key = obstack_finish0 (&format_obstack);
|
||||
|
||||
// Whether the symbol has an identifier.
|
||||
/* Whether the symbol has an identifier. */
|
||||
value = symbol_id_get (sym);
|
||||
SET_KEY("has_id");
|
||||
MUSCLE_INSERT_INT (key, !!value);
|
||||
|
||||
// Its identifier.
|
||||
/* Its identifier. */
|
||||
SET_KEY("id");
|
||||
MUSCLE_INSERT_STRING (key, value ? value : "");
|
||||
|
||||
// Its tag. Typically for documentation purpose.
|
||||
/* Its tag. Typically for documentation purpose. */
|
||||
SET_KEY("tag");
|
||||
MUSCLE_INSERT_STRING (key, sym->tag);
|
||||
|
||||
@@ -533,7 +533,7 @@ muscles_output (FILE *out)
|
||||
symbol_numbers_output (out);
|
||||
type_names_output (out);
|
||||
user_actions_output (out);
|
||||
// Must be last.
|
||||
/* Must be last. */
|
||||
muscles_m4_output (out);
|
||||
}
|
||||
|
||||
|
||||
42
src/symtab.c
42
src/symtab.c
@@ -55,7 +55,6 @@ static symbol *
|
||||
symbol_new (uniqstr tag, location loc)
|
||||
{
|
||||
symbol *res = xmalloc (sizeof *res);
|
||||
|
||||
uniqstr_assert (tag);
|
||||
|
||||
/* If the tag is not a string (starts with a double quote), check
|
||||
@@ -68,8 +67,11 @@ symbol_new (uniqstr tag, location loc)
|
||||
res->location = loc;
|
||||
|
||||
res->type_name = NULL;
|
||||
for (int i = 0; i < CODE_PROPS_SIZE; ++i)
|
||||
code_props_none_init (&res->props[i]);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < CODE_PROPS_SIZE; ++i)
|
||||
code_props_none_init (&res->props[i]);
|
||||
}
|
||||
|
||||
res->number = NUMBER_UNDEFINED;
|
||||
res->prec = 0;
|
||||
@@ -113,8 +115,11 @@ semantic_type_new (uniqstr tag, const location *loc)
|
||||
res->tag = tag;
|
||||
res->location = loc ? *loc : empty_location;
|
||||
res->status = undeclared;
|
||||
for (int i = 0; i < CODE_PROPS_SIZE; ++i)
|
||||
code_props_none_init (&res->props[i]);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < CODE_PROPS_SIZE; ++i)
|
||||
code_props_none_init (&res->props[i]);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -329,7 +334,7 @@ symbol_class_set (symbol *sym, symbol_class class, location loc, bool declaring)
|
||||
if (sym->class != unknown_sym && sym->class != class)
|
||||
{
|
||||
complain (&loc, complaint, _("symbol %s redefined"), sym->tag);
|
||||
// Don't report both "redefined" and "redeclared".
|
||||
/* Don't report both "redefined" and "redeclared". */
|
||||
warned = true;
|
||||
}
|
||||
|
||||
@@ -401,8 +406,11 @@ symbol_check_defined (symbol *sym)
|
||||
sym->number = nvars++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
symbol_code_props_get (sym, i)->is_used = true;
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 2; ++i)
|
||||
symbol_code_props_get (sym, i)->is_used = true;
|
||||
}
|
||||
|
||||
/* Set the semantic type status associated to the current symbol to
|
||||
'declared' so that we could check semantic types unnecessary uses. */
|
||||
@@ -419,12 +427,13 @@ symbol_check_defined (symbol *sym)
|
||||
static inline bool
|
||||
semantic_type_check_defined (semantic_type *sem_type)
|
||||
{
|
||||
// <*> and <> do not have to be "declared".
|
||||
/* <*> and <> do not have to be "declared". */
|
||||
if (sem_type->status == declared
|
||||
|| !*sem_type->tag
|
||||
|| STREQ(sem_type->tag, "*"))
|
||||
{
|
||||
for (int i = 0; i < 2; ++i)
|
||||
int i;
|
||||
for (i = 0; i < 2; ++i)
|
||||
if (sem_type->props[i].kind != CODE_PROPS_NONE
|
||||
&& ! sem_type->props[i].is_used)
|
||||
complain (&sem_type->location, Wother,
|
||||
@@ -500,11 +509,14 @@ symbol_check_alias_consistency (symbol *this)
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < CODE_PROPS_SIZE; ++i)
|
||||
if (str->props[i].code)
|
||||
symbol_code_props_set (sym, i, &str->props[i]);
|
||||
else if (sym->props[i].code)
|
||||
symbol_code_props_set (str, i, &sym->props[i]);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < CODE_PROPS_SIZE; ++i)
|
||||
if (str->props[i].code)
|
||||
symbol_code_props_set (sym, i, &str->props[i]);
|
||||
else if (sym->props[i].code)
|
||||
symbol_code_props_set (str, i, &sym->props[i]);
|
||||
}
|
||||
|
||||
if (sym->prec || str->prec)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user