diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2021-05-13 16:03:22 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-05-15 20:59:36 +0100 |
commit | bbbfddc3efd4a93b0c9489c2537efbaa117bcfb0 (patch) | |
tree | 2ac5fbb0ed73b2ede64e708a2a1e8040c0b5fb24 /src/helper/command.c | |
parent | b392ba466c98642f6e470dcbfdf0339c827fd06d (diff) | |
download | riscv-openocd-bbbfddc3efd4a93b0c9489c2537efbaa117bcfb0.zip riscv-openocd-bbbfddc3efd4a93b0c9489c2537efbaa117bcfb0.tar.gz riscv-openocd-bbbfddc3efd4a93b0c9489c2537efbaa117bcfb0.tar.bz2 |
jimtcl: restrict memory leak workaround on Linux only
The workaround for jimtcl 0.80 in commit 36ae487ed04b ("jimtcl:
add temporary workaround for memory leak in jimtcl 0.80") issues a
compile time error on macOS:
../src/helper/command.c:157:22: error: aliases are not
supported on darwin
__attribute__((weak, alias("workaround_createcommand")));
The OS is x86_64-apple-darwin19.6.0 and the compiler used is
x86_64-apple-darwin13.4.0-clang.
Restrict the workaround on Linux host only. The fix for 'expr'
syntax change is already merged and the workaround will be dropped
soon.
Change-Id: I925109a9c57c05f8c95b70bc7d6604eb1172cd79
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Adam JeliĆski <ajelinski@users.sourceforge.net>
Fixes: 36ae487ed04b ("jimtcl: add temporary workaround for memory leak in jimtcl 0.80")
Fixes: https://sourceforge.net/p/openocd/tickets/304/
Reviewed-on: http://openocd.zylin.com/6241
Tested-by: jenkins
Diffstat (limited to 'src/helper/command.c')
-rw-r--r-- | src/helper/command.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/helper/command.c b/src/helper/command.c index 0c6e785..3a931b5 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -144,12 +144,13 @@ static void command_log_capture_finish(struct log_capture_state *state) * Use the internal jimtcl API Jim_CreateCommandObj, not exported by jim.h, * and override the bugged API through preprocessor's macro. * This workaround works only when jimtcl is compiled as OpenOCD submodule. + * It's broken on macOS, so it's currently restricted on Linux only. * If jimtcl is linked-in from a precompiled library, either static or dynamic, * the symbol Jim_CreateCommandObj is not exported and the build will use the * bugged API. * To be removed when OpenOCD will switch to jimtcl 0.81 */ -#if JIM_VERSION == 80 +#if JIM_VERSION == 80 && defined __linux__ static int workaround_createcommand(Jim_Interp *interp, const char *cmdName, Jim_CmdProc *cmdProc, void *privData, Jim_DelCmdProc *delProc); int Jim_CreateCommandObj(Jim_Interp *interp, Jim_Obj *cmdNameObj, @@ -168,7 +169,7 @@ static int workaround_createcommand(Jim_Interp *interp, const char *cmdName, return retval; } #define Jim_CreateCommand workaround_createcommand -#endif /* JIM_VERSION == 80 */ +#endif /* JIM_VERSION == 80 && defined __linux__*/ /* FIXME: end of workaround for memory leak in jimtcl 0.80 */ static int command_retval_set(Jim_Interp *interp, int retval) |