diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 1a1f81b47..a4e18e104 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -57,6 +57,25 @@ # define __END_DECLS /* empty */ #endif +#ifndef thread_local +# if __STDC_VERSION__ >= 201112 && !defined __STDC_NO_THREADS__ +# define thread_local _Thread_local +# elif defined _WIN32 && ( \ + defined _MSC_VER || \ + defined __ICL || \ + defined __DMC__ || \ + defined __BORLANDC__ ) +# define thread_local __declspec(thread) +/* note that ICC (linux) and Clang are covered by __GNUC__ */ +# elif defined __GNUC__ || \ + defined __SUNPRO_C || \ + defined __xlC__ +# define thread_local __thread +# else +# error "Cannot define thread_local" +# endif +#endif + /* HAMLIB_PARAMS is a macro used to wrap function prototypes, so that compilers * that don't understand ANSI C prototypes still work, and ANSI C * compilers can issue warnings about type mismatches. */ @@ -1732,7 +1751,7 @@ struct rig_state { rmode_t current_mode; /*!< Mode currently set */ pbwidth_t current_width; /*!< Passband width currently set */ vfo_t tx_vfo; /*!< Tx VFO currently set */ - int mode_list; /*!< Complete list of modes for this rig */ + rmode_t mode_list; /*!< Complete list of modes for this rig */ int transmit; /*!< rig should be transmitting i.e. hard wired PTT asserted - used by rigs that don't do CAT while in Tx */