RFR: 8339364: AIX build fails: various unused variable and function warnings [v2]
David Holmes
dholmes at openjdk.org
Tue Sep 3 06:18:18 UTC 2024
On Tue, 3 Sep 2024 05:52:31 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:
>> This code is devoid of pretty much all error handling and logging, but I agree that a simple fprintf on error would be useful.
>> Also doesn't a call like this trigger the warning about ignoring a function result, or have we disabled that one?
>
>> Also doesn't a call like this trigger the warning about ignoring a function result, or have we disabled that one?
>
> Such a warning would be horrible to have enable. Then you would have to read the value of every function that thought it should return a value, even if it was just intended as some additional information that perhaps not everyone wanted to use. (And then you could not just store it into a variable and ignore it, since that would trigger the "unused variable" warning! ;-))
>
> I know IntelliJ can provide warnings when ignoring the return value of a few select JDK methods that are often used incorrectly, but then they had to annotate these specially. I don't know if there is any similar kind of annotation for clang/gcc that can warn about ignoring return values that really, really shouldn't be ignored, but I'd guess not.
At one stage we started using the idiom:
(void) someFunc();
to tell the compiler to not warn about the unused result. IIRC that stopped working.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20812#discussion_r1741484485
More information about the build-dev
mailing list