Boost C++ Libraries: Ticket #4297: [PATCH] Fix for warning: enumeral and non-enumeral type in conditional expression https://svn.boost.org/trac10/ticket/4297 <p> Hello, </p> <p> When compiling some programs using boost.interprocess with gcc, we get a bunch of warning messages like: </p> <p> include/boost/interprocess/mem_algo/rbtree_best_fit.hpp:323: warning: enumeral and non-enumeral type in conditional expression </p> <p> The attached patch aims at fixing those warnings. </p> <p> BRgds, Lénaïc. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4297 Trac 1.4.3 Lénaïc Huard <lhuard@…> Fri, 04 Jun 2010 19:01:12 GMT attachment set https://svn.boost.org/trac10/ticket/4297 https://svn.boost.org/trac10/ticket/4297 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_interprocess_2.patch</span> </li> </ul> <p> Patch fixing the warnings: enumeral and non-enumeral type in conditional expression </p> Ticket Ion Gaztañaga Thu, 26 Aug 2010 10:46:29 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/4297#comment:1 https://svn.boost.org/trac10/ticket/4297#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> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.44.0</span> → <span class="trac-field-new">Boost-1.45.0</span> </li> </ul> <p> Fixed for Boost 1.45 in release branch </p> Ticket visionofarun@… Tue, 01 Feb 2011 17:01:14 GMT <link>https://svn.boost.org/trac10/ticket/4297#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4297#comment:2</guid> <description> <p> Hi, </p> <p> I'm reopening the ticket. This ticket appears in Boost 1.45.0 release notes. But seems like its not fixed yet. There are still warning messages with "g++ -W". </p> <pre class="wiki">#include &lt;boost/interprocess/managed_shared_memory.hpp&gt; int main() { boost::interprocess::managed_shared_memory *mem; return 0; } </pre><pre class="wiki">g++ -c -W -fvisibility=hidden -g -Wall 1.cpp -o 1 -I/usr/local/include/boost-1.45.0/ In file included from /usr/local/include/boost-1.45.0/boost/interprocess/detail/managed_memory_impl.hpp:22, from /usr/local/include/boost-1.45.0/boost/interprocess/managed_shared_memory.hpp:21, from 1.cpp:1: /usr/local/include/boost-1.45.0/boost/interprocess/mem_algo/rbtree_best_fit.hpp:321: warning: enumeral and non-enumeral type in conditional expression 1.cpp: In function 'int main()': 1.cpp:5: warning: unused variable 'mem' </pre> </description> <category>Ticket</category> </item> <item> <author>visionofarun@…</author> <pubDate>Tue, 01 Feb 2011 17:05:35 GMT</pubDate> <title>status, version changed; cc, keywords set; resolution deleted https://svn.boost.org/trac10/ticket/4297#comment:3 https://svn.boost.org/trac10/ticket/4297#comment:3 <ul> <li><strong>cc</strong> <span class="trac-author">visionofarun@…</span> added </li> <li><strong>keywords</strong> interprocess added </li> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost Development Trunk</span> → <span class="trac-field-new">Boost 1.45.0</span> </li> </ul> <p> Hi, </p> <p> Sorry for posting above. </p> <p> I'm reopening the ticket. This ticket appears in Boost 1.45.0 release notes. But seems like its not fixed yet. There are still warning messages with "g++ -W". </p> <pre class="wiki">#include &lt;boost/interprocess/managed_shared_memory.hpp&gt; int main() { boost::interprocess::managed_shared_memory *mem; return 0; } </pre><pre class="wiki">g++ -c -W -fvisibility=hidden -g -Wall 1.cpp -o 1 -I/usr/local/include/boost-1.45.0/ In file included from /usr/local/include/boost-1.45.0/boost/interprocess/detail/managed_memory_impl.hpp:22, from /usr/local/include/boost-1.45.0/boost/interprocess/managed_shared_memory.hpp:21, from 1.cpp:1: /usr/local/include/boost-1.45.0/boost/interprocess/mem_algo/rbtree_best_fit.hpp:321: warning: enumeral and non-enumeral type in conditional expression 1.cpp: In function 'int main()': 1.cpp:5: warning: unused variable 'mem' </pre> Ticket Marshall Clow Tue, 01 Feb 2011 17:40:39 GMT attachment set https://svn.boost.org/trac10/ticket/4297 https://svn.boost.org/trac10/ticket/4297 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">mtc-4297.patch</span> </li> </ul> Ticket Marshall Clow Tue, 01 Feb 2011 17:41:03 GMT <link>https://svn.boost.org/trac10/ticket/4297#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4297#comment:4</guid> <description> <p> Here's a patch that silences this warning. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Fri, 01 Apr 2011 18:52:20 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4297#comment:5 https://svn.boost.org/trac10/ticket/4297#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed in Boost 1.47 </p> Ticket anonymous Mon, 18 Jul 2011 13:07:23 GMT <link>https://svn.boost.org/trac10/ticket/4297#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4297#comment:6</guid> <description> <p> i have installed Boost 1.47 right in this moment and it seems like this warning is still persistent... </p> </description> <category>Ticket</category> </item> <item> <author>Lénaïc Huard <lhuard@…></author> <pubDate>Wed, 12 Oct 2011 10:05:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4297#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4297#comment:7</guid> <description> <p> Indeed, I confirm that the warning is still present with Boost 1.47. </p> <p> The clean way to fix it is definitely to replace all the enums in metafunctions by the usage of BOOST_STATIC_CONSTANT as recommended in the <a href="http://www.boost.org/development/int_const_guidelines.html">Coding Guidelines for Integral Constant Expressions</a> page and as I proposed in <a class="ext-link" href="https://svn.boost.org/trac/boost/attachment/ticket/4297/boost_interprocess_2.patch"><span class="icon">​</span>boost_interprocess_2.patch</a>. </p> <p> But as far as I can see, my patch has still not been applied in Boost 1.47. </p> <p> Ex: <a class="ext-link" href="http://svn.boost.org/svn/boost/tags/release/Boost_1_47_0/boost/interprocess/detail/type_traits.hpp"><span class="icon">​</span>type_traits.hpp of Boost 1.47</a> </p> <p> There are still enums whereas I replaced them by BOOST_STATIC_CONSTANT in <a class="ext-link" href="https://svn.boost.org/trac/boost/attachment/ticket/4297/boost_interprocess_2.patch"><span class="icon">​</span>boost_interprocess_2.patch</a>. </p> </description> <category>Ticket</category> </item> <item> <author>Lénaïc Huard <lhuard@…></author> <pubDate>Wed, 12 Oct 2011 12:21:21 GMT</pubDate> <title>status, milestone changed; resolution deleted https://svn.boost.org/trac10/ticket/4297#comment:8 https://svn.boost.org/trac10/ticket/4297#comment:8 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.45.0</span> → <span class="trac-field-new">Boost 1.48.0</span> </li> </ul> <p> As mentioned above, the warning is still present. The provided patch has not been applied. </p> Ticket anonymous Sat, 03 Dec 2011 13:30:55 GMT <link>https://svn.boost.org/trac10/ticket/4297#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4297#comment:9</guid> <description> <p> this is an incredibly, massively annoying bug. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Sat, 24 Dec 2011 11:00:46 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4297#comment:10 https://svn.boost.org/trac10/ticket/4297#comment:10 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed in trunk, replaced all enum uses with static const values. </p> Ticket