Bug 16976 - Warn on unused function return values
Summary: Warn on unused function return values
Status: VERIFIED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: unknown
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-11 00:08 UTC by Martin Pool
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Pool 2004-08-11 00:08:38 UTC
I'd like a warning option to warn when non-void function return values are
unused.  gcc now has an attribute to require this for particular functions.  Why
not a global switch?

Obviously this will give a lot of warnings on existing code, but I think it may
be useful in some cases.  There is already a pattern (from lint?) of casting to
void values that are unused.  Making this explicit may be useful in avoiding
missed error returns, etc.
Comment 1 Andrew Pinski 2004-08-11 00:33:08 UTC
Will not happen, read the documention and also the patch which added the attribute.
Comment 2 Martin Pool 2004-08-11 01:05:08 UTC
OK.

In case anyone else looks for this, it's mentioned in the "non-bugs" section:

http://gcc.gnu.org/onlinedocs/gcc/Non_002dbugs.html

It doesn't seem to be mentioned in the warn_unused_result patch or the thread
about it.