Patch to Add -Wunused-returns

David E. Weekly dweekly@legato.com
Thu Dec 6 23:32:00 GMT 2001


Fergus,

Thanks for your comments!

>>>
I don't see what the point of the second `if' is.  Surely the same
warning should be issued for calls via function pointers as is issued for
ordinary calls.
<<<

Good point. And I like your idea of printing the function name, too. Shall I
use this code?

>>>
I'm not sure that close() is a good example here, since checking the
return value from close() for files opened in output mode is very
important, and it would be bad to encourage people to omit that.
<<<

Very fair. How about "strcpy()" as another example of where most people
usually (and rightfully) cast away the return value?

-d




More information about the Gcc mailing list