RFR: 8263718: unused-result warning happens at os_linux.cpp
Yasumasa Suenaga
ysuenaga at openjdk.java.net
Wed Mar 17 09:29:08 UTC 2021
On Wed, 17 Mar 2021 06:31:28 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
> I tried to build OpenJDK with g++-10.2.1_pre1-r3 on Alpine Linux 3.13.2, but I saw following warning:
>
>
> 668 | alloca(((pid ^ counter++) & 7) * 128);
> | ^
> cc1plus: all warnings being treated as errors
> First I have to wonder whether that alloca actually serves any useful
> purpose in this day and age? I wonder what was used to measure the
> performance difference... I'll see what I can find out.
I also thought we can remove it, but I could not find any reason to do so.
> But second, will doing:
>
> void* padding = alloca(...);
>
> not suffice to suppress the warning, or will the compiler then complain
> about "padding" being unused?
>
> The pragma no doubt works, but is a bit ugly. :)
Yes, the warning was gone with `void* padding =`, but I don't want to do so because GCC has [-Wunused-variable](https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html). GCC might report the warning in future.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3042
More information about the hotspot-dev
mailing list