util-tristate: mark the inline functions as used for clang's benefit

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2022-03-01 15:06:13 +10:00
parent d6a654adcc
commit 6a3b4a31c6

View file

@ -80,6 +80,7 @@ typedef struct {
static const unsigned _TRISTATE_TYPE_MASK = ~0x3;
/* implementation detail, ignore */
__attribute__((used))
static inline void _tristate_check_type(const tristate *t1, unsigned type) {
assert((t1->_val & _TRISTATE_TYPE_MASK) == type || !"Invalid tristate type comparison");
}
@ -114,19 +115,19 @@ static inline void _tristate_check_type(const tristate *t1, unsigned type) {
_tristate_check_type(&t, _TRISTATE_TYPE_##_on##_off); \
return t._val == tristate_##_on._val; \
} \
static inline bool tristate_is_##_off(tristate t) { \
__attribute__((used)) static inline bool tristate_is_##_off(tristate t) { \
_tristate_check_type(&t, _TRISTATE_TYPE_##_on##_off); \
return t._val == tristate_##_off._val; \
} \
static inline bool tristate_is_##_none(tristate t) { \
__attribute__((used)) static inline bool tristate_is_##_none(tristate t) { \
_tristate_check_type(&t, _TRISTATE_TYPE_##_on##_off); \
return t._val == tristate_##_none._val; \
} \
static inline signed char tristate_##_on##_off##_value(tristate t) { \
__attribute__((used)) static inline signed char tristate_##_on##_off##_value(tristate t) { \
_tristate_check_type(&t, _TRISTATE_TYPE_##_on##_off); \
return t._val; \
} \
static inline const char *tristate_##_on##_off##_name(tristate t) { \
__attribute__((used)) static inline const char *tristate_##_on##_off##_name(tristate t) { \
if (tristate_is_##_on(t)) return #_on; \
if (tristate_is_##_off(t)) return #_off; \
if (tristate_is_##_none(t)) return #_none; \