[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 66acf19efedb17ad22a67
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: n0nb <n0...@us...> - 2025-07-27 23:42:57
|
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 66acf19efedb17ad22a6734dbbed5b6b4466ba85 (commit) via 20eeb96787a1e2dd67e158b52337f64ab47517e7 (commit) via 6c372f981f08dd571f5fc47197fcce9fd076f007 (commit) via a7c8c3fa9ebf0aa1c2b6ef4b6c4b20ba2ded4014 (commit) from 53b7cef53797338f26e72e6646fdbf4ce170c2f6 (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 66acf19efedb17ad22a6734dbbed5b6b4466ba85 Merge: 53b7cef53 20eeb9678 Author: Nate Bargmann <n0...@n0...> Date: Sun Jul 27 18:01:00 2025 -0500 Merge GitHub PR #1818 commit 20eeb96787a1e2dd67e158b52337f64ab47517e7 Author: George Baltz N3GB <Geo...@gm...> Date: Sun Jul 27 11:31:18 2025 -0400 Deprecate rig_get_conf() Define macro to set attribute, if compiler is capable Add macro to rig_get_conf(), Rig::getConf() declarations Fix internal uses of rig_get_conf() diff --git a/c++/rigclass.cc b/c++/rigclass.cc index 218058ea0..db473e2f1 100644 --- a/c++/rigclass.cc +++ b/c++/rigclass.cc @@ -87,11 +87,19 @@ void Rig::setConf(const char *name, const char *val) void Rig::getConf(hamlib_token_t token, char *val) { - CHECK_RIG( rig_get_conf(theRig, token, val) ); + CHECK_RIG( rig_get_conf2(theRig, token, val, 128) ); } void Rig::getConf(const char *name, char *val) { - CHECK_RIG( rig_get_conf(theRig, tokenLookup(name), val) ); + CHECK_RIG( rig_get_conf2(theRig, tokenLookup(name), val, 128) ); +} +void Rig::getConf2(hamlib_token_t token, char *val, int val_len) +{ + CHECK_RIG( rig_get_conf2(theRig, token, val, val_len) ); +} +void Rig::getConf2(const char *name, char *val, int val_len) +{ + CHECK_RIG( rig_get_conf2(theRig, tokenLookup(name), val, val_len) ); } hamlib_token_t Rig::tokenLookup(const char *name) diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 3441a162b..7c79443a7 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -86,10 +86,18 @@ #if __has_c_attribute(fallthrough) #define HL_FALLTHROUGH [[fallthrough]]; #else -/* Fall back */ +/* Fall back to nothing */ #define HL_FALLTHROUGH #endif +// Macro to mark function or variable as deprecated/obsolete +#if __has_c_attribute(deprecated) +#define HL_DEPRECATED [[deprecated]] +#else +// Make it vanish +#define HL_DEPRECATED +#endif + /** * \addtogroup rig * @{ @@ -2959,7 +2967,7 @@ rig_set_conf HAMLIB_PARAMS((RIG *rig, hamlib_token_t token, const char *val)); // deprecating rig_get_conf -extern HAMLIB_EXPORT(int) +HL_DEPRECATED extern HAMLIB_EXPORT(int) rig_get_conf HAMLIB_PARAMS((RIG *rig, hamlib_token_t token, char *val)); diff --git a/include/hamlib/rigclass.h b/include/hamlib/rigclass.h index 23b4738fd..6a0e428ff 100644 --- a/include/hamlib/rigclass.h +++ b/include/hamlib/rigclass.h @@ -56,8 +56,10 @@ public: void setConf(hamlib_token_t token, const char *val); void setConf(const char *name, const char *val); - void getConf(hamlib_token_t token, char *val); - void getConf(const char *name, char *val); + HL_DEPRECATED void getConf(hamlib_token_t token, char *val); + HL_DEPRECATED void getConf(const char *name, char *val); + void getConf2(hamlib_token_t token, char *val, int val_len); + void getConf2(const char *name, char *val, int val_len); hamlib_token_t tokenLookup(const char *name); void setFreq(freq_t freq, vfo_t vfo = RIG_VFO_CURR); diff --git a/rigs/flexradio/dttsp.c b/rigs/flexradio/dttsp.c index 2a24b70f1..24ca388fb 100644 --- a/rigs/flexradio/dttsp.c +++ b/rigs/flexradio/dttsp.c @@ -462,7 +462,7 @@ static int dttsp_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_le /* if it's not for the dttsp backend, maybe it's for the tuner */ if (priv->tuner) { - return rig_get_conf(priv->tuner, token, val); + return rig_get_conf2(priv->tuner, token, val, val_len); } else { diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index d650a2b9b..4db850e87 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -2014,7 +2014,7 @@ int print_conf_list(const struct confparams *cfp, rig_ptr_t data) int i; char buf[128] = ""; - rig_get_conf(rig, cfp->token, buf); + rig_get_conf2(rig, cfp->token, buf, sizeof(buf)); printf("%s: \"%s\"\n" "\t" "Default: %s, Value: %s\n", cfp->name, cfp->tooltip, @@ -2078,7 +2078,7 @@ int print_conf_list2(const struct confparams *cfp, rig_ptr_t data) RIG *rig = (RIG *) data; char buf[128] = ""; - rig_get_conf(rig, cfp->token, buf); + rig_get_conf2(rig, cfp->token, buf, sizeof(buf)); fprintf(stdout, "%s: \"%s\"\n" "\t" "Default: %s, Value: %s\n", cfp->name, cfp->tooltip, @@ -6025,7 +6025,7 @@ declare_proto_rig(get_conf) else { char value[4096]; // no max value known -- should we limit it? - ret = rig_get_conf(rig, mytoken, value); + ret = rig_get_conf2(rig, mytoken, value, sizeof(value)); if (ret != RIG_OK) { commit 6c372f981f08dd571f5fc47197fcce9fd076f007 Author: George Baltz N3GB <Geo...@gm...> Date: Sat Jul 26 21:56:39 2025 -0400 Distinguish wanted from unwanted fall through instances Compile with -Wimplicit-fallthrough; analyze the results. Define macro to mark valid fall through constructs. Mark all of the good ones, and fix the bad. Not available with all compilers - for those without the feature this commit does nothing. diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index c5df12297..3441a162b 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -73,6 +73,23 @@ #include <hamlib/riglist.h> //#include <hamlib/config.h> +/* Define macros for handling attributes, if the compiler implements them + * Should be available in c23-capable compilers, or c++11 ones + */ +// From ISO/IEC 9899:202y n3301 working draft +#ifndef __has_c_attribute +#define __has_c_attribute(x) 0 +#endif + +// Macro to mark fallthrough as OK +// Squelch warnings if -Wimplicit-fallthrough added to CFLAGS +#if __has_c_attribute(fallthrough) +#define HL_FALLTHROUGH [[fallthrough]]; +#else +/* Fall back */ +#define HL_FALLTHROUGH +#endif + /** * \addtogroup rig * @{ diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 346dca79e..e1a00ea67 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -3393,6 +3393,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) rig_debug(RIG_DEBUG_ERR, "%s: unknown vfo '%s'\n", __func__, rig_strvfo(rs->current_vfo)); } + HL_FALLTHROUGH // Fall into outer default default: if (priv->x25cmdfails == 0 || priv_caps->x25x26_always) @@ -9111,12 +9112,14 @@ static int icom_parse_spectrum_frame(RIG *rig, size_t length, case SCOPE_MODE_FIXED: cache->spectrum_mode = RIG_SPECTRUM_MODE_FIXED; + HL_FALLTHROUGH case SCOPE_MODE_SCROLL_C: if (cache->spectrum_mode == RIG_SPECTRUM_MODE_NONE) { cache->spectrum_mode = RIG_SPECTRUM_MODE_CENTER_SCROLL; } + HL_FALLTHROUGH case SCOPE_MODE_SCROLL_F: if (cache->spectrum_mode == RIG_SPECTRUM_MODE_NONE) diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 435bedf4e..ccb13c65a 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -5600,7 +5600,7 @@ int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg) SNPRINTF(morsebuf, sizeof morsebuf, "KY2%s", m2); break; } - /* FALL THROUGH */ + HL_FALLTHROUGH default: /* the command must consist of 28 bytes 0x20 padded */ diff --git a/rigs/yaesu/ft847.c b/rigs/yaesu/ft847.c index 75af845c1..a166070d3 100644 --- a/rigs/yaesu/ft847.c +++ b/rigs/yaesu/ft847.c @@ -1298,6 +1298,7 @@ static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, case MD_CWN: *width = rig_passband_narrow(rig, RIG_MODE_CW); + HL_FALLTHROUGH case MD_CW: *mode = RIG_MODE_CW; @@ -1305,6 +1306,7 @@ static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, case MD_CWNR: *width = rig_passband_narrow(rig, RIG_MODE_CW); + HL_FALLTHROUGH case MD_CWR: *mode = RIG_MODE_CWR; @@ -1312,6 +1314,7 @@ static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, case MD_AMN: *width = rig_passband_narrow(rig, RIG_MODE_AM); + HL_FALLTHROUGH case MD_AM: *mode = RIG_MODE_AM; @@ -1319,6 +1322,7 @@ static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, case MD_FMN: *width = rig_passband_narrow(rig, RIG_MODE_FM); + HL_FALLTHROUGH case MD_FM: *mode = RIG_MODE_FM; diff --git a/rigs/yaesu/ft920.c b/rigs/yaesu/ft920.c index 41d58b350..bc525594e 100644 --- a/rigs/yaesu/ft920.c +++ b/rigs/yaesu/ft920.c @@ -794,6 +794,7 @@ static int ft920_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { return err; } + HL_FALLTHROUGH case RIG_VFO_MEM: /* MEM TUNE or user doesn't care */ case RIG_VFO_MAIN: @@ -965,6 +966,7 @@ static int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { return err; } + HL_FALLTHROUGH case RIG_VFO_MEM: /* MEM TUNE or user doesn't care */ case RIG_VFO_MAIN: diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index fe88b7880..ccdc9c605 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -4414,9 +4414,9 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) case RIG_METER_VDD: SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), format, 5); break; + default: rig_debug(RIG_DEBUG_ERR, "%s: unknown val.i=%d\n", __func__, val.i); - - default: RETURNFUNC(-RIG_EINVAL); + RETURNFUNC(-RIG_EINVAL); } break; diff --git a/src/iofunc.c b/src/iofunc.c index 97d3ca135..99e75414f 100644 --- a/src/iofunc.c +++ b/src/iofunc.c @@ -408,8 +408,8 @@ int HAMLIB_API port_close(hamlib_port_t *p, rig_port_t port_type) default: rig_debug(RIG_DEBUG_ERR, "%s(): Unknown port type %d\n", __func__, port_type); + HL_FALLTHROUGH - /* fall through */ case RIG_PORT_DEVICE: ret = close(p->fd); } diff --git a/src/rig.c b/src/rig.c index dae5add5c..63019fdf8 100644 --- a/src/rig.c +++ b/src/rig.c @@ -3611,8 +3611,8 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { ptt = RIG_PTT_ON; } + HL_FALLTHROUGH - /* fall through */ case RIG_PTT_RIG_MICDATA: if (caps->set_ptt == NULL) { diff --git a/tests/uthash.h b/tests/uthash.h index 77a11c30e..6724600b1 100644 --- a/tests/uthash.h +++ b/tests/uthash.h @@ -412,15 +412,25 @@ do { hashv += keylen; \ switch ( _hj_k ) { \ case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); \ + HL_FALLTHROUGH \ case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); \ + HL_FALLTHROUGH \ case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); \ + HL_FALLTHROUGH \ case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); \ + HL_FALLTHROUGH \ case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); \ + HL_FALLTHROUGH \ case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); \ + HL_FALLTHROUGH \ case 5: _hj_j += _hj_key[4]; \ + HL_FALLTHROUGH \ case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); \ + HL_FALLTHROUGH \ case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); \ + HL_FALLTHROUGH \ case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); \ + HL_FALLTHROUGH \ case 1: _hj_i += _hj_key[0]; \ } \ HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ @@ -547,7 +557,9 @@ do { \ uint32_t _mur_k1=0; \ switch((keylen) & 3) { \ case 3: _mur_k1 ^= _mur_tail[2] << 16; \ + HL_FALLTHROUGH \ case 2: _mur_k1 ^= _mur_tail[1] << 8; \ + HL_FALLTHROUGH \ case 1: _mur_k1 ^= _mur_tail[0]; \ _mur_k1 *= _mur_c1; \ _mur_k1 = MUR_ROTL32(_mur_k1,15); \ commit a7c8c3fa9ebf0aa1c2b6ef4b6c4b20ba2ded4014 Author: George Baltz N3GB <Geo...@gm...> Date: Sat Jul 26 14:04:25 2025 -0400 Fix another unwanted fall through diff --git a/tests/rotctld.c b/tests/rotctld.c index f5a08d749..c3dedb52f 100644 --- a/tests/rotctld.c +++ b/tests/rotctld.c @@ -246,6 +246,7 @@ int main(int argc, char *argv[]) case 'O': el_offset = atof(optarg); + break; case 'v': verbose++; ----------------------------------------------------------------------- Summary of changes: c++/rigclass.cc | 12 ++++++++++-- include/hamlib/rig.h | 27 ++++++++++++++++++++++++++- include/hamlib/rigclass.h | 6 ++++-- rigs/flexradio/dttsp.c | 2 +- rigs/icom/icom.c | 3 +++ rigs/kenwood/kenwood.c | 2 +- rigs/yaesu/ft847.c | 4 ++++ rigs/yaesu/ft920.c | 2 ++ rigs/yaesu/newcat.c | 4 ++-- src/iofunc.c | 2 +- src/rig.c | 2 +- tests/rigctl_parse.c | 6 +++--- tests/rotctld.c | 1 + tests/uthash.h | 12 ++++++++++++ 14 files changed, 71 insertions(+), 14 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |