For enhancing the public API of glibc, here are a few guidelines.
1. __wur ( "warn unused result") Attribute
GCC warns if a caller of a function marked with attribute "warn_unused_result" does not use its return value.
In glibc, we add this attribute as "__wur" to functions using the following guideline:
This is useful for functions where not checking the result is either a security problem or always a bug. It should be applied where in practice, a warning is far more likely to be a helpful diagnostic than a false alarm.
__realloc: Use the attribute since the return value needs to checked for failure and used as new value.
__fwrite: Do not use the attribute since the return value of fwrite can be checked with ferror as well.