[thread] Missing #include

Hi, I think boost/thread/pthread/shared_mutex.hpp in trunk is missing #include <boost/thread/thread.hpp>. Now it complains it doesn't know what this_thread is. I also noticed lots of warnings "unused variable 'res'" and alikes while compiling my projects with GCC 4.2.1 on OpenSUSE. These warnings mostly come from boost/thread/pthread/pthread_mutex_scoped_lock.hpp, boost/thread/pthread/once.hpp, boost/thread/pthread/mutex.hpp, boost/thread/pthread/condition_variable.hpp. I didn't investigate closely, though.

Andrey Semashev wrote:
I also noticed lots of warnings "unused variable 'res'" and alikes while compiling my projects with GCC 4.2.1 on OpenSUSE.
I already noticed this, and asked Peter Dimov to provide a BOOST_VERIFY macro to get rid of them. I surely could do with a macro that is private to the thread library, but since I think the issue is a more general one, I'd prefer to wait until Peter supplies a global one. Roland aka speedsnail

Roland Schwarz:
Andrey Semashev wrote:
I also noticed lots of warnings "unused variable 'res'" and alikes while compiling my projects with GCC 4.2.1 on OpenSUSE.
I already noticed this, and asked Peter Dimov to provide a BOOST_VERIFY macro to get rid of them.
I surely could do with a macro that is private to the thread library, but since I think the issue is a more general one, I'd prefer to wait until Peter supplies a global one.
I'll add BOOST_VERIFY if Beman agrees that it should be supplied as part of 1.35.

Peter Dimov wrote:
Roland Schwarz:
Andrey Semashev wrote:
I also noticed lots of warnings "unused variable 'res'" and alikes while compiling my projects with GCC 4.2.1 on OpenSUSE. I already noticed this, and asked Peter Dimov to provide a BOOST_VERIFY macro to get rid of them.
I surely could do with a macro that is private to the thread library, but since I think the issue is a more general one, I'd prefer to wait until Peter supplies a global one.
I'll add BOOST_VERIFY if Beman agrees that it should be supplied as part of 1.35.
I missed the discussion of exactly what BOOST_VERIFY does, but since it's a new macro I assume it won't break any existing code. If that's correct, go ahead for 1.35. --Beman

Peter Dimov wrote:
Roland Schwarz:
Andrey Semashev wrote:
I also noticed lots of warnings "unused variable 'res'" and alikes while compiling my projects with GCC 4.2.1 on OpenSUSE. I already noticed this, and asked Peter Dimov to provide a BOOST_VERIFY macro to get rid of them.
I surely could do with a macro that is private to the thread library, but since I think the issue is a more general one, I'd prefer to wait until Peter supplies a global one.
I'll add BOOST_VERIFY if Beman agrees that it should be supplied as part of 1.35.
I missed the discussion of exactly what BOOST_VERIFY does, but since it's a new macro I assume it won't break any existing code. If that's correct, go ahead for 1.35.
--Beman
BOOST_VERIFY added to trunk. It's the same as BOOST_ASSERT, but always evaluates its argument. This helps to suppress warnings for unused variables and can also be used if the asserted expression has desirable side effects.

Peter Dimov wrote:
Peter Dimov wrote:
Roland Schwarz:
Andrey Semashev wrote:
I also noticed lots of warnings "unused variable 'res'" and alikes while compiling my projects with GCC 4.2.1 on OpenSUSE. I already noticed this, and asked Peter Dimov to provide a BOOST_VERIFY macro to get rid of them.
I surely could do with a macro that is private to the thread library, but since I think the issue is a more general one, I'd prefer to wait until Peter supplies a global one. I'll add BOOST_VERIFY if Beman agrees that it should be supplied as part of 1.35. I missed the discussion of exactly what BOOST_VERIFY does, but since it's a new macro I assume it won't break any existing code. If that's correct, go ahead for 1.35.
--Beman
BOOST_VERIFY added to trunk. It's the same as BOOST_ASSERT, but always evaluates its argument. This helps to suppress warnings for unused variables and can also be used if the asserted expression has desirable side effects.
Nice! I suggest adding an additional sentence to the docs: "BOOST_VERIFY is useful for suppressing warnings about unused variables or when the asserted expression has desirable side effects." --Beman

Andrey Semashev <andysem <at> mail.ru> writes:
I think boost/thread/pthread/shared_mutex.hpp in trunk is missing #include <boost/thread/thread.hpp>. Now it complains it doesn't know what this_thread is.
Yes, you're right. I've checked in a new version with the missing include added. Anthony
participants (5)
-
Andrey Semashev
-
Anthony Williams
-
Beman Dawes
-
Peter Dimov
-
Roland Schwarz