cpp/src/qpid/sys/posix/LockFile.cpp, line 59 throws a warning when built
with g++ 4.3.  Here is the compiler output:
g++ -DHAVE_CONFIG_H -I. -Igen -I./gen -Werror -pedantic -Wall -Wextra
-Wno-shadow -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long
-Wvolatile-register-var -Winvalid-pch -Wno-system-headers
-Woverloaded-virtual -g -O2 -MT qpid/sys/posix/LockFile.lo -MD -MP -MF
qpid/sys/posix/.deps/LockFile.Tpo -c qpid/sys/posix/LockFile.cpp  -fPIC
-DPIC -o qpid/sys/posix/.libs/LockFile.o
cc1plus: warnings being treated as errors
qpid/sys/posix/LockFile.cpp: In destructor
'qpid::sys::LockFile::~LockFile()':
qpid/sys/posix/LockFile.cpp:59: error: ignoring return value of 'int
lockf(int, int, __off_t)', declared with attribute warn_unused_result
qpid/sys/posix/LockFile.cpp: In destructor
'qpid::sys::LockFile::~LockFile()':
qpid/sys/posix/LockFile.cpp:59: error: ignoring return value of 'int
lockf(int, int, __off_t)', declared with attribute warn_unused_result
qpid/sys/posix/LockFile.cpp: In destructor
'qpid::sys::LockFile::~LockFile()':
qpid/sys/posix/LockFile.cpp:59: error: ignoring return value of 'int
lockf(int, int, __off_t)', declared with attribute warn_unused_result


Here is the line in question:
(void) ::lockf(f, F_ULOCK, 0); // Suppress warnings about ignoring
return value.

What seems a bit odd is that, as you can see, there is a comment about
trying to suppress that warning, but it obviously isn't working anymore.

Changing the line to:
 int ret;
 ret = ::lockf(f, F_ULOCK, 0);  // Suppress warnings about ignoring
return value.
Does make the error go away, although it is a bit inelegant to get ret
and then not actually check if for an error condition.

In several other locations there are write calls where the return value
is not handled, which also upsets G++ 4.3.

I can send a patch of what I changed if that would help.  I'm also
flipping through Jira to see if it looks appropriate to try and make an
entry there.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to