play: Avoid gcc warning when compiling without readline.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 28 Sep 2021 20:05:45 +0000 (22:05 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 29 Sep 2021 17:03:37 +0000 (19:03 +0200)
The EXPORT_PLAY_CMD_HANDLER() macro is only used when READLINE support
is enabled, which leads to

play.c:112: warning: macro "EXPORT_PLAY_CMD_HANDLER" is not used [-Wunused-macros]

Define the macro only when HAVE_READLINE is defined by moving down
the definition to the first user, com_quit().

play.c

diff --git a/play.c b/play.c
index 7369c33..ffdc855 100644 (file)
--- a/play.c
+++ b/play.c
@@ -109,10 +109,6 @@ typedef int (*play_cmd_handler_t)(struct lls_parse_result *lpr);
 struct play_command_info {
        play_cmd_handler_t handler;
 };
-#define EXPORT_PLAY_CMD_HANDLER(_cmd) \
-       const struct play_command_info lsg_play_cmd_com_ ## _cmd ## _user_data = { \
-               .handler = com_ ## _cmd \
-       };
 
 static int loglevel = LL_WARNING;
 
@@ -713,6 +709,11 @@ static void detach_stdout(void)
        btr_remove_node(&pt->btrn);
 }
 
+#define EXPORT_PLAY_CMD_HANDLER(_cmd) \
+       const struct play_command_info lsg_play_cmd_com_ ## _cmd ## _user_data = { \
+               .handler = com_ ## _cmd \
+       };
+
 static int com_quit(__a_unused struct lls_parse_result *lpr)
 {
        pt->rq = CRT_TERM_RQ;