This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/25509] can't voidify __attribute__((warn_unused_result))
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Dec 2005 13:04:32 -0000
- Subject: [Bug c/25509] can't voidify __attribute__((warn_unused_result))
- References: <bug-25509-3563@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #12 from joseph at codesourcery dot com 2005-12-21 13:04 -------
Subject: Re: can't voidify __attribute__((warn_unused_result))
On Wed, 21 Dec 2005, mueller at kde dot org wrote:
> ok, lets assume that you meant with "can not be ignored" actually "must not be
> ignored". now thats where the definitions in RFC2119 kick in:
The documentation isn't written in terms of RFC2119.
> The documentation correctly states SHOULD NOT, and thats distinctively
> different from MUST NOT.
It says "should never", not "should not".
For the sort of functions this is intended for, if you really want to
ignore the return value then you should probably have a conditional and a
??? comment in every place you do so. Not simply a cast to void which as
the manual notes is visual noise.
if (error_return()) {
/* ??? For reason X we can't handle this error sensibly. */
abort();
}
(I wouldn't recommend omitting the abort there; the comment would need a
more detailed justification of why in the particular case it's safe to
carry on if the abort is omitted.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509