Joshua Boyd wrote:
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.
I'm building with g++ (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7) with no problems.
What does g++ --version tell you?
The (void) cast should tell the compiler that we're ignoring the return value
deliberately. The risk with your patch is that some other compiler will then
warn that we have an unused variable.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]