From 43614711df496ca48e368e6e74c9d2abb264ce5d Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 28 Sep 2021 22:05:45 +0200 Subject: [PATCH] play: Avoid gcc warning when compiling without readline. 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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/play.c b/play.c index 7369c33f..ffdc8555 100644 --- 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; -- 2.39.2