jimtcl: fix build with jimtcl master branch

Current jimtcl release 0.83 has been tagged on 2024-08-28 and the
new 0.84 is on the way.

The change [1] merged in jimtcl branch 'master' for 0.84 breaks
the build of OpenOCD.
OpenOCD releases are not frequent and jimtcl is now by default an
external build dependency. The release of jimtcl 0.84 could force
OpenOCD to deliver a fix release to support it.

Anticipate the change [1] by detecting it at compile time, without
relying on jimtcl version, and providing an alternative code.

Link: https://github.com/msteveb/jimtcl/commit/5669e84aad22 [1]
Change-Id: I61bf100d447083258aea222aaf15608b7cbe2e57
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8956
Tested-by: jenkins
Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>
This commit is contained in:
Antonio Borneo
2024-09-28 17:58:51 +02:00
parent 443139db00
commit fe0080478b

View File

@@ -45,17 +45,22 @@ static enum command_mode get_command_mode(Jim_Interp *interp, const char *cmd_na
/* set of functions to wrap jimtcl internal data */
static inline bool jimcmd_is_proc(Jim_Cmd *cmd)
{
#if defined(JIM_CMD_ISPROC)
// JIM_VERSION >= 84
return cmd->flags & JIM_CMD_ISPROC;
#else
return cmd->isproc;
#endif
}
bool jimcmd_is_oocd_command(Jim_Cmd *cmd)
{
return !cmd->isproc && cmd->u.native.cmdProc == jim_command_dispatch;
return !jimcmd_is_proc(cmd) && cmd->u.native.cmdProc == jim_command_dispatch;
}
void *jimcmd_privdata(Jim_Cmd *cmd)
{
return cmd->isproc ? NULL : cmd->u.native.privData;
return jimcmd_is_proc(cmd) ? NULL : cmd->u.native.privData;
}
static int command_retval_set(Jim_Interp *interp, int retval)