8319233: AArch64: Build failure with clang due to -Wformat-nonliteral warning

Reviewed-by: kbarrett, eastigeevich
This commit is contained in:
Hao Sun 2023-11-07 01:01:37 +00:00
parent e4803e0cbf
commit 439ed046e4
7 changed files with 18 additions and 22 deletions

View File

@ -331,9 +331,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
// End life with a fatal error, message and detail message and the context.
// Note: no need to do any post-processing here (e.g. signal chaining)
va_list va_dummy = nullptr;
VMError::report_and_die(thread, uc, nullptr, 0, msg, detail_msg, va_dummy);
va_end(va_dummy);
VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
ShouldNotReachHere();
}

View File

@ -193,15 +193,6 @@ NOINLINE frame os::current_frame() {
}
}
ATTRIBUTE_PRINTF(6, 7)
static void report_and_die(Thread* thread, void* context, const char* filename, int lineno, const char* message,
const char* detail_fmt, ...) {
va_list va;
va_start(va, detail_fmt);
VMError::report_and_die(thread, context, filename, lineno, message, detail_fmt, va);
va_end(va);
}
bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
ucontext_t* uc, JavaThread* thread) {
// Enable WXWrite: this function is called by the signal handler at arbitrary
@ -288,7 +279,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
// End life with a fatal error, message and detail message and the context.
// Note: no need to do any post-processing here (e.g. signal chaining)
report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
ShouldNotReachHere();
} else if (sig == SIGFPE &&

View File

@ -262,9 +262,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
// End life with a fatal error, message and detail message and the context.
// Note: no need to do any post-processing here (e.g. signal chaining)
va_list va_dummy;
VMError::report_and_die(thread, uc, nullptr, 0, msg, detail_msg, va_dummy);
va_end(va_dummy);
VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
ShouldNotReachHere();

View File

@ -345,9 +345,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
// End life with a fatal error, message and detail message and the context.
// Note: no need to do any post-processing here (e.g. signal chaining)
va_list va_dummy;
VMError::report_and_die(thread, uc, nullptr, 0, msg, detail_msg, va_dummy);
va_end(va_dummy);
VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
ShouldNotReachHere();

View File

@ -251,9 +251,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
// End life with a fatal error, message and detail message and the context.
// Note: no need to do any post-processing here (e.g. signal chaining)
va_list va_dummy;
VMError::report_and_die(thread, uc, nullptr, 0, msg, detail_msg, va_dummy);
va_end(va_dummy);
VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
ShouldNotReachHere();
} else if (sig == SIGFPE &&

View File

@ -1579,6 +1579,14 @@ void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void*
va_end(detail_args);
}
void VMError::report_and_die(Thread* thread, void* context, const char* filename, int lineno, const char* message,
const char* detail_fmt, ...) {
va_list detail_args;
va_start(detail_args, detail_fmt);
report_and_die(thread, context, filename, lineno, message, detail_fmt, detail_args);
va_end(detail_args);
}
void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context)
{
report_and_die(thread, sig, pc, siginfo, context, "%s", "");

View File

@ -169,6 +169,11 @@ public:
static void report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo,
void* context, const char* detail_fmt, ...);
ATTRIBUTE_NORETURN
ATTRIBUTE_PRINTF(6, 7)
static void report_and_die(Thread* thread, void* context, const char* filename, int lineno, const char* message,
const char* detail_fmt, ...);
ATTRIBUTE_NORETURN
ATTRIBUTE_PRINTF(3, 0)
static void report_and_die(int id, const char* message, const char* detail_fmt, va_list detail_args,