zephyr/tests/posix
Tom Hughes 01e412951b tests: posix: timers: Fix -Wsometimes-uninitialized warning
Building portability.posix.timers with clang warns:

tests/posix/timers/src/nanosleep.c:180:2: error: variable 'actual_ns' is
used uninitialized whenever switch default is taken
[-Werror,-Wsometimes-uninitialized]
        default:
        ^~~~~~~
tests/posix/timers/src/nanosleep.c:197:15: note: uninitialized use
occurs here
        zassert_true(actual_ns >= exp_ns, "actual: %llu expected: %llu",
                     ^~~~~~~~~                          actual_ns, exp_ns);
subsys/testsuite/ztest/include/zephyr/ztest_assert.h:275:41: note:
                                      ^~ expanded from macro 'zassert_true'
subsys/testsuite/ztest/include/zephyr/ztest_assert.h:194:14: note:
expanded from macro 'zassert'
        _zassert_va(cond, default_msg, COND_CODE_1(__VA_OPT__(1),
                    ^~~~               (__VA_ARGS__), (NULL)))
subsys/testsuite/ztest/include/zephyr/ztest_assert.h:191:16: note:
expanded from macro '_zassert_va'
        _zassert_base(cond, default_msg, msg, ##__VA_ARGS__)
                      ^~~~
subsys/testsuite/ztest/include/zephyr/ztest_assert.h:180:14: note:
expanded from macro '_zassert_base'
                        z_zassert(cond, _msg ? ("(" default_msg ")") :
                                  ^~~~   (default_msg), __FILE__,    \
tests/posix/timers/src/nanosleep.c:152:20: note: initialize the variable
'actual_ns' to silence this warning
        uint64_t actual_ns;
                          ^
                           = 0

Not really necessary since there is a zassert_unreachable(), but doesn't
hurt to initialize the variable.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-07 02:23:35 +01:00
..
barriers
c_lib_ext tests: posix: common: separate posix c_lib_ext to standalone test 2024-11-27 08:16:35 +01:00
common tests: posix: common: separate xsi realtime passing to standalone test 2025-02-04 15:00:24 +01:00
eventfd
fs tests: posix: common: separate xsi realtime passing to standalone test 2025-02-04 15:00:24 +01:00
headers tests: posix: Re-enable -Wunused-value warning 2025-02-06 03:18:25 +01:00
net
rwlocks tests: posix: rwlocks: move filter to testcase.yml common area 2024-11-25 01:02:50 +01:00
semaphores
signals tests: posix: common: separate posix signal tests into a smaller testsuite 2024-11-29 05:42:17 +01:00
single_process tests: posix: env: colocate with single_process option group 2024-12-09 03:55:02 +01:00
spinlocks tests: posix: common: separate posix spinlock tests into standalone test 2024-11-27 22:52:56 -05:00
threads_ext tests: posix: threads_ext: remove stale comment 2024-12-07 14:16:34 +01:00
timers tests: posix: timers: Fix -Wsometimes-uninitialized warning 2025-02-07 02:23:35 +01:00
xsi_realtime tests: posix: common: separate xsi realtime passing to standalone test 2025-02-04 15:00:24 +01:00
xsi_streams tests: posix: common: separate posix xsi streams to standalone test 2024-11-20 15:58:26 -05:00
xsi_system_logging tests: posix: common: separate posix xsi system logging to standalone test 2024-11-26 08:45:43 +01:00
xsi_threads_ext tests: posix: common: separate xsi_threads_ext into standalone test 2024-12-17 09:48:49 +01:00