Package: openocd
Version: 0.12.0-3
Severity: important
Tags: ftbfs, patch
Affects: jimtcl

Dear Maintainer,

I am planing to upload jimtcl 0.84-2 to unstable soon and request one
transition from 0.83 to 0.84. Rebuild openocd with the jimtcl 0.84-1 but
will get:

```
src/helper/log.c: In function 'log_puts':
src/helper/log.c:99:11: warning: assignment discards 'const' qualifier from 
pointer target type [-Wdiscarded-qualifiers]
   99 |         f = strrchr(file, '/');
      |           ^
src/helper/command.c: In function 'jimcmd_is_proc':
src/helper/command.c:51:19: error: 'Jim_Cmd' has no member named 'isproc'
   51 |         return cmd->isproc;
      |                   ^~
src/helper/command.c: In function 'jimcmd_is_oocd_command':
src/helper/command.c:56:20: error: 'Jim_Cmd' has no member named 'isproc'
   56 |         return !cmd->isproc && cmd->u.native.cmdProc == 
jim_command_dispatch;
      |                    ^~
src/helper/command.c: In function 'jimcmd_privdata':
src/helper/command.c:61:19: error: 'Jim_Cmd' has no member named 'isproc'
   61 |         return cmd->isproc ? NULL : cmd->u.native.privData;
      |                   ^~
libtool: link: ar cr src/xsvf/.libs/libxsvf.a src/xsvf/xsvf.o
libtool: link: ranlib src/xsvf/.libs/libxsvf.a
```

Upstream has one commit[0] to fix the build issue and I can confirm that
it works on Debian here also.

So once I upload jimtcl 0.84-2 to unstable, could you have a look at
this?

[0]: https://review.openocd.org/c/openocd/+/8956


-- 
Regards,
--
  Bo YU

From fe0080478b9e76a4b6b64186b7b705726ac55848 Mon Sep 17 00:00:00 2001
From: Antonio Borneo <[email protected]>
Date: Sat, 28 Sep 2024 17:58:51 +0200
Subject: [PATCH] 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 <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8956
Tested-by: jenkins
Reviewed-by: Andrzej Sierżęga <[email protected]>
---

--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -48,17 +48,22 @@
 /* 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 void tcl_output(void *privData, const char *file, unsigned line,

Attachment: signature.asc
Description: PGP signature

Reply via email to