mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
style: syntax-check fixes
* data/yacc.c, src/Sbitset.c, src/Sbitset.h, src/muscle-tab.h, * src/output.c, src/parse-gram.y, src/reader.c, src/symtab.c, * src/uniqstr.c, src/uniqstr.h: Fix space before parens. * cfg.mk (_space_before_paren_exempt): Add needed exceptions.
This commit is contained in:
3
cfg.mk
3
cfg.mk
@@ -135,7 +135,7 @@ _sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
|
||||
|
||||
_space_before_paren_exempt =? \\n\\$$
|
||||
_space_before_paren_exempt = \
|
||||
(^ *\#|\\n\\$$|%s\(to %s|(date|group|character)\(s\))
|
||||
(^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init)|symbol)
|
||||
# Ensure that there is a space before each open parenthesis in C code.
|
||||
sc_space_before_open_paren:
|
||||
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
||||
@@ -175,5 +175,6 @@ $(call exclude, \
|
||||
prohibit_strcmp=^doc/bison\.texi|tests/local\.at$$ \
|
||||
prohibit_tab_based_indentation=\.(am|mk)$$|^djgpp/|^\.git \
|
||||
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
||||
space_before_open_paren=^(data/|djgpp/) \
|
||||
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
|
||||
)
|
||||
|
||||
@@ -199,7 +199,7 @@ static YYLTYPE yyloc_default][]b4_yyloc_default[;]])])[
|
||||
#endif
|
||||
|
||||
/* The semantic value of the lookahead symbol. */
|
||||
YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);]b4_locations_if([[
|
||||
YYSTYPE yylval YY_INITIAL_VALUE (yyval_default);]b4_locations_if([[
|
||||
|
||||
/* Location data for the lookahead symbol. */
|
||||
YYLTYPE yylloc]b4_pure_if([ = yyloc_default], [b4_yyloc_default])[;
|
||||
|
||||
@@ -60,7 +60,7 @@ Sbitset__isEmpty (Sbitset self, Sbitset__Index nbits)
|
||||
}
|
||||
|
||||
void
|
||||
Sbitset__fprint(Sbitset self, Sbitset__Index nbits, FILE *file)
|
||||
Sbitset__fprint (Sbitset self, Sbitset__Index nbits, FILE *file)
|
||||
{
|
||||
Sbitset__Index i;
|
||||
Sbitset itr;
|
||||
|
||||
@@ -44,31 +44,31 @@ void Sbitset__delete (Sbitset self);
|
||||
|
||||
bool Sbitset__isEmpty (Sbitset self, Sbitset__Index nbits);
|
||||
|
||||
void Sbitset__fprint(Sbitset self, Sbitset__Index nbits, FILE *file);
|
||||
void Sbitset__fprint (Sbitset self, Sbitset__Index nbits, FILE *file);
|
||||
|
||||
# define Sbitset__set(SELF, INDEX) \
|
||||
do { \
|
||||
*Sbitset__byteAddress ((SELF), (INDEX)) = \
|
||||
*Sbitset__byteAddress ((SELF), (INDEX)) | Sbitset__bit_mask (INDEX); \
|
||||
} while(0)
|
||||
} while (0)
|
||||
|
||||
# define Sbitset__reset(SELF, INDEX) \
|
||||
do { \
|
||||
*Sbitset__byteAddress ((SELF), (INDEX)) = \
|
||||
*Sbitset__byteAddress ((SELF), (INDEX)) & ~Sbitset__bit_mask (INDEX); \
|
||||
} while(0)
|
||||
} while (0)
|
||||
|
||||
/* NBITS is the size of the bitset. More than NBITS bits might be reset. */
|
||||
# define Sbitset__zero(SELF, NBITS) \
|
||||
do { \
|
||||
memset (SELF, 0, Sbitset__nbytes (NBITS)); \
|
||||
} while(0)
|
||||
} while (0)
|
||||
|
||||
/* NBITS is the size of the bitset. More than NBITS bits might be set. */
|
||||
# define Sbitset__ones(SELF, NBITS) \
|
||||
do { \
|
||||
memset (SELF, UCHAR_MAX, Sbitset__nbytes (NBITS)); \
|
||||
} while(0)
|
||||
} while (0)
|
||||
|
||||
/* NBITS is the size of every bitset. More than NBITS bits might be set. */
|
||||
# define Sbitset__or(SELF, OTHER1, OTHER2, NBITS) \
|
||||
@@ -79,7 +79,7 @@ void Sbitset__fprint(Sbitset self, Sbitset__Index nbits, FILE *file);
|
||||
Sbitset end_self = ptr_self + Sbitset__nbytes (NBITS); \
|
||||
for (; ptr_self < end_self; ++ptr_self, ++ptr_other1, ++ptr_other2) \
|
||||
*ptr_self = *ptr_other1 | *ptr_other2; \
|
||||
} while(0)
|
||||
} while (0)
|
||||
|
||||
# define SBITSET__FOR_EACH(SELF, NBITS, ITER, INDEX) \
|
||||
for ((ITER) = (SELF); (ITER) < (SELF) + Sbitset__nbytes (NBITS); ++(ITER)) \
|
||||
|
||||
@@ -78,14 +78,14 @@ extern struct obstack muscle_obstack;
|
||||
} while (0)
|
||||
|
||||
# define MUSCLE_INSERT_INT(Key, Value) \
|
||||
MUSCLE_INSERTF(Key, "%d", Value)
|
||||
MUSCLE_INSERTF (Key, "%d", Value)
|
||||
|
||||
# define MUSCLE_INSERT_LONG_INT(Key, Value) \
|
||||
MUSCLE_INSERTF(Key, "%ld", Value)
|
||||
MUSCLE_INSERTF (Key, "%ld", Value)
|
||||
|
||||
/* Key -> Value, but don't apply escaping to Value. */
|
||||
# define MUSCLE_INSERT_STRING_RAW(Key, Value) \
|
||||
MUSCLE_INSERTF(Key, "%s", Value)
|
||||
MUSCLE_INSERTF (Key, "%s", Value)
|
||||
|
||||
/* Key -> Value, applying M4 escaping to Value. */
|
||||
# define MUSCLE_INSERT_STRING(Key, Value) \
|
||||
@@ -96,7 +96,7 @@ extern struct obstack muscle_obstack;
|
||||
|
||||
/* Key -> Value, applying C escaping to Value (and then M4). */
|
||||
# define MUSCLE_INSERT_C_STRING(Key, Value) \
|
||||
MUSCLE_INSERT_STRING(Key, quotearg_style (c_quoting_style, Value))
|
||||
MUSCLE_INSERT_STRING (Key, quotearg_style (c_quoting_style, Value))
|
||||
|
||||
|
||||
/* Append VALUE to the current value of KEY, using muscle_grow. But
|
||||
|
||||
39
src/output.c
39
src/output.c
@@ -97,13 +97,12 @@ Name (char const *name, \
|
||||
MUSCLE_INSERT_LONG_INT (obstack_finish0 (&format_obstack), lmax); \
|
||||
}
|
||||
|
||||
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_unsigned_int_table, unsigned int)
|
||||
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_int_table, int)
|
||||
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_base_table, base_number)
|
||||
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_rule_number_table, rule_number)
|
||||
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_symbol_number_table, symbol_number)
|
||||
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_state_number_table, state_number)
|
||||
|
||||
GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_unsigned_int_table, unsigned int)
|
||||
GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_int_table, int)
|
||||
GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_base_table, base_number)
|
||||
GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_rule_number_table, rule_number)
|
||||
GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_symbol_number_table, symbol_number)
|
||||
GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_state_number_table, state_number)
|
||||
|
||||
/*----------------------------------------------------------------.
|
||||
| Print to OUT a representation of CP quoted and escaped for M4. |
|
||||
@@ -227,7 +226,7 @@ prepare_rules (void)
|
||||
/* LHS of the rule R. */
|
||||
r1[r] = rules[r].lhs->number;
|
||||
/* Length of rule R's RHS. */
|
||||
r2[r] = rule_rhs_length(&rules[r]);
|
||||
r2[r] = rule_rhs_length (&rules[r]);
|
||||
/* Line where rule was defined. */
|
||||
rline[r] = rules[r].location.start.line;
|
||||
/* Dynamic precedence (GLR). */
|
||||
@@ -417,31 +416,31 @@ prepare_symbol_definitions (void)
|
||||
|
||||
/* Whether the symbol has an identifier. */
|
||||
value = symbol_id_get (sym);
|
||||
SET_KEY("has_id");
|
||||
SET_KEY ("has_id");
|
||||
MUSCLE_INSERT_INT (key, !!value);
|
||||
|
||||
/* Its identifier. */
|
||||
SET_KEY("id");
|
||||
SET_KEY ("id");
|
||||
MUSCLE_INSERT_STRING (key, value ? value : "");
|
||||
|
||||
/* Its tag. Typically for documentation purpose. */
|
||||
SET_KEY("tag");
|
||||
SET_KEY ("tag");
|
||||
MUSCLE_INSERT_STRING (key, sym->tag);
|
||||
|
||||
SET_KEY("user_number");
|
||||
SET_KEY ("user_number");
|
||||
MUSCLE_INSERT_INT (key, sym->user_token_number);
|
||||
|
||||
SET_KEY("is_token");
|
||||
SET_KEY ("is_token");
|
||||
MUSCLE_INSERT_INT (key,
|
||||
i < ntokens && sym != errtoken && sym != undeftoken);
|
||||
|
||||
SET_KEY("number");
|
||||
SET_KEY ("number");
|
||||
MUSCLE_INSERT_INT (key, sym->number);
|
||||
|
||||
SET_KEY("has_type");
|
||||
SET_KEY ("has_type");
|
||||
MUSCLE_INSERT_INT (key, !!sym->type_name);
|
||||
|
||||
SET_KEY("type");
|
||||
SET_KEY ("type");
|
||||
MUSCLE_INSERT_STRING (key, sym->type_name ? sym->type_name : "");
|
||||
|
||||
{
|
||||
@@ -451,18 +450,18 @@ prepare_symbol_definitions (void)
|
||||
/* "printer", not "%printer". */
|
||||
char const *pname = code_props_type_string (j) + 1;
|
||||
code_props const *p = symbol_code_props_get (sym, j);
|
||||
SET_KEY2("has", pname);
|
||||
SET_KEY2 ("has", pname);
|
||||
MUSCLE_INSERT_INT (key, !!p->code);
|
||||
|
||||
if (p->code)
|
||||
{
|
||||
SET_KEY2(pname, "file");
|
||||
SET_KEY2 (pname, "file");
|
||||
MUSCLE_INSERT_STRING (key, p->location.start.file);
|
||||
|
||||
SET_KEY2(pname, "line");
|
||||
SET_KEY2 (pname, "line");
|
||||
MUSCLE_INSERT_INT (key, p->location.start.line);
|
||||
|
||||
SET_KEY(pname);
|
||||
SET_KEY (pname);
|
||||
MUSCLE_INSERT_STRING_RAW (key, p->code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* A Bison parser, made by GNU Bison 2.7.1.1188-e7178. */
|
||||
/* A Bison parser, made by GNU Bison 2.7.90. */
|
||||
|
||||
/* Bison implementation for Yacc-like parsers in C
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#define YYBISON 1
|
||||
|
||||
/* Bison version. */
|
||||
#define YYBISON_VERSION "2.7.1.1188-e7178"
|
||||
#define YYBISON_VERSION "2.7.90"
|
||||
|
||||
/* Skeleton name. */
|
||||
#define YYSKELETON_NAME "yacc.c"
|
||||
@@ -1734,7 +1734,7 @@ static YYLTYPE yyloc_default
|
||||
#endif
|
||||
|
||||
/* The semantic value of the lookahead symbol. */
|
||||
YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
|
||||
YYSTYPE yylval YY_INITIAL_VALUE (yyval_default);
|
||||
|
||||
/* Location data for the lookahead symbol. */
|
||||
YYLTYPE yylloc = yyloc_default;
|
||||
@@ -2624,7 +2624,7 @@ yyreduce:
|
||||
|
||||
case 96:
|
||||
#line 630 "src/parse-gram.y" /* yacc.c:1663 */
|
||||
{ (yyval.named_ref) = named_ref_new((yyvsp[0].uniqstr), (yylsp[0])); }
|
||||
{ (yyval.named_ref) = named_ref_new ((yyvsp[0].uniqstr), (yylsp[0])); }
|
||||
#line 2629 "src/parse-gram.c" /* yacc.c:1663 */
|
||||
break;
|
||||
|
||||
@@ -2981,7 +2981,7 @@ lloc_default (YYLTYPE const *rhs, int n)
|
||||
static
|
||||
char *strip_braces (char *code)
|
||||
{
|
||||
code[strlen(code) - 1] = 0;
|
||||
code[strlen (code) - 1] = 0;
|
||||
return code + 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* A Bison parser, made by GNU Bison 2.7.1.1188-e7178. */
|
||||
/* A Bison parser, made by GNU Bison 2.7.90. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
|
||||
@@ -627,7 +627,7 @@ rhs:
|
||||
|
||||
named_ref.opt:
|
||||
%empty { $$ = 0; }
|
||||
| BRACKETED_ID { $$ = named_ref_new($1, @1); }
|
||||
| BRACKETED_ID { $$ = named_ref_new ($1, @1); }
|
||||
;
|
||||
|
||||
/*---------------------.
|
||||
@@ -750,7 +750,7 @@ lloc_default (YYLTYPE const *rhs, int n)
|
||||
static
|
||||
char *strip_braces (char *code)
|
||||
{
|
||||
code[strlen(code) - 1] = 0;
|
||||
code[strlen (code) - 1] = 0;
|
||||
return code + 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ grammar_current_rule_symbol_append (symbol *sym, location loc,
|
||||
grammar_midrule_action ();
|
||||
p = grammar_symbol_append (sym, loc);
|
||||
if (name)
|
||||
assign_named_ref(p, name);
|
||||
assign_named_ref (p, name);
|
||||
if (sym->status == undeclared || sym->status == used)
|
||||
sym->status = needed;
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ semantic_type_check_defined (semantic_type *sem_type)
|
||||
/* <*> and <> do not have to be "declared". */
|
||||
if (sem_type->status == declared
|
||||
|| !*sem_type->tag
|
||||
|| STREQ(sem_type->tag, "*"))
|
||||
|| STREQ (sem_type->tag, "*"))
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 2; ++i)
|
||||
@@ -1110,7 +1110,7 @@ static void
|
||||
init_assoc (void)
|
||||
{
|
||||
graphid i;
|
||||
used_assoc = xcalloc(nsyms, sizeof(*used_assoc));
|
||||
used_assoc = xcalloc (nsyms, sizeof *used_assoc);
|
||||
for (i = 0; i < nsyms; ++i)
|
||||
used_assoc[i] = false;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ uniqstr_print_processor (void *ustr, void *null ATTRIBUTE_UNUSED)
|
||||
|
||||
|
||||
int
|
||||
uniqstr_cmp(uniqstr l, uniqstr r)
|
||||
uniqstr_cmp (uniqstr l, uniqstr r)
|
||||
{
|
||||
return (l == r ? 0
|
||||
: !l ? -1
|
||||
|
||||
@@ -40,7 +40,7 @@ uniqstr uniqstr_vsprintf (char const *format, ...)
|
||||
|
||||
/* Compare two uniqstr a la strcmp: negative for <, nul for =, and
|
||||
positive for >. Undefined order, relies on addresses. */
|
||||
int uniqstr_cmp(uniqstr u1, uniqstr u2);
|
||||
int uniqstr_cmp (uniqstr u1, uniqstr u2);
|
||||
|
||||
/* Die if STR is not a uniqstr. */
|
||||
void uniqstr_assert (char const *str);
|
||||
|
||||
Reference in New Issue
Block a user