From 67dfdfa6ea829fcd1ecac0df8211b591ad15f859 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Mon, 3 Mar 2025 15:53:47 +0000 Subject: [PATCH] 8350623: Fix -Wzero-as-null-pointer-constant warnings in nsk native test utilities Reviewed-by: coleenp --- .../jtreg/vmTestbase/nsk/share/native/native_thread.cpp | 6 +++++- test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp index 089aab78bb5..1929864e0d0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -98,7 +98,11 @@ void* procedure(void* t) { thread->started = 1; thread->status = thread->procedure(thread->context); thread->finished = 1; +#ifdef windows return 0; +#else // !windows + return nullptr; +#endif } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp index 736ddafdfaf..3da3858445b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -109,7 +109,7 @@ int nsk_list_remove(const void *plist, int ind) { list_info->arr[i - 1] = list_info->arr[i]; } } - list_info->arr[--list_info->elements_count] = 0; + list_info->arr[--list_info->elements_count] = nullptr; return NSK_TRUE; }