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:
Akim Demaille
2012-12-28 11:04:37 +01:00
parent fd7f0289bc
commit c5ae8e85aa
5 changed files with 39 additions and 27 deletions

View File

@@ -425,9 +425,9 @@ m4_define([b4_symbol_action],
b4_symbol_if([$1], [has_type],
[m4_dquote(b4_symbol([$1], [type]))]),
[(*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_symbol([$1], [$2])
b4_symbol([$1], [$2])
b4_syncline([@oline@], [@ofile@])
break;
@@ -446,7 +446,7 @@ m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])])
# ---------------------------
# Issue a "case NUM" for SYMBOL-NUM.
m4_define([b4_symbol_case_],
[ case b4_symbol([$1], [number]): // b4_symbol([$1], [tag])
[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
])

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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)
{