[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/6] maint: restore ANSI 89 compliance
From: |
Akim Demaille |
Subject: |
[PATCH 3/6] maint: restore ANSI 89 compliance |
Date: |
Fri, 28 Dec 2012 11:41:05 +0100 |
* data/bison.m4, src/conflicts.c, src/files.c, src/output.c,
* src/symtab.c: Use /* ... */ comments only.
Declare variables before statements.
---
data/bison.m4 | 6 +++---
src/conflicts.c | 4 ++--
src/files.c | 4 ++--
src/output.c | 10 +++++-----
src/symtab.c | 42 +++++++++++++++++++++++++++---------------
5 files changed, 39 insertions(+), 27 deletions(-)
diff --git a/data/bison.m4 b/data/bison.m4
index 23273ce..5189a8b 100644
--- a/data/bison.m4
+++ b/data/bison.m4
@@ -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(address@hidden@], address@hidden@])
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])])
])
diff --git a/src/conflicts.c b/src/conflicts.c
index f8ed177..2ea6de1 100644
--- a/src/conflicts.c
+++ b/src/conflicts.c
@@ -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
diff --git a/src/files.c b/src/files.c
index 7fea306..b623b44 100644
--- a/src/files.c
+++ b/src/files.c
@@ -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;
}
diff --git a/src/output.c b/src/output.c
index 7e552dc..12b5d97 100644
--- a/src/output.c
+++ b/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);
}
diff --git a/src/symtab.c b/src/symtab.c
index c8490ac..cc81c5f 100644
--- a/src/symtab.c
+++ b/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)
{
--
1.8.0.2
- [PATCH 0/6] {master} restore C90 compliance, Akim Demaille, 2012/12/28
- [PATCH 2/6] graph: minor simplification, Akim Demaille, 2012/12/28
- [PATCH 3/6] maint: restore ANSI 89 compliance,
Akim Demaille <=
- [PATCH 1/6] closure, gram: add missing const, Akim Demaille, 2012/12/28
- [PATCH 4/6] regen, Akim Demaille, 2012/12/28
- [PATCH 5/6] syncline: one line is enough, Akim Demaille, 2012/12/28
- [PATCH 6/6] regen, Akim Demaille, 2012/12/28