Boost C++ Libraries: Ticket #6192: Fix warnings passing non-POD to vararg function in math/special_functions/fpclassify.hpp https://svn.boost.org/trac10/ticket/6192 <p> Sun CC (and probably any other compiler for which <code>BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS</code> is defined) warns about passing non-POD struct to vararg <code>is_generic_tag_false()</code> overload. While this is probably harmless in practice because the function doesn't use its argument anyhow (and normally shouldn't be even called as it should be optimized away), it still results in nasty warnings (see below for the full text) so I suggest the following simple patch which just switches to using pointers instead of objects to fix this: </p> <div class="wiki-code"> <div class="diff"> <ul class="entries"> <li class="entry"> <h2> <a>boost/math/special_functions/fpclassify.hpp</a> </h2> <table class="trac-diff inline" cellspacing="0"> <colgroup> <col class="lineno"/><col class="lineno"/><col class="content"/> </colgroup> <thead> <tr> <th title="File boost_1_41_0.orig/boost/math/special_functions/fpclassify.hpp Thu Dec 1 19:03:56 2011"> old </th> <th title="File boost_1_41_0/boost/math/special_functions/fpclassify.hpp Thu Dec 1 19:04:48 2011"> new </th> <td> <em></em> &nbsp; </td> </tr> </thead> <tbody class="unmod"> <tr> <th>251</th><th>251</th><td class="l"><span>&nbsp; &nbsp;typedef typename detail::fp_traits&lt;T&gt;::type traits;</span></td> </tr> <tr> <th>252</th><th>252</th><td class="l"><span>&nbsp; &nbsp;typedef typename traits::method method;</span></td> </tr> <tr> <th>253</th><th>253</th><td class="l"><span>#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>254</th><th>&nbsp;</th><td class="l"><span>&nbsp; &nbsp;if(std::numeric_limits&lt;T&gt;::is_specialized &amp;&amp; detail::is_generic_tag_false(method()))</span></td> </tr> <tr> <th>&nbsp;</th><th>254</th><td class="r"><span>&nbsp; &nbsp;if(std::numeric_limits&lt;T&gt;::is_specialized &amp;&amp;</span></td> </tr> <tr class="last"> <th>&nbsp;</th><th>255</th><td class="r"><span>&nbsp; &nbsp; &nbsp; &nbsp;detail::is_generic_tag_false(static_cast&lt;method*&gt;(NULL)))</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>255</th><th>256</th><td class="l"><span>&nbsp; &nbsp; &nbsp; return detail::fpclassify_imp(t, detail::generic_tag&lt;true&gt;());</span></td> </tr> <tr> <th>256</th><th>257</th><td class="l"><span>&nbsp; &nbsp;return detail::fpclassify_imp(t, method());</span></td> </tr> <tr> <th>257</th><th>258</th><td class="l"><span>#else</span></td> </tr> </tbody> </table> </li> <li class="entry"> <h2> <a>boost/math/special_functions/detail/fp_traits.hpp</a> </h2> <table class="trac-diff inline" cellspacing="0"> <colgroup> <col class="lineno"/><col class="lineno"/><col class="content"/> </colgroup> <thead> <tr> <th title="File boost_1_41_0.orig/boost/math/special_functions/detail/fp_traits.hpp Thu Dec 1 19:04:06 2011"> old </th> <th title="File boost_1_41_0/boost/math/special_functions/detail/fp_traits.hpp Thu Dec 1 19:06:45 2011"> new </th> <td> <em></em> &nbsp; </td> </tr> </thead> <tbody class="unmod"> <tr> <th>101</th><th>101</th><td class="l"><span>// These helper functions are used only when numeric_limits&lt;&gt;</span></td> </tr> <tr> <th>102</th><th>102</th><td class="l"><span>// members are not compile time constants:</span></td> </tr> <tr> <th>103</th><th>103</th><td class="l"><span>//</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>104</th><th>&nbsp;</th><td class="l"><span>inline bool is_generic_tag_false(const generic_tag&lt;false&gt;<del>&amp;</del>)</span></td> </tr> <tr class="last"> <th>&nbsp;</th><th>104</th><td class="r"><span>inline bool is_generic_tag_false(const generic_tag&lt;false&gt;<ins>*</ins>)</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>105</th><th>105</th><td class="l"><span>{</span></td> </tr> <tr> <th>106</th><th>106</th><td class="l"><span>&nbsp; &nbsp;return true;</span></td> </tr> <tr> <th>107</th><th>107</th><td class="l"><span>}</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>108</th><th>&nbsp;</th><td class="l"><span>inline bool is_generic_tag_false(<del>...</del>)</span></td> </tr> <tr class="last"> <th>&nbsp;</th><th>108</th><td class="r"><span>inline bool is_generic_tag_false(<ins>const void*</ins>)</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>109</th><th>109</th><td class="l"><span>{</span></td> </tr> <tr> <th>110</th><th>110</th><td class="l"><span>&nbsp; &nbsp;return false;</span></td> </tr> <tr> <th>111</th><th>111</th><td class="l"><span>}</span></td> </tr> </tbody> </table> </li> </ul> </div></div><p> While the patch is against the old 1.41 release and not the trunk, the relevant code doesn't seem to have changed since then. </p> <p> P.S. For the reference, here are the warnings: </p> <pre class="wiki">".../boost/math/special_functions/fpclassify.hpp", line 254: Warning, nonpodvarargw: A non-POD object of type "boost::math::detail::ieee_copy_leading_bits_tag" passed as a variable argument to function "boost::math::detail::is_generic_tag_false(...)". ".../boost/math/special_functions/gamma.hpp", line 591: Where, temwhileinst: While instantiating "boost::math::fpclassify&lt;long double&gt;(long double)". ".../boost/math/special_functions/gamma.hpp", line 591: Where, teminstfrom: Instantiated from boost::math::detail::full_igamma_prefix&lt;long double, boost::math::policies::policy&lt;boost::math::policies::promote_float&lt;0&gt;, boost::math::policies::promote_double&lt;0&gt;, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy&gt;&gt;(long double, long double, const boost::math::policies::policy&lt;boost::math::policies::promote_float&lt;0&gt;, boost::math::policies::promote_double&lt;0&gt;, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy&gt;&amp;). ".../boost/math/special_functions/gamma.hpp", line 977: Where, teminstfrom: Instantiated from boost::math::detail::gamma_incomplete_imp&lt;long double, boost::math::policies::policy&lt;boost::math::policies::promote_float&lt;0&gt;, boost::math::policies::promote_double&lt;0&gt;, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy&gt;&gt;(long double, long double, bool, bool, const boost::math::policies::policy&lt;boost::math::policies::promote_float&lt;0&gt;, boost::math::policies::promote_double&lt;0&gt;, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy&gt;&amp;, long double*). ".../boost/math/special_functions/gamma.hpp", line 1444: Where, teminstend: Instantiated from non-template code. </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6192 Trac 1.4.3 John Maddock Wed, 21 Dec 2011 16:37:34 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6192#comment:1 https://svn.boost.org/trac10/ticket/6192#comment:1 <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> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/76093" title="Apply patch from #6192. Plus fix a few other issues that arise when ...">[76093]</a>) Apply patch from <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6192" title="#6192: Patches: Fix warnings passing non-POD to vararg function in ... (closed: fixed)">#6192</a>. Plus fix a few other issues that arise when BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS is set. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6192" title="#6192: Patches: Fix warnings passing non-POD to vararg function in ... (closed: fixed)">#6192</a>. </p> Ticket