1.45: thread/condition_variable.hpp: unused variable 'res' warning, gcc 4.2
hello, in Release build in Xcode, gcc 4.2.1, inline void condition_variable::wait(unique_lock<mutex>& m) { ... int const res = pthread_cond_wait(&cond, &internal_mutex); BOOST_ASSERT(!res); ... } Unused variable 'res' is gcc mistaken? regards,
"Hicham Mouline"
in Release build in Xcode, gcc 4.2.1,
inline void condition_variable::wait(unique_lock<mutex>& m) { ... int const res = pthread_cond_wait(&cond, &internal_mutex); BOOST_ASSERT(!res); ... }
Unused variable 'res'
is gcc mistaken?
Yes and no :-) In the release build the assert compiles to nothing, so res is no longer referenced, even though it is referenced in the source. Anthony -- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
On Thu, Jan 6, 2011 at 9:28 PM, Anthony Williams
"Hicham Mouline"
writes: in Release build in Xcode, gcc 4.2.1,
inline void condition_variable::wait(unique_lock<mutex>& m) { ... int const res = pthread_cond_wait(&cond, &internal_mutex); BOOST_ASSERT(!res); ... }
Unused variable 'res'
is gcc mistaken?
Yes and no :-)
In the release build the assert compiles to nothing, so res is no longer referenced, even though it is referenced in the source.
I actually have a patch for this: https://svn.boost.org/trac/boost/ticket/4818 which I don't think has been merged into (or acted upon) yet. HTH -- Dean Michael Berris about.me/deanberris
Dean Michael Berris
On Thu, Jan 6, 2011 at 9:28 PM, Anthony Williams
wrote: "Hicham Mouline"
writes: in Release build in Xcode, gcc 4.2.1,
inline void condition_variable::wait(unique_lock<mutex>& m) { ... int const res = pthread_cond_wait(&cond, &internal_mutex); BOOST_ASSERT(!res); ... }
Unused variable 'res'
is gcc mistaken?
Yes and no :-)
In the release build the assert compiles to nothing, so res is no longer referenced, even though it is referenced in the source.
I actually have a patch for this: https://svn.boost.org/trac/boost/ticket/4818 which I don't think has been merged into (or acted upon) yet.
I've changed it to throw rather than assert, for consistency with condition_variable_any. This should get rid of the warning too. Anthony -- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
On Fri, Jan 7, 2011 at 6:54 AM, Anthony Williams
Dean Michael Berris
writes: I actually have a patch for this: https://svn.boost.org/trac/boost/ticket/4818 which I don't think has been merged into (or acted upon) yet.
I've changed it to throw rather than assert, for consistency with condition_variable_any. This should get rid of the warning too.
Cool! Thanks Anthony! (even though my patch didn't solve it) :-D -- Dean Michael Berris about.me/deanberris
participants (3)
-
Anthony Williams
-
Dean Michael Berris
-
Hicham Mouline