According to the clang docs I am seeing that warn on unused result should be enabled by default. But, it doesn't seem to work unless I use the function __attribute__((warn_unused_result))
.
Example:
int foo(void);
doesn't trigger an unused result warning but:
int foo(void) __attribute__((warn_unused_result));
does trigger the unused result warning, all else being equal.
Is there a way to enable unused result warnings globally for all functions which return a value?