Boost C++ Libraries: Ticket #2498: #including boost/test/included/unit_test.hpp causes "POLL_ERR is not defined" error when compiling for Linux https://svn.boost.org/trac10/ticket/2498 <p> This happens on boost 1_37_0. </p> <p> When compiling this simple program: </p> <p> #include &lt;boost/test/included/unit_test.hpp&gt; </p> <p> gives these errors when compiled with "gcc -W -Wall -Wundef" </p> <p> In file included from /home/andyc/work/3rdParty/boost_1_37_0/boost/test/included/unit_test.hpp:22, </p> <blockquote> <p> from test.cpp:1: </p> </blockquote> <p> /home/andyc/work/3rdParty/boost_1_37_0/boost/test/impl/execution_monitor.ipp:480:48: warning: "POLL_ERR" is not defined /home/andyc/work/3rdParty/boost_1_37_0/boost/test/impl/execution_monitor.ipp:480:59: warning: "POLL_HUP" is not defined In file included from /home/andyc/work/3rdParty/boost_1_37_0/boost/test/output/compiler_log_formatter.hpp:20, </p> <blockquote> <p> from /home/andyc/work/3rdParty/boost_1_37_0/boost/test/impl/compiler_log_formatter.ipp:19, from /home/andyc/work/3rdParty/boost_1_37_0/boost/test/included/unit_test.hpp:18, from test.cpp:1: </p> </blockquote> <p> /home/andyc/work/3rdParty/boost_1_37_0/boost/test/utils/basic_cstring/basic_cstring.hpp: In instantiation of ?boost::unit_test::basic_cstring&lt;const char&gt;?: /home/andyc/work/3rdParty/boost_1_37_0/boost/test/unit_test_log_formatter.hpp:63: instantiated from here /home/andyc/work/3rdParty/boost_1_37_0/boost/test/utils/basic_cstring/basic_cstring.hpp:209: warning: type qualifiers ignored on function return type /home/andyc/work/3rdParty/boost_1_37_0/boost/test/utils/basic_cstring/basic_cstring.hpp:218: warning: type qualifiers ignored on function return type In file included from /home/andyc/work/3rdParty/boost_1_37_0/boost/test/included/unit_test.hpp:22, </p> <blockquote> <p> from test.cpp:1: </p> </blockquote> <p> /home/andyc/work/3rdParty/boost_1_37_0/boost/test/impl/execution_monitor.ipp: In destructor ?boost::detail::signal_handler::~signal_handler()?: /home/andyc/work/3rdParty/boost_1_37_0/boost/test/impl/execution_monitor.ipp:678: warning: missing initializer for member ?sigaltstack::ss_sp? /home/andyc/work/3rdParty/boost_1_37_0/boost/test/impl/execution_monitor.ipp:678: warning: missing initializer for member ?sigaltstack::ss_flags? /home/andyc/work/3rdParty/boost_1_37_0/boost/test/impl/execution_monitor.ipp:678: warning: missing initializer for member ?sigaltstack::ss_size? In file included from /home/andyc/work/3rdParty/boost_1_37_0/boost/test/included/unit_test.hpp:31, </p> <blockquote> <p> from test.cpp:1: </p> </blockquote> <p> /home/andyc/work/3rdParty/boost_1_37_0/boost/test/utils/basic_cstring/basic_cstring.hpp: In constructor ?boost::unit_test::test_case_filter::single_filter::single_filter(boost::unit_test::const_string)?: /home/andyc/work/3rdParty/boost_1_37_0/boost/test/utils/basic_cstring/basic_cstring.hpp:686: warning: type qualifiers ignored on function return type /home/andyc/work/3rdParty/boost_1_37_0/boost/test/utils/basic_cstring/basic_cstring.hpp:701: warning: type qualifiers ignored on function return type </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2498 Trac 1.4.3 ANDREW CHITTENDEN <andyc@…> Fri, 14 Nov 2008 15:16:38 GMT attachment set https://svn.boost.org/trac10/ticket/2498 https://svn.boost.org/trac10/ticket/2498 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">2498.patch</span> </li> </ul> <p> attached patch clears up the error. </p> Ticket Marshall Clow Tue, 18 Nov 2008 00:58:08 GMT component changed; owner set https://svn.boost.org/trac10/ticket/2498#comment:1 https://svn.boost.org/trac10/ticket/2498#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Gennadiy Rozental</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">test</span> </li> </ul> Ticket Gennadiy Rozental Fri, 21 Nov 2008 23:41:04 GMT <link>https://svn.boost.org/trac10/ticket/2498#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2498#comment:2</guid> <description> <p> what the OS/compiler </p> </description> <category>Ticket</category> </item> <item> <author>ANDREW CHITTENDEN <andyc@…></author> <pubDate>Mon, 24 Nov 2008 08:50:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2498#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2498#comment:3</guid> <description> <blockquote class="citation"> <p> what the OS ... </p> </blockquote> <p> Linux (as per subject of the bug). In particular, this is a debian system running 2.6.26 with glibc 2.7. </p> <blockquote class="citation"> <p> compiler </p> </blockquote> <p> gcc 4.3.2. </p> <p> NB as I said initially, this happens on boost 1_37_0 - that wasn't available on the pull down when I submitted the bug. I don't know whether it happens on 1_36_0. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gennadiy Rozental</dc:creator> <pubDate>Sun, 14 Jun 2009 10:50:03 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/2498#comment:4 https://svn.boost.org/trac10/ticket/2498#comment:4 <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">worksforme</span> </li> </ul> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/2498#comment:3" title="Comment 3">ANDREW CHITTENDEN &lt;andyc@bluearc.com&gt;</a>: </p> <blockquote class="citation"> <blockquote class="citation"> <p> what the OS ... </p> </blockquote> <p> Linux (as per subject of the bug). In particular, this is a debian system running 2.6.26 with glibc 2.7. </p> <blockquote class="citation"> <p> compiler </p> </blockquote> <p> gcc 4.3.2. </p> </blockquote> <p> I've tried to replicate the issue on debian vmware image with this parameters: </p> <p> rogeeff@debian:~/boost/libs/test/example$ uname -a Linux debian 2.6.8-2-386 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1" title="#1: Bugs: boost.build causes ftjam to segfault (closed: Wont Fix)">#1</a> Thu May 19 17:40:50 JST 2005 i686 GNU/Linux </p> <p> gcc version 4.3.2 (Debian 4.3.2-1.1) </p> <p> and it works fine. </p> <p> Please let me know how to reproduce it and reopen the ticket </p> Ticket Gennadiy Rozental Sun, 14 Jun 2009 10:51:18 GMT <link>https://svn.boost.org/trac10/ticket/2498#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2498#comment:5</guid> <description> <p> P.S. I was using trunk </p> </description> <category>Ticket</category> </item> <item> <author>Ivo Raisr <ivosh@…></author> <pubDate>Mon, 21 Nov 2011 12:49:39 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2498#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2498#comment:6</guid> <description> <p> Hi guys, I have encountered the same problem with boost 1.47.0. My platform is RHEL/CentOS 5.6 with glibc 2.5 and gcc 4.1.2, using -Wundef -Werror. </p> <p> The problem is still there and lies in fact that POLL_ERR and POLL_HUP are declared in system header file "/usr/include/bits/siginfo.h" as follows: </p> <pre class="wiki">enum { POLL_IN = 1, [....] POLL_ERR, /* I/O error. */ # define POLL_ERR POLL_ERR POLL_PRI, /* High priority input available. */ # define POLL_PRI POLL_PRI POLL_HUP /* Device disconnected. */ # define POLL_HUP POLL_HUP }; </pre><p> Please notice that POLL_ERR, POLL_HUP are <strong>both</strong> #define's and enum values! </p> <p> Therefore before preprocessor runs, the line says: </p> <pre class="wiki">#if defined(POLL_ERR) &amp;&amp; defined(POLL_HUP) &amp;&amp; (POLL_ERR - POLL_HUP) </pre><p> Now, POLL_ERR is #define'd, POLL_HUP as well. After preprocessor replaces them, the line says: </p> <pre class="wiki">#if (POLL_ERR - POLL_HUP) </pre><p> But POLL_ERR and POLL_HUP are now enum values, ready to be understood by the compiler, not preprocessor. It is not surprise that preprocessor cannot substract these two enum values because it does not understand them. </p> <p> Therefore I conculde this construct is weird and cannot work on any platform which: </p> <ul><li>has the same name for both #define and enum value </li><li>has the same value for both (as this would interfere with the 'default' case of the switch) </li></ul><p> Please fix this problem, for example in terms of the original submitted patch. The test program remains the same: </p> <pre class="wiki">#define BOOST_TEST_MODULE AnyTest #include &lt;boost/test/included/unit_test.hpp&gt; </pre><p> Should you need more information, just ping me. Ivo Raisr </p> </description> <category>Ticket</category> </item> </channel> </rss>