Bug #791
closeduserspace-rcu tests need a few assertions
100%
Description
In six different spots, the userspace-rcu
tests raise this warning:
attention : ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
The simple fix is to wrap each offending write()
in an assert()
(turns out it's the same write()
every time):
userspace-rcu/tests/benchmark/test_urcu_lfq.c, line 385: assert(write (1, ".", 1)); userspace-rcu/tests/benchmark/test_urcu_lfs.c, line 469: assert(write (1, ".", 1)); userspace-rcu/tests/benchmark/test_urcu_wfcq.c, line 495: assert(write (1, ".", 1)); userspace-rcu/tests/benchmark/test_urcu_wfq.c, line 353: assert(write (1, ".", 1)); userspace-rcu/tests/benchmark/test_urcu_wfs.c, line 483: assert(write (1, ".", 1)); userspace-rcu/tests/benchmark/test_urcu_lfs_rcu.c, line 386: assert(write (1, ".", 1));
Updated by Mathieu Desnoyers almost 10 years ago
- Project changed from LTTng-UST to Userspace RCU
Updated by Mathieu Desnoyers almost 10 years ago
- Status changed from New to Confirmed
- Assignee set to Mathieu Desnoyers
It writes a "." progress to the console. We don't care if it succeeds or not.
An assert is the wrong solution, because then an interrupted write would cause
the assert to trigger. Moreover, in NDEBUG builds, assert() becomes a no-op. So
the assert approach would actually introduce a bug. (see the assert manpage)
Simply casting the write() result as "(void)" would clearly state that we
just don't care about its return value here.
Thanks,
Mathieu
Updated by Mathieu Desnoyers almost 10 years ago
- Status changed from Confirmed to Resolved
- % Done changed from 0 to 100
Applied in changeset d863e15371666dff14e7f3191de5ff91d9b24d7f.