Changing testrigcaps to give a warning on power_max instead of an error

Added comments to rig_state explain fragility of shared library effects
vfo_list is the only known item that really matters to if that changes it will fail make check
https://github.com/Hamlib/Hamlib/issues/581
This commit is contained in:
Michael Black W9MDB 2021-03-03 08:21:52 -06:00
parent 87478b1fbe
commit 20a7111c54
2 changed files with 8 additions and 5 deletions

View File

@ -2124,8 +2124,9 @@ struct rig_cache {
* This struct contains live data, as well as a copy of capability fields
* that may be updated (ie. customized)
*
* It is fine to move fields around, as this kind of struct should
* not be initialized like caps are.
* It is NOT fine to move fields around as it can break share library offset
* As of 2021-03-03 vfo_list is the last known item being reference externally
* So any additions or changes to this structure must be after vfo_list.
*/
struct rig_state {
/*
@ -2188,6 +2189,8 @@ struct rig_state {
pbwidth_t current_width; /*!< Passband width currently set */
vfo_t tx_vfo; /*!< Tx VFO currently set */
rmode_t mode_list; /*!< Complete list of modes for this rig */
// mode_list is used by some
// so anything added to this structure must be below here
int transmit; /*!< rig should be transmitting i.e. hard
wired PTT asserted - used by rigs that
don't do CAT while in Tx */

View File

@ -12,7 +12,7 @@ int main()
void *p1 = &rig->state.rigport;
void *p2 = &rig->state.vfo_list;
unsigned long offset = p2 - p1;
printf("offset vfo_list=%lu\n", offset);
printf("offset vfo_list=%lu -- this is the important one\n", offset);
#if defined(WIN64) || defined (_WIN64) || defined (__WIN64__)
int expected = 13264; // mingw64
#elif defined(WIN32) || defined (_WIN32) || defined(__WIN32__)
@ -50,9 +50,9 @@ int main()
if (offset != expected)
{
printf("offset of power_max has changed!!!\n");
printf("Warning...offset of power_max has changed!!!\n");
printf("was %d, now %lu\n", expected, offset);
retcode = 1;
retcode = 0;
}
return retcode;