Add gcc format attributes for yyerror(); fix a few yyerror() calls.

Adapted from src parse.y changes by doug@. OK doug@
This commit is contained in:
okan 2015-01-16 18:28:08 +00:00
parent 9cada703b9
commit 8d1eb202bf

14
parse.y
View File

@ -47,7 +47,9 @@ struct file *pushfile(const char *);
int popfile(void); int popfile(void);
int yyparse(void); int yyparse(void);
int yylex(void); int yylex(void);
int yyerror(const char *, ...); int yyerror(const char *, ...)
__attribute__((__format__ (printf, 1, 2)))
__attribute__((__nonnull__ (1)));
int kw_cmp(const void *, const void *); int kw_cmp(const void *, const void *);
int lookup(char *); int lookup(char *);
int lgetc(int); int lgetc(int);
@ -117,21 +119,21 @@ main : FONTNAME STRING {
} }
| BORDERWIDTH NUMBER { | BORDERWIDTH NUMBER {
if ($2 < 0 || $2 > UINT_MAX) { if ($2 < 0 || $2 > UINT_MAX) {
yyerror("invalid borderwidth: %d", $2); yyerror("invalid borderwidth: %lld", $2);
YYERROR; YYERROR;
} }
conf->bwidth = $2; conf->bwidth = $2;
} }
| MOVEAMOUNT NUMBER { | MOVEAMOUNT NUMBER {
if ($2 < 0 || $2 > INT_MAX) { if ($2 < 0 || $2 > INT_MAX) {
yyerror("invalid movemount: %d", $2); yyerror("invalid movemount: %lld", $2);
YYERROR; YYERROR;
} }
conf->mamount = $2; conf->mamount = $2;
} }
| SNAPDIST NUMBER { | SNAPDIST NUMBER {
if ($2 < 0 || $2 > INT_MAX) { if ($2 < 0 || $2 > INT_MAX) {
yyerror("invalid snapdist: %d", $2); yyerror("invalid snapdist: %lld", $2);
YYERROR; YYERROR;
} }
conf->snapdist = $2; conf->snapdist = $2;
@ -149,7 +151,7 @@ main : FONTNAME STRING {
| AUTOGROUP NUMBER STRING { | AUTOGROUP NUMBER STRING {
if ($2 < 0 || $2 > 9) { if ($2 < 0 || $2 > 9) {
free($3); free($3);
yyerror("invalid autogroup: %d", $2); yyerror("invalid autogroup: %lld", $2);
YYERROR; YYERROR;
} }
conf_autogroup(conf, $2, $3); conf_autogroup(conf, $2, $3);
@ -174,7 +176,7 @@ main : FONTNAME STRING {
$3 < 0 || $3 > INT_MAX || $3 < 0 || $3 > INT_MAX ||
$4 < 0 || $4 > INT_MAX || $4 < 0 || $4 > INT_MAX ||
$5 < 0 || $5 > INT_MAX) { $5 < 0 || $5 > INT_MAX) {
yyerror("invalid gap: %d %d %d %d", yyerror("invalid gap: %lld %lld %lld %lld",
$2, $3, $4, $5); $2, $3, $4, $5);
YYERROR; YYERROR;
} }