I'd like to use the -Wunused-result
option in GCC to detect unused/ignored return values in my code. But this requires marking the function declarations either with an attribute, or with attribute specifier sequence.
Doing this by hand could be very time consuming and error-prone. I was wondering if there is a way to tell GCC to set attributes for all functions (or set a default attribute), so that I could use the warning flag.
This looks like a job for a GCC plugin. Upstream might also accept a patch which sets the attribute for all subsequent functions using a pragma, but the exact semantics are probably quite tricky for C++.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With