Actions
Cleanup #27204
closedsrc/common: unused variable ‘r’ compiler warning in Cond.h
Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:
0%
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:
Description
When building the current master branch (76eae2dad97d51fbfee6ae4ad17548ee484f2101), I see the following compiler warning:
[ 53%] Building CXX object src/os/CMakeFiles/os.dir/bluestore/BitmapFreelistManager.cc.o In file included from /home/lenz/work/ceph/src/common/RefCountedObj.h:19, from /home/lenz/work/ceph/src/msg/Message.h:23, from /home/lenz/work/ceph/src/common/TrackedOp.h:19, from /home/lenz/work/ceph/src/mds/Mutation.h:28, from /home/lenz/work/ceph/src/mds/CInode.h:42, from /home/lenz/work/ceph/src/mds/PurgeQueue.cc:17: /home/lenz/work/ceph/src/common/Cond.h: In constructor ‘Cond::Cond()’: /home/lenz/work/ceph/src/common/Cond.h:33:9: warning: unused variable ‘r’ [-Wunused-variable] int r = pthread_cond_init(&_c,NULL); ^
Updated by Nathan Cutler over 5 years ago
Hmm. That code from Sage has been there since the very beginning (2007) and it's not really true that the variable is unused:
8de0c227e28 src/common/Cond.h (Sage Weil 2012-07-05 19:12:22 -0700 32) Cond() : waiter_mutex(NUL L) { e0593d7be3d branches/sage/crush/common/Cond.h (Sage Weil 2007-10-17 23:34:54 +0000 33) int r = pthread_cond_init(&_c,NULL); e0593d7be3d branches/sage/crush/common/Cond.h (Sage Weil 2007-10-17 23:34:54 +0000 34) assert(r == 0); e0593d7be3d branches/sage/crush/common/Cond.h (Sage Weil 2007-10-17 23:34:54 +0000 35) }
It's used to assert that pthread_cond_init() returns zero.
Updated by Igor Fedotov over 5 years ago
- Status changed from New to Resolved
Actions