Project

General

Profile

Actions

Bug #791

closed

userspace-rcu tests need a few assertions

Added by Daniel U. Thibault almost 10 years ago. Updated almost 10 years ago.

Status:
Resolved
Priority:
Low
Target version:
-
Start date:
04/29/2014
Due date:
% Done:

100%

Estimated time:

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));
Actions #1

Updated by Mathieu Desnoyers almost 10 years ago

  • Project changed from LTTng-UST to Userspace RCU
Actions #2

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

Actions #3

Updated by Mathieu Desnoyers almost 10 years ago

  • Status changed from Confirmed to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF