8375738: Fix -Wzero-as-null-pointer-constant warnings in MacOSX/bsd code

Reviewed-by: erikj, dholmes
This commit is contained in:
Kim Barrett 2026-01-21 06:04:09 +00:00
parent 34d6e5e07b
commit b5727d2762
3 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -61,7 +61,8 @@ $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBGTEST, \
INCLUDE_FILES := gtest-all.cc gmock-all.cc, \ INCLUDE_FILES := gtest-all.cc gmock-all.cc, \
DISABLED_WARNINGS_gcc := format-nonliteral maybe-uninitialized undef \ DISABLED_WARNINGS_gcc := format-nonliteral maybe-uninitialized undef \
unused-result zero-as-null-pointer-constant, \ unused-result zero-as-null-pointer-constant, \
DISABLED_WARNINGS_clang := format-nonliteral undef unused-result, \ DISABLED_WARNINGS_clang := format-nonliteral undef unused-result \
zero-as-null-pointer-constant, \
DISABLED_WARNINGS_microsoft := 4530, \ DISABLED_WARNINGS_microsoft := 4530, \
DEFAULT_CFLAGS := false, \ DEFAULT_CFLAGS := false, \
CFLAGS := $(JVM_CFLAGS) \ CFLAGS := $(JVM_CFLAGS) \

View File

@ -132,7 +132,7 @@ public:
static const char* tagToStr(uint32_t user_tag) { static const char* tagToStr(uint32_t user_tag) {
switch (user_tag) { switch (user_tag) {
case 0: case 0:
return 0; return nullptr;
X1(MALLOC, malloc); X1(MALLOC, malloc);
X1(MALLOC_SMALL, malloc_small); X1(MALLOC_SMALL, malloc_small);
X1(MALLOC_LARGE, malloc_large); X1(MALLOC_LARGE, malloc_large);

View File

@ -628,7 +628,7 @@ static void *thread_native_entry(Thread *thread) {
log_info(os, thread)("Thread finished (tid: %zu, pthread id: %zu).", log_info(os, thread)("Thread finished (tid: %zu, pthread id: %zu).",
os::current_thread_id(), (uintx) pthread_self()); os::current_thread_id(), (uintx) pthread_self());
return 0; return nullptr;
} }
bool os::create_thread(Thread* thread, ThreadType thr_type, bool os::create_thread(Thread* thread, ThreadType thr_type,
@ -1420,7 +1420,7 @@ int os::get_loaded_modules_info(os::LoadedModulesCallbackFunc callback, void *pa
#elif defined(__APPLE__) #elif defined(__APPLE__)
for (uint32_t i = 1; i < _dyld_image_count(); i++) { for (uint32_t i = 1; i < _dyld_image_count(); i++) {
// Value for top_address is returned as 0 since we don't have any information about module size // Value for top_address is returned as 0 since we don't have any information about module size
if (callback(_dyld_get_image_name(i), (address)_dyld_get_image_header(i), (address)0, param)) { if (callback(_dyld_get_image_name(i), (address)_dyld_get_image_header(i), nullptr, param)) {
return 1; return 1;
} }
} }