8338330: Fix -Wzero-as-null-pointer-constant warnings from THROW_XXX_0

Reviewed-by: dlong, dholmes, shade
This commit is contained in:
Kim Barrett 2024-08-15 17:43:09 +00:00
parent f308b2d596
commit 965508270e
3 changed files with 14 additions and 11 deletions

View File

@ -3403,7 +3403,7 @@ JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name, jboolean throwExceptio
vmSymbols::java_lang_UnsatisfiedLinkError(),
msg, Exceptions::unsafe_to_utf8);
THROW_HANDLE_0(h_exception);
THROW_HANDLE_NULL(h_exception);
} else {
log_info(library)("Failed to load library %s", name);
return load_result;

View File

@ -1004,9 +1004,9 @@ static oop invoke(InstanceKlass* klass,
// JVMTI internal flag reset is needed in order to report InvocationTargetException
JvmtiExport::clear_detected_exception(THREAD);
JavaCallArguments args(Handle(THREAD, resolution_exception));
THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
vmSymbols::throwable_void_signature(),
&args);
THROW_ARG_NULL(vmSymbols::java_lang_reflect_InvocationTargetException(),
vmSymbols::throwable_void_signature(),
&args);
}
} else {
// if the method can be overridden, we resolve using the vtable index.
@ -1028,9 +1028,9 @@ static oop invoke(InstanceKlass* klass,
Handle h_origexception = Exceptions::new_exception(THREAD,
vmSymbols::java_lang_AbstractMethodError(), ss.as_string());
JavaCallArguments args(h_origexception);
THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
vmSymbols::throwable_void_signature(),
&args);
THROW_ARG_NULL(vmSymbols::java_lang_reflect_InvocationTargetException(),
vmSymbols::throwable_void_signature(),
&args);
}
}
}
@ -1117,9 +1117,9 @@ static oop invoke(InstanceKlass* klass,
JvmtiExport::clear_detected_exception(THREAD);
JavaCallArguments args(Handle(THREAD, target_exception));
THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
vmSymbols::throwable_void_signature(),
&args);
THROW_ARG_NULL(vmSymbols::java_lang_reflect_InvocationTargetException(),
vmSymbols::throwable_void_signature(),
&args);
} else {
if (rtype == T_BOOLEAN || rtype == T_BYTE || rtype == T_CHAR || rtype == T_SHORT) {
narrow((jvalue*)result.get_value_addr(), rtype, CHECK_NULL);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, 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
@ -311,6 +311,9 @@ class Exceptions {
#define THROW_NULL(name) THROW_(name, nullptr)
#define THROW_MSG_NULL(name, message) THROW_MSG_(name, message, nullptr)
#define THROW_HANDLE_NULL(e) THROW_HANDLE_(e, nullptr)
#define THROW_ARG_NULL(name, signature, arg) THROW_ARG_(name, signature, arg, nullptr)
// The CATCH macro checks that no exception has been thrown by a function; it is used at
// call sites about which is statically known that the callee cannot throw an exception
// even though it is declared with TRAPS.