From 84cfb727dfce2725d91af9f506bca49c8bb15de2 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 31 Mar 2019 17:55:43 +0200 Subject: 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 --- src/helper/command.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/helper/command.h b/src/helper/command.h index f9c02e5..9aed282 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -122,6 +122,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. */ -- cgit v1.1