mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 17:53:02 +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:
@@ -425,9 +425,9 @@ m4_define([b4_symbol_action],
|
|||||||
b4_symbol_if([$1], [has_type],
|
b4_symbol_if([$1], [has_type],
|
||||||
[m4_dquote(b4_symbol([$1], [type]))]),
|
[m4_dquote(b4_symbol([$1], [type]))]),
|
||||||
[(*yylocationp)])dnl
|
[(*yylocationp)])dnl
|
||||||
b4_symbol_case_([$1])[]dnl
|
b4_symbol_case_([$1])[]dnl
|
||||||
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
||||||
b4_symbol([$1], [$2])
|
b4_symbol([$1], [$2])
|
||||||
b4_syncline([@oline@], [@ofile@])
|
b4_syncline([@oline@], [@ofile@])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -446,7 +446,7 @@ m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])])
|
|||||||
# ---------------------------
|
# ---------------------------
|
||||||
# Issue a "case NUM" for SYMBOL-NUM.
|
# Issue a "case NUM" for SYMBOL-NUM.
|
||||||
m4_define([b4_symbol_case_],
|
m4_define([b4_symbol_case_],
|
||||||
[ case b4_symbol([$1], [number]): // b4_symbol([$1], [tag])
|
[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -569,7 +569,7 @@ conflicts_print (void)
|
|||||||
different strings to translate. */
|
different strings to translate. */
|
||||||
{
|
{
|
||||||
int total = count_sr_conflicts ();
|
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 =
|
int expected =
|
||||||
(expected_sr_conflicts == -1 && expected_rr_conflicts != -1)
|
(expected_sr_conflicts == -1 && expected_rr_conflicts != -1)
|
||||||
? 0
|
? 0
|
||||||
@@ -591,7 +591,7 @@ conflicts_print (void)
|
|||||||
|
|
||||||
{
|
{
|
||||||
int total = count_rr_conflicts (true);
|
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 =
|
int expected =
|
||||||
(expected_rr_conflicts == -1 && expected_sr_conflicts != -1)
|
(expected_rr_conflicts == -1 && expected_sr_conflicts != -1)
|
||||||
? 0
|
? 0
|
||||||
|
|||||||
@@ -140,8 +140,8 @@ xfdopen (int fd, char const *mode)
|
|||||||
FILE *res = fdopen (fd, mode);
|
FILE *res = fdopen (fd, mode);
|
||||||
if (! res)
|
if (! res)
|
||||||
error (EXIT_FAILURE, get_errno (),
|
error (EXIT_FAILURE, get_errno (),
|
||||||
// On a separate line to please the "unmarked_diagnostics"
|
/* On a separate line to please the "unmarked_diagnostics"
|
||||||
// syntax-check.
|
syntax-check. */
|
||||||
"fdopen");
|
"fdopen");
|
||||||
return res;
|
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);
|
fputs ("m4_define([b4_type_names],\n[", out);
|
||||||
for (i = 0; i < nsyms; /* nothing */)
|
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;
|
int i0 = i;
|
||||||
fputs (i ? ",\n[" : "[", out);
|
fputs (i ? ",\n[" : "[", out);
|
||||||
for (; i < nsyms && syms[i]->type_name == syms[i0]->type_name; ++i)
|
for (; i < nsyms && syms[i]->type_name == syms[i0]->type_name; ++i)
|
||||||
@@ -415,16 +415,16 @@ prepare_symbol_definitions (void)
|
|||||||
i, Entry, Suffix); \
|
i, Entry, Suffix); \
|
||||||
key = obstack_finish0 (&format_obstack);
|
key = obstack_finish0 (&format_obstack);
|
||||||
|
|
||||||
// Whether the symbol has an identifier.
|
/* Whether the symbol has an identifier. */
|
||||||
value = symbol_id_get (sym);
|
value = symbol_id_get (sym);
|
||||||
SET_KEY("has_id");
|
SET_KEY("has_id");
|
||||||
MUSCLE_INSERT_INT (key, !!value);
|
MUSCLE_INSERT_INT (key, !!value);
|
||||||
|
|
||||||
// Its identifier.
|
/* Its identifier. */
|
||||||
SET_KEY("id");
|
SET_KEY("id");
|
||||||
MUSCLE_INSERT_STRING (key, value ? value : "");
|
MUSCLE_INSERT_STRING (key, value ? value : "");
|
||||||
|
|
||||||
// Its tag. Typically for documentation purpose.
|
/* Its tag. Typically for documentation purpose. */
|
||||||
SET_KEY("tag");
|
SET_KEY("tag");
|
||||||
MUSCLE_INSERT_STRING (key, sym->tag);
|
MUSCLE_INSERT_STRING (key, sym->tag);
|
||||||
|
|
||||||
@@ -533,7 +533,7 @@ muscles_output (FILE *out)
|
|||||||
symbol_numbers_output (out);
|
symbol_numbers_output (out);
|
||||||
type_names_output (out);
|
type_names_output (out);
|
||||||
user_actions_output (out);
|
user_actions_output (out);
|
||||||
// Must be last.
|
/* Must be last. */
|
||||||
muscles_m4_output (out);
|
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_new (uniqstr tag, location loc)
|
||||||
{
|
{
|
||||||
symbol *res = xmalloc (sizeof *res);
|
symbol *res = xmalloc (sizeof *res);
|
||||||
|
|
||||||
uniqstr_assert (tag);
|
uniqstr_assert (tag);
|
||||||
|
|
||||||
/* If the tag is not a string (starts with a double quote), check
|
/* 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->location = loc;
|
||||||
|
|
||||||
res->type_name = NULL;
|
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->number = NUMBER_UNDEFINED;
|
||||||
res->prec = 0;
|
res->prec = 0;
|
||||||
@@ -113,8 +115,11 @@ semantic_type_new (uniqstr tag, const location *loc)
|
|||||||
res->tag = tag;
|
res->tag = tag;
|
||||||
res->location = loc ? *loc : empty_location;
|
res->location = loc ? *loc : empty_location;
|
||||||
res->status = undeclared;
|
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;
|
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)
|
if (sym->class != unknown_sym && sym->class != class)
|
||||||
{
|
{
|
||||||
complain (&loc, complaint, _("symbol %s redefined"), sym->tag);
|
complain (&loc, complaint, _("symbol %s redefined"), sym->tag);
|
||||||
// Don't report both "redefined" and "redeclared".
|
/* Don't report both "redefined" and "redeclared". */
|
||||||
warned = true;
|
warned = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,8 +406,11 @@ symbol_check_defined (symbol *sym)
|
|||||||
sym->number = nvars++;
|
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
|
/* Set the semantic type status associated to the current symbol to
|
||||||
'declared' so that we could check semantic types unnecessary uses. */
|
'declared' so that we could check semantic types unnecessary uses. */
|
||||||
@@ -419,12 +427,13 @@ symbol_check_defined (symbol *sym)
|
|||||||
static inline bool
|
static inline bool
|
||||||
semantic_type_check_defined (semantic_type *sem_type)
|
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
|
if (sem_type->status == declared
|
||||||
|| !*sem_type->tag
|
|| !*sem_type->tag
|
||||||
|| STREQ(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
|
if (sem_type->props[i].kind != CODE_PROPS_NONE
|
||||||
&& ! sem_type->props[i].is_used)
|
&& ! sem_type->props[i].is_used)
|
||||||
complain (&sem_type->location, Wother,
|
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)
|
int i;
|
||||||
symbol_code_props_set (sym, i, &str->props[i]);
|
for (i = 0; i < CODE_PROPS_SIZE; ++i)
|
||||||
else if (sym->props[i].code)
|
if (str->props[i].code)
|
||||||
symbol_code_props_set (str, i, &sym->props[i]);
|
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)
|
if (sym->prec || str->prec)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user