RFR: 8263718: unused-result warning happens at os_linux.cpp

David Holmes david.holmes at oracle.com
Wed Mar 17 09:02:05 UTC 2021


Hi Yasumasa,

On 17/03/2021 6:37 pm, Yasumasa Suenaga 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.

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. :)

Thanks,
David

> -------------
> 
> Commit messages:
>   - 8263718: unused-result warning happens at os_linux.cpp
> 
> Changes: https://git.openjdk.java.net/jdk/pull/3042/files
>   Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3042&range=00
>    Issue: https://bugs.openjdk.java.net/browse/JDK-8263718
>    Stats: 11 lines in 3 files changed: 9 ins; 0 del; 2 mod
>    Patch: https://git.openjdk.java.net/jdk/pull/3042.diff
>    Fetch: git fetch https://git.openjdk.java.net/jdk pull/3042/head:pull/3042
> 
> PR: https://git.openjdk.java.net/jdk/pull/3042
> 


More information about the hotspot-dev mailing list