Boost C++ Libraries: Ticket #5668: epoll_reactor implicit type conversion warnings: https://svn.boost.org/trac10/ticket/5668 <p> I'm using boost 1.46.1 with gcc 4.1.2-44-rhel5 and -Wconversion and I get the following warnings (which are a problem as soon as I turn on -Werror): </p> <p> boost/asio/detail/impl/epoll_reactor.ipp: In constructor 'boost::asio::detail::epoll_reactor::epoll_reactor(boost::asio::io_service&amp;)': boost/asio/detail/impl/epoll_reactor.ipp:53: warning: negative integer implicitly converted to unsigned type boost/asio/detail/impl/epoll_reactor.ipp: In member function 'int boost::asio::detail::epoll_reactor::register_descriptor(boost::asio::detail::socket_type, boost::asio::detail::epoll_reactor::descriptor_state*&amp;)': boost/asio/detail/impl/epoll_reactor.ipp:109: warning: negative integer implicitly converted to unsigned type boost/asio/detail/impl/epoll_reactor.ipp: In member function 'void boost::asio::detail::epoll_reactor::start_op(int, boost::asio::detail::socket_type, boost::asio::detail::epoll_reactor::descriptor_state*&amp;, boost::asio::detail::reactor_op*, bool)': boost/asio/detail/impl/epoll_reactor.ipp:154: warning: negative integer implicitly converted to unsigned type boost/asio/detail/impl/epoll_reactor.ipp: In member function 'void boost::asio::detail::epoll_reactor::interrupt()': boost/asio/detail/impl/epoll_reactor.ipp:319: warning: negative integer implicitly converted to unsigned type </p> <p> In all of these cases, the line in question is of the form: </p> <blockquote> <p> ev.events = EPOLLIN | EPOLLERR | EPOLLET; </p> </blockquote> <p> Specifically, that EPOLLET (1 &lt;&lt; 31), which is unsigned as an int, is included. (For example, line 61 doesn't have the same warning). </p> <p> Could the values here (EPOLLET at a minimum) please be wrapped as uint32_t (the type of ev.events)? (i.e. replacing all instances of EPOLLET with uint32_t(EPOLLET) removes the warning). </p> <p> Thanks! </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5668 Trac 1.4.3 anonymous Tue, 30 Aug 2011 14:47:50 GMT version changed https://svn.boost.org/trac10/ticket/5668#comment:1 https://svn.boost.org/trac10/ticket/5668#comment:1 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.46.1</span> → <span class="trac-field-new">Boost 1.47.0</span> </li> </ul> <p> I have checked, and this is still a problem in boost 1.47.0. Is there any plan to address this? </p> Ticket David Benoit <benoit@…> Fri, 09 Dec 2011 16:54:16 GMT <link>https://svn.boost.org/trac10/ticket/5668#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5668#comment:2</guid> <description> <p> Anyone? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Tue, 29 May 2012 01:35:24 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5668#comment:3 https://svn.boost.org/trac10/ticket/5668#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">wontfix</span> </li> </ul> <p> I am not going to make this change. Asio's use is the approach shown in epoll's man page. Furthermore, -Wconversion is not part of -Wall or -Wextra and it is not feasible (or desirable) to suppress all possible warnings. </p> <p> If you want to propose that these constants be made unsigned then I suggest you raise a ticket against glibc. </p> Ticket anonymous Wed, 04 Jul 2012 15:27:28 GMT <link>https://svn.boost.org/trac10/ticket/5668#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5668#comment:4</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/5668#comment:3" title="Comment 3">chris_kohlhoff</a>: </p> <blockquote class="citation"> <p> I am not going to make this change. Asio's use is the approach shown in epoll's man page. Furthermore, -Wconversion is not part of -Wall or -Wextra and it is not feasible (or desirable) to suppress all possible warnings. </p> </blockquote> <p> I don't think OP implied that -Wconversion was a part of -Wall or -Wextra, merely that specification of -Werror turns all warnings into errors, and thus this warning is an error. Although I agree with you that it is not possible to suppress all warnings, all reasonably expected warnings should be accounted for, but -Wconversion is a legitimate option. In this case the use of the #define-d value of EPOLLET produces a value that is a different sign than the rvalue of the statement. The fact that "events" member of struct epoll_event is defined as uint32_t suggests that a wrapper such as suggested would be appropriate in assigning the value. </p> <blockquote class="citation"> <p> If you want to propose that these constants be made unsigned then I suggest you raise a ticket against glibc. </p> </blockquote> <p> Until and unless glibc starts defining these as variables with real types, this isn't going to happen. The responsibility thus lies with the library/application developer to use it appropriately. </p> <p> In this case, it is true that the man page for epoll suggests the use as you have it, but man pages are not definitive sources of all usage, merely examples. </p> <p> I find it unfortunate that you are unwilling to accept this as a bug. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Thu, 05 Jul 2012 01:31:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5668#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5668#comment:5</guid> <description> <p> I have no idea what you mean about "real types", since integer constants can be unsigned. The glibc maintainers evidently agree and a fix was applied late last year to make the constant unsigned: </p> <p> <a class="ext-link" href="http://sourceware.org/bugzilla/show_bug.cgi?id=13538"><span class="icon">​</span>http://sourceware.org/bugzilla/show_bug.cgi?id=13538</a> </p> </description> <category>Ticket</category> </item> <item> <author>benoit@…</author> <pubDate>Thu, 05 Jul 2012 01:38:08 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5668#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5668#comment:6</guid> <description> <p> Thanks Chris! I'll see if the tools guys are more willing to get up to date on glibc than they are on removing -Wconversion. </p> </description> <category>Ticket</category> </item> </channel> </rss>