From: Antonio Borneo Date: Sun, 31 Mar 2019 15:55:43 +0000 (+0200) Subject: helper/command: add macro CMD X-Git-Tag: v0.11.0-rc1~716 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=84cfb727dfce2725d91af9f506bca49c8bb15de2 helper/command: add macro CMD Accessing the variable "cmd" in a COMMAND_HANDLER is confusing because the variable definition is not visible in the prototype, thus "cmd" can be identified by the reader as a global variable defined somewhere else. Add the new macro CMD to make more evident it is a part of the COMMAND_HANDLER. Change-Id: I8f63da593a931045cc404323f143b88c5c80ab5e Signed-off-by: Antonio Borneo Reviewed-on: http://openocd.zylin.com/5047 Tested-by: jenkins Reviewed-by: Tomas Vanek --- diff --git a/src/helper/command.h b/src/helper/command.h index f9c02e5738..9aed2827c3 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -121,6 +121,11 @@ struct command_invocation { */ #define COMMAND_HELPER(name, extra ...) __COMMAND_HANDLER(name, extra) +/** + * Use this macro to access the command being handled, + * rather than accessing the variable directly. It may be moved. + */ +#define CMD (cmd) /** * Use this macro to access the context of the command being handled, * rather than accessing the variable directly. It may be moved.