Boost C++ Libraries: Ticket #4282: Please add BOOST_ATTRIBUTE_NORETURN to rethrow_exception() https://svn.boost.org/trac10/ticket/4282 <p> That will make some compilers happier. Thank you. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4282 Trac 1.4.3 Steven Watanabe Tue, 08 Jun 2010 01:24:24 GMT <link>https://svn.boost.org/trac10/ticket/4282#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4282#comment:1</guid> <description> <p> Do you have a patch? Adding BOOST_ATTRIBUTE_NORETURN gives this warning instead: </p> <pre class="wiki">boost/exception/detail/exception_ptr.hpp: In function 'void boost::rethrow_exception(const boost::exception_ptr&amp;)': boost/exception/detail/exception_ptr.hpp:391: warning: 'noreturn' function does return </pre><p> I can't seem to get rid of this. Adding BOOST_ATTRIBUTE_NORETURN to clone_base::rethrow doesn't help. </p> </description> <category>Ticket</category> </item> <item> <author>Gevorg Voskanyan <v_gevorg@…></author> <pubDate>Tue, 08 Jun 2010 16:06:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4282#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4282#comment:2</guid> <description> <p> No, I didn't make a patch as simple addition of BOOST_ATTRIBUTE_NORETURN to rethrow_exception was all was thinking of. That worked for me with msvc8 and didn't produce any warnings with /W4. After seeing your comment I tried the same with gcc 4.4.0 and indeed it gave me the same "'noreturn' function does return" warning. What is most annoying to me is that gcc gives such warnings even though there is a #pragma GCC system_header at the top of the header file. So I then tried adding a throw "convince the compiler this function doesn't return"; line after p-&gt;rethrow(); in rethrow_exception(), which made that warning to go away. With both BOOST_ATTRIBUTE_NORETURN and a dummy throw statement present, both msvc and gcc happily compile code without warnings they were previously complaining about. However I am not sure if that is an acceptable solution. Or maybe add BOOST_ATTRIBUTE_NORETURN only for msvc as the problem is more severe with msvc than with gcc? I don't know. </p> <p> To be explicit, here's why I think this is more a problem with msvc than gcc. The following code </p> <pre class="wiki">int f( boost::exception_ptr p ) { boost::rethrow_exception( p ); } </pre><p> is rejected by msvc with an error saying that f must return a value, whereas gcc merely gives a "control reaches end of non-void function" warning. </p> <p> Thanks for looking into this, </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Emil Dotchevski</dc:creator> <pubDate>Sat, 12 Feb 2011 00:08:42 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4282#comment:3 https://svn.boost.org/trac10/ticket/4282#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket