[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. ae9556462a2989b8b97af
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: n0nb <n0...@us...> - 2025-06-07 12:32:26
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via ae9556462a2989b8b97af0d6e320558ffa0e1f3e (commit) from 355d237ffe974371091865fe73bd1bce42a4c085 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ae9556462a2989b8b97af0d6e320558ffa0e1f3e Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed May 7 22:27:07 2025 +0200 Fix debug messages shown even from disabled levels Messages from ENTERFUNC and RETURNFUNC where stored in an internal buffer even whe debug_level wasn't TRACE and were returned when calling rigerror(). diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 6656c5aeb..57c067b59 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -3770,11 +3770,10 @@ extern HAMLIB_EXPORT_VAR(char) debugmsgsave2[DEBUGMSGSAVE_SIZE]; // last-1 debu // debugmsgsave3 is deprecated extern HAMLIB_EXPORT_VAR(char) debugmsgsave3[DEBUGMSGSAVE_SIZE]; // last-2 debug msg #define rig_debug_clear() { debugmsgsave[0] = debugmsgsave2[0] = debugmsgsave3[0] = 0; }; -#ifndef __cplusplus -#ifdef __GNUC__ -// doing the debug macro with a dummy sprintf allows gcc to check the format string -#define rig_debug(debug_level,fmt,...) do { snprintf(debugmsgsave2,sizeof(debugmsgsave2),fmt,__VA_ARGS__);rig_debug(debug_level,fmt,##__VA_ARGS__); add2debugmsgsave(debugmsgsave2); } while(0) -#endif +#if !defined(__cplusplus) && defined(__GNUC__) +#define ATTRIBUTE_FORMAT_PRINTF __attribute__((__format__ (__printf__, 2, 3))) +#else +#define ATTRIBUTE_FORMAT_PRINTF #endif // Measuring elapsed time -- local variable inside function when macro is used @@ -3786,7 +3785,7 @@ extern HAMLIB_EXPORT_VAR(char) debugmsgsave3[DEBUGMSGSAVE_SIZE]; // last-2 debu extern HAMLIB_EXPORT(void) rig_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level, - const char *fmt, ...)); + const char *fmt, ...)) ATTRIBUTE_FORMAT_PRINTF; extern HAMLIB_EXPORT(vprintf_cb_t) rig_set_debug_callback HAMLIB_PARAMS((vprintf_cb_t cb, diff --git a/src/debug.c b/src/debug.c index de66c0879..a57685535 100644 --- a/src/debug.c +++ b/src/debug.c @@ -202,7 +202,6 @@ void HAMLIB_API rig_set_debug_time_stamp(int flag) * The formatted character string is passed to the `vfprintf`(3) C library * call and follows its format specification. */ -#undef rig_debug void HAMLIB_API rig_debug(enum rig_debug_level_e debug_level, const char *fmt, ...) { ----------------------------------------------------------------------- Summary of changes: include/hamlib/rig.h | 11 +++++------ src/debug.c | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |