Skip to content

Commit 14adf68

Browse files
committed
test: posix: timers: Fix unused function warning
Building with clang warns: tests/posix/timers/src/clock.c:37:20: error: unused function 'tv_to_ts' [-Werror,-Wunused-function] static inline void tv_to_ts(const struct timeval *tv, struct timespec *ts) ^ tests/posix/timers/src/clock.c:51:16: error: unused function 'tp_eq' [-Werror,-Wunused-function] _decl_op(bool, tp_eq, ==); /* a == b */ ^ tests/posix/timers/src/clock.c:52:16: error: unused function 'tp_lt' [-Werror,-Wunused-function] _decl_op(bool, tp_lt, &lt;); /* a &lt; b */ ^ tests/posix/timers/src/clock.c:53:16: error: unused function 'tp_gt' [-Werror,-Wunused-function] _decl_op(bool, tp_gt, &gt;); /* a &gt; b */ ^ tests/posix/timers/src/clock.c:54:16: error: unused function 'tp_le' [-Werror,-Wunused-function] _decl_op(bool, tp_le, &lt;=); /* a &lt;= b */ tests/posix/timers/src/clock.c:59:20: error: unused function 'tp_diff_in_range_ns' [-Werror,-Wunused-function] static inline bool tp_diff_in_range_ns(const struct timespec *a, ^ const struct timespec *b, tests/posix/timers/src/clock.c:49:20: error: unused function 'tp_diff_in_range_ns' [-Werror,-Wunused-function] static inline bool tp_diff_in_range_ns(const struct timespec *a, ^ const struct timespec *b, Signed-off-by: Tom Hughes <tomhughes@chromium.org>
1 parent a117d12 commit 14adf68

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

tests/posix/timers/src/clock.c

+3-9
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,10 @@ static inline int64_t ts_to_ns(const struct timespec *ts)
3434
return ts->tv_sec * NSEC_PER_SEC + ts->tv_nsec;
3535
}
3636

37-
static inline void tv_to_ts(const struct timeval *tv, struct timespec *ts)
38-
{
39-
ts->tv_sec = tv->tv_sec;
40-
ts->tv_nsec = tv->tv_usec * NSEC_PER_USEC;
41-
}
42-
4337
#define _tp_op(_a, _b, _op) (ts_to_ns(_a) _op ts_to_ns(_b))
4438

4539
#define _decl_op(_type, _name, _op) \
46-
static inline _type _name(const struct timespec *_a, const struct timespec *_b) \
40+
__used static inline _type _name(const struct timespec *_a, const struct timespec *_b) \
4741
{ \
4842
return _tp_op(_a, _b, _op); \
4943
}
@@ -56,8 +50,8 @@ _decl_op(bool, tp_ge, >=); /* a >= b */
5650
_decl_op(int64_t, tp_diff, -); /* a - b */
5751

5852
/* lo <= (a - b) < hi */
59-
static inline bool tp_diff_in_range_ns(const struct timespec *a, const struct timespec *b,
60-
int64_t lo, int64_t hi)
53+
__used static inline bool tp_diff_in_range_ns(const struct timespec *a, const struct timespec *b,
54+
int64_t lo, int64_t hi)
6155
{
6256
int64_t diff = tp_diff(a, b);
6357

0 commit comments

Comments
 (0)