warn_unused_result attribute ignoring

Timo Sirainen tss@iki.fi
Sun Nov 12 21:08:00 GMT 2006


If I understood correctly, newer glibcs have added warn_unused_result
attribute to several functions when compiling with -D_FORTIFY_SOURCE=2.

I think this is a good idea in general, except there are some cases
where I really don't care if the call succeeds or not. Traditionally
it's been possible to use

(void)chdir("/blah");

to disable such warnings in lint, but this doesn't work with gcc. How
about adding support for it?

Of course I could just as well do

if (chdir("/blah") < 0) ;

but that's kind of ugly and not self-explanatory.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20061112/8ec90cdf/attachment.sig>


More information about the Gcc mailing list