[Boost-bugs] [Boost C++ Libraries] #2534: Removing gcc warning

Subject: [Boost-bugs] [Boost C++ Libraries] #2534: Removing gcc warning
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-11-25 14:11:41


#2534: Removing gcc warning
-----------------------------------+----------------------------------------
 Reporter: richard_at_[hidden] | Owner: chris_kohlhoff
     Type: Bugs | Status: new
Milestone: Boost 1.38.0 | Component: asio
  Version: Boost 1.37.0 | Severity: Problem
 Keywords: |
-----------------------------------+----------------------------------------
 The function

   boost::asio::detail::pipe_select_interrupter::interupt()

 in <boost/asio/detail/pipe_select_interrupter.hpp> produces the following
 warning in gcc 4.3.2 / glibc 2.8 when compiled with -O1 or higher. The
 warning occurs even without any -W options.

   ./boost/asio/detail/pipe_select_interrupter.hpp:75:
     warning: ignoring return value of ‘ssize_t write(int,
     const void*, size_t)’, declared with attribute
     warn_unused_result

 As the message implies, gcc issues this warning whenever a function
 declared with __attribute__((warn_unused_result)); it appears that gcc
 implicitly places this attribute on ::write as the glibc header doesn't
 contain it.
 A short test case is:

   #include <unistd.h>
   int main() { ::write(1, 0, 0); }

 To suppress the warning, the function interupt() function can be altered
 as follows:

   #include <boost/concept_check.hpp>

   void interrupt()
   {
     char byte = 0;
     ignore_unused_variable_warning( ::write(write_descriptor_, &byte, 1)
 );
   }

 Is there any chance of making a change along these lines?

 Apologies if this is a know issue: a quick search of the mailing list
 didn't turn anything up.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2534>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC