This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Marking of functions with attributes like __wur
- From: Andreas Jaeger <aj at suse dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 11 Apr 2012 21:00:00 +0200
- Subject: Marking of functions with attributes like __wur
__wur ( "warn unused result") is a function attribute that warns - if
enabled - that the compiler should warn if the return value of the
function is not checked.
We do have a couple of these attributes and as Roland suggested in his
email with subject "Re: BZ #11959: stdio.h: remove fwrite's __wur
attribute", we should document the usage.
The GCC manual descriping the attribute says:
"This is useful for functions where not checking the result is either a
security problem or always a bug such as realloc"
I think that's good start. I would enhance it with:
This flag might not be set if the check for failure can be done in other
ways, e.g. the return value of fwrite can be check with ferror as well.
What do you think?
What's the best place to document when to use the attribute? A place in
the wiki called Attributes?
Andreas
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126