os_thread is not handled by os::create_thread in os_windows.cpp

David Holmes david.holmes at oracle.com
Mon Jul 24 12:05:59 UTC 2023


Hi,

On 24/07/2023 6:15 pm, Julian Waters wrote:
> Hi all,
> 
> I just wanted to give a heads up that gcc catches a case inside 
> os::create_thread in os_windows.cpp, in a switch statement that 
> enumerates over all possible thread types. The warning states that 
> threads of type os_thread are not handled:
> 
> src/hotspot/os/windows/os_windows.cpp: In static member function 'static 
> bool os::create_thread(Thread*, ThreadType, size_t)':
> d:/eclipse/workspace/jdk/src/hotspot/os/windows/os_windows.cpp:715:12: 
> error: enumeration value 'os_thread' not handled in switch [-Werror=switch]
>    715 |     switch (thr_type) {
>           |            ^
> cc1plus.exe: all warnings being treated as errors
> 
> I initially used to silence this warning, but since I don't know how 
> threads of type os_thread should be handled or if this is intentional, 
> I'm raising this to the attention of any HotSpot developers that know 
> about this more than me in case this is a bug.

I didn't even realize it existed - it is only used as the type for the 
JfrThreadSampler thread. I'd say this a bug/oversight. The missing case 
would do nothing anyway.

Cheers,
David

> best regards,
> Julian


More information about the hotspot-dev mailing list