diff --git a/common/json_command.h b/common/json_command.h index d090327ae..95ae8a192 100644 --- a/common/json_command.h +++ b/common/json_command.h @@ -15,7 +15,7 @@ struct command_result; /* Caller supplied this: param assumes it can call it. */ struct command_result *command_fail(struct command *cmd, errcode_t code, const char *fmt, ...) - PRINTF_FMT(3, 4) WARN_UNUSED_RESULT; + PRINTF_FMT(3, 4) WARN_UNUSED_RESULT RETURNS_NONNULL; /* Convenient wrapper for "paramname: msg: invalid token '.*%s'" */ static inline struct command_result * diff --git a/common/param.c b/common/param.c index 3babe665e..7d860225a 100644 --- a/common/param.c +++ b/common/param.c @@ -298,9 +298,10 @@ const char *param_subcommand(struct command *cmd, const char *buffer, return subcmd; /* We really do ignore this. */ - if (command_fail(cmd, JSONRPC2_INVALID_PARAMS, - "Unknown subcommand '%s'", subcmd)) - ; + struct command_result *ignore; + ignore = command_fail(cmd, JSONRPC2_INVALID_PARAMS, + "Unknown subcommand '%s'", subcmd); + assert(ignore); return NULL; } @@ -323,9 +324,10 @@ bool param(struct command *cmd, const char *buffer, } if (!param_add(¶ms, name, required, cbx, arg)) { /* We really do ignore this return! */ - if (command_fail(cmd, PARAM_DEV_ERROR, - "developer error: param_add %s", name)) - ; + struct command_result *ignore; + ignore = command_fail(cmd, PARAM_DEV_ERROR, + "developer error: param_add %s", name); + assert(ignore); va_end(ap); return false; }