ctf: Remove redundant declarations of lexer/parser functions
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 28 Oct 2019 02:12:41 +0000 (22:12 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 29 Oct 2019 15:38:19 +0000 (11:38 -0400)
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>
configure.ac
src/plugins/ctf/common/metadata/lexer.l
src/plugins/ctf/common/metadata/parser.y

index dbc6004ed18c5f86e9aee2bd3c1cca30ab774e40..8e0e649147e11c02969966a572873fa705053751 100644 (file)
@@ -674,7 +674,6 @@ AX_COMPILER_FLAGS(
                -Wno-undef dnl
                -Wno-missing-prototypes dnl
                -Wno-missing-declarations dnl
-               -Wno-redundant-decls dnl
                -Wno-double-promotion dnl
                -Wno-cast-align dnl
        ])
index 4f268dc69994a6dc2148cb4b91d13d0dd605863a..55a42d6191185d205307b072afd0e28979f2be41 100644 (file)
 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);
 
index 71f2d5fefc62eb453fa5d655ce7cb1424b096baa..54d28b6fef67b811f8a88d6a1da377782a0fd15e 100644 (file)
@@ -59,8 +59,6 @@ _bt_list_splice_tail (struct bt_list_head *add, struct bt_list_head *head)
        }
 }
 
-BT_HIDDEN
-int yyparse(struct ctf_scanner *scanner, yyscan_t yyscanner);
 BT_HIDDEN
 int yylex(union YYSTYPE *yyval, yyscan_t yyscanner);
 BT_HIDDEN
This page took 0.028422 seconds and 4 git commands to generate.