I get these warnings:
CC libctf_parser_la-lexer.lo
lexer.c:857:17: error: redundant redeclaration of ‘yyunput’ [-Werror=redundant-decls]
857 |
| ^
/home/simark/src/babeltrace/src/plugins/ctf/common/metadata/lexer.l:55:13: note: previous declaration of ‘yyunput’ was here
55 | static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
| ^~~~~~~
CC libctf_parser_la-lexer.lo
lexer.c:871:12: error: redundant redeclaration of ‘input’ [-Werror=redundant-decls]
871 | #else
| ^
/home/simark/src/babeltrace/src/plugins/ctf/common/metadata/lexer.l:55:12: note: previous declaration of ‘input’ was here
55 | static int input (yyscan_t yyscanner) __attribute__((unused));
| ^~~~~
CC libctf_parser_la-parser.lo
/home/simark/src/babeltrace/src/plugins/ctf/common/metadata/parser.y:63:5: error: redundant redeclaration of ‘yyparse’ [-Werror=redundant-decls]
63 | int yyparse(struct ctf_scanner *scanner, yyscan_t yyscanner);
| ^~~~~~~
In file included from /home/simark/src/babeltrace/src/plugins/ctf/common/metadata/parser-wrap.h:41,
from /home/simark/src/babeltrace/src/plugins/ctf/common/metadata/parser.y:47:
parser.h:192:5: note: previous declaration of ‘yyparse’ was here
192 | int yyparse (struct ctf_scanner *scanner, yyscan_t yyscanner);
| ^~~~~~~
Because of the __attribute__((unused)), when removing the declarations
of yyunput and input from lexer.l, I expected to get a
"-Wunused-function" warning. But that doesn't seem to be the case (even
when manually enabling -Wunused-function), so I'm giving a shot at
removing those declarations, since they may not be essential.
The yyparse declaration is not essential, since there's one already in
the generated parser.h.
There is a slight possibility that older bison versions (I'm using
3.4.2) produce different results, but I can't easily test right now.
Change-Id: I73ff02896db1f40d476757b3207629a3ff20ac39
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2274
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
-Wno-undef dnl
-Wno-missing-prototypes dnl
-Wno-missing-declarations dnl
- -Wno-redundant-decls dnl
-Wno-double-promotion dnl
-Wno-cast-align dnl
])
BT_HIDDEN
void setstring(struct ctf_scanner *scanner, YYSTYPE *lvalp, const char *src);
-static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
- __attribute__((unused));
-static int input (yyscan_t yyscanner) __attribute__((unused));
-
BT_HIDDEN
int import_string(struct ctf_scanner *scanner, YYSTYPE *lvalp, const char *src, char delim);
}
}
-BT_HIDDEN
-int yyparse(struct ctf_scanner *scanner, yyscan_t yyscanner);
BT_HIDDEN
int yylex(union YYSTYPE *yyval, yyscan_t yyscanner);
BT_HIDDEN