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:
Akim Demaille
2013-05-30 14:08:41 +02:00
parent 971ef18e30
commit c0ef22ab0b
13 changed files with 46 additions and 46 deletions

3
cfg.mk
View File

@@ -135,7 +135,7 @@ _sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
_space_before_paren_exempt =? \\n\\$$ _space_before_paren_exempt =? \\n\\$$
_space_before_paren_exempt = \ _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. # Ensure that there is a space before each open parenthesis in C code.
sc_space_before_open_paren: sc_space_before_open_paren:
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \ @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_strcmp=^doc/bison\.texi|tests/local\.at$$ \
prohibit_tab_based_indentation=\.(am|mk)$$|^djgpp/|^\.git \ prohibit_tab_based_indentation=\.(am|mk)$$|^djgpp/|^\.git \
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \ 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$$) \ unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
) )

View File

@@ -199,7 +199,7 @@ static YYLTYPE yyloc_default][]b4_yyloc_default[;]])])[
#endif #endif
/* The semantic value of the lookahead symbol. */ /* 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. */ /* Location data for the lookahead symbol. */
YYLTYPE yylloc]b4_pure_if([ = yyloc_default], [b4_yyloc_default])[; YYLTYPE yylloc]b4_pure_if([ = yyloc_default], [b4_yyloc_default])[;

View File

@@ -60,7 +60,7 @@ Sbitset__isEmpty (Sbitset self, Sbitset__Index nbits)
} }
void void
Sbitset__fprint(Sbitset self, Sbitset__Index nbits, FILE *file) Sbitset__fprint (Sbitset self, Sbitset__Index nbits, FILE *file)
{ {
Sbitset__Index i; Sbitset__Index i;
Sbitset itr; Sbitset itr;

View File

@@ -44,31 +44,31 @@ void Sbitset__delete (Sbitset self);
bool Sbitset__isEmpty (Sbitset self, Sbitset__Index nbits); 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) \ # define Sbitset__set(SELF, INDEX) \
do { \ do { \
*Sbitset__byteAddress ((SELF), (INDEX)) = \ *Sbitset__byteAddress ((SELF), (INDEX)) = \
*Sbitset__byteAddress ((SELF), (INDEX)) | Sbitset__bit_mask (INDEX); \ *Sbitset__byteAddress ((SELF), (INDEX)) | Sbitset__bit_mask (INDEX); \
} while(0) } while (0)
# define Sbitset__reset(SELF, INDEX) \ # define Sbitset__reset(SELF, INDEX) \
do { \ do { \
*Sbitset__byteAddress ((SELF), (INDEX)) = \ *Sbitset__byteAddress ((SELF), (INDEX)) = \
*Sbitset__byteAddress ((SELF), (INDEX)) & ~Sbitset__bit_mask (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. */ /* NBITS is the size of the bitset. More than NBITS bits might be reset. */
# define Sbitset__zero(SELF, NBITS) \ # define Sbitset__zero(SELF, NBITS) \
do { \ do { \
memset (SELF, 0, Sbitset__nbytes (NBITS)); \ memset (SELF, 0, Sbitset__nbytes (NBITS)); \
} while(0) } while (0)
/* NBITS is the size of the bitset. More than NBITS bits might be set. */ /* NBITS is the size of the bitset. More than NBITS bits might be set. */
# define Sbitset__ones(SELF, NBITS) \ # define Sbitset__ones(SELF, NBITS) \
do { \ do { \
memset (SELF, UCHAR_MAX, Sbitset__nbytes (NBITS)); \ 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. */ /* NBITS is the size of every bitset. More than NBITS bits might be set. */
# define Sbitset__or(SELF, OTHER1, OTHER2, NBITS) \ # 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); \ Sbitset end_self = ptr_self + Sbitset__nbytes (NBITS); \
for (; ptr_self < end_self; ++ptr_self, ++ptr_other1, ++ptr_other2) \ for (; ptr_self < end_self; ++ptr_self, ++ptr_other1, ++ptr_other2) \
*ptr_self = *ptr_other1 | *ptr_other2; \ *ptr_self = *ptr_other1 | *ptr_other2; \
} while(0) } while (0)
# define SBITSET__FOR_EACH(SELF, NBITS, ITER, INDEX) \ # define SBITSET__FOR_EACH(SELF, NBITS, ITER, INDEX) \
for ((ITER) = (SELF); (ITER) < (SELF) + Sbitset__nbytes (NBITS); ++(ITER)) \ for ((ITER) = (SELF); (ITER) < (SELF) + Sbitset__nbytes (NBITS); ++(ITER)) \

View File

@@ -78,14 +78,14 @@ extern struct obstack muscle_obstack;
} while (0) } while (0)
# define MUSCLE_INSERT_INT(Key, Value) \ # define MUSCLE_INSERT_INT(Key, Value) \
MUSCLE_INSERTF(Key, "%d", Value) MUSCLE_INSERTF (Key, "%d", Value)
# define MUSCLE_INSERT_LONG_INT(Key, 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. */ /* Key -> Value, but don't apply escaping to Value. */
# define MUSCLE_INSERT_STRING_RAW(Key, 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. */ /* Key -> Value, applying M4 escaping to Value. */
# define MUSCLE_INSERT_STRING(Key, 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). */ /* Key -> Value, applying C escaping to Value (and then M4). */
# define MUSCLE_INSERT_C_STRING(Key, Value) \ # 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 /* Append VALUE to the current value of KEY, using muscle_grow. But

View File

@@ -97,13 +97,12 @@ Name (char const *name, \
MUSCLE_INSERT_LONG_INT (obstack_finish0 (&format_obstack), lmax); \ 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_unsigned_int_table, unsigned int)
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_int_table, 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_base_table, base_number)
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_rule_number_table, rule_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_symbol_number_table, symbol_number)
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_state_number_table, state_number) GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_state_number_table, state_number)
/*----------------------------------------------------------------. /*----------------------------------------------------------------.
| Print to OUT a representation of CP quoted and escaped for M4. | | Print to OUT a representation of CP quoted and escaped for M4. |
@@ -227,7 +226,7 @@ prepare_rules (void)
/* LHS of the rule R. */ /* LHS of the rule R. */
r1[r] = rules[r].lhs->number; r1[r] = rules[r].lhs->number;
/* Length of rule R's RHS. */ /* 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. */ /* Line where rule was defined. */
rline[r] = rules[r].location.start.line; rline[r] = rules[r].location.start.line;
/* Dynamic precedence (GLR). */ /* Dynamic precedence (GLR). */
@@ -417,31 +416,31 @@ prepare_symbol_definitions (void)
/* 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);
SET_KEY("user_number"); SET_KEY ("user_number");
MUSCLE_INSERT_INT (key, sym->user_token_number); MUSCLE_INSERT_INT (key, sym->user_token_number);
SET_KEY("is_token"); SET_KEY ("is_token");
MUSCLE_INSERT_INT (key, MUSCLE_INSERT_INT (key,
i < ntokens && sym != errtoken && sym != undeftoken); i < ntokens && sym != errtoken && sym != undeftoken);
SET_KEY("number"); SET_KEY ("number");
MUSCLE_INSERT_INT (key, sym->number); MUSCLE_INSERT_INT (key, sym->number);
SET_KEY("has_type"); SET_KEY ("has_type");
MUSCLE_INSERT_INT (key, !!sym->type_name); MUSCLE_INSERT_INT (key, !!sym->type_name);
SET_KEY("type"); SET_KEY ("type");
MUSCLE_INSERT_STRING (key, sym->type_name ? sym->type_name : ""); MUSCLE_INSERT_STRING (key, sym->type_name ? sym->type_name : "");
{ {
@@ -451,18 +450,18 @@ prepare_symbol_definitions (void)
/* "printer", not "%printer". */ /* "printer", not "%printer". */
char const *pname = code_props_type_string (j) + 1; char const *pname = code_props_type_string (j) + 1;
code_props const *p = symbol_code_props_get (sym, j); code_props const *p = symbol_code_props_get (sym, j);
SET_KEY2("has", pname); SET_KEY2 ("has", pname);
MUSCLE_INSERT_INT (key, !!p->code); MUSCLE_INSERT_INT (key, !!p->code);
if (p->code) if (p->code)
{ {
SET_KEY2(pname, "file"); SET_KEY2 (pname, "file");
MUSCLE_INSERT_STRING (key, p->location.start.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); MUSCLE_INSERT_INT (key, p->location.start.line);
SET_KEY(pname); SET_KEY (pname);
MUSCLE_INSERT_STRING_RAW (key, p->code); MUSCLE_INSERT_STRING_RAW (key, p->code);
} }
} }

View File

@@ -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 /* Bison implementation for Yacc-like parsers in C
@@ -44,7 +44,7 @@
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "2.7.1.1188-e7178" #define YYBISON_VERSION "2.7.90"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
@@ -1734,7 +1734,7 @@ static YYLTYPE yyloc_default
#endif #endif
/* The semantic value of the lookahead symbol. */ /* 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. */ /* Location data for the lookahead symbol. */
YYLTYPE yylloc = yyloc_default; YYLTYPE yylloc = yyloc_default;
@@ -2624,7 +2624,7 @@ yyreduce:
case 96: case 96:
#line 630 "src/parse-gram.y" /* yacc.c:1663 */ #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 */ #line 2629 "src/parse-gram.c" /* yacc.c:1663 */
break; break;
@@ -2981,7 +2981,7 @@ lloc_default (YYLTYPE const *rhs, int n)
static static
char *strip_braces (char *code) char *strip_braces (char *code)
{ {
code[strlen(code) - 1] = 0; code[strlen (code) - 1] = 0;
return code + 1; return code + 1;
} }

View File

@@ -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 /* Bison interface for Yacc-like parsers in C

View File

@@ -627,7 +627,7 @@ rhs:
named_ref.opt: named_ref.opt:
%empty { $$ = 0; } %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 static
char *strip_braces (char *code) char *strip_braces (char *code)
{ {
code[strlen(code) - 1] = 0; code[strlen (code) - 1] = 0;
return code + 1; return code + 1;
} }

View File

@@ -516,7 +516,7 @@ grammar_current_rule_symbol_append (symbol *sym, location loc,
grammar_midrule_action (); grammar_midrule_action ();
p = grammar_symbol_append (sym, loc); p = grammar_symbol_append (sym, loc);
if (name) if (name)
assign_named_ref(p, name); assign_named_ref (p, name);
if (sym->status == undeclared || sym->status == used) if (sym->status == undeclared || sym->status == used)
sym->status = needed; sym->status = needed;
} }

View File

@@ -450,7 +450,7 @@ 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, "*"))
{ {
int i; int i;
for (i = 0; i < 2; ++i) for (i = 0; i < 2; ++i)
@@ -1110,7 +1110,7 @@ static void
init_assoc (void) init_assoc (void)
{ {
graphid i; graphid i;
used_assoc = xcalloc(nsyms, sizeof(*used_assoc)); used_assoc = xcalloc (nsyms, sizeof *used_assoc);
for (i = 0; i < nsyms; ++i) for (i = 0; i < nsyms; ++i)
used_assoc[i] = false; used_assoc[i] = false;
} }

View File

@@ -105,7 +105,7 @@ uniqstr_print_processor (void *ustr, void *null ATTRIBUTE_UNUSED)
int int
uniqstr_cmp(uniqstr l, uniqstr r) uniqstr_cmp (uniqstr l, uniqstr r)
{ {
return (l == r ? 0 return (l == r ? 0
: !l ? -1 : !l ? -1

View File

@@ -40,7 +40,7 @@ uniqstr uniqstr_vsprintf (char const *format, ...)
/* Compare two uniqstr a la strcmp: negative for <, nul for =, and /* Compare two uniqstr a la strcmp: negative for <, nul for =, and
positive for >. Undefined order, relies on addresses. */ 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. */ /* Die if STR is not a uniqstr. */
void uniqstr_assert (char const *str); void uniqstr_assert (char const *str);