Skip to content

Commit 439ed04

Browse files
author
Hao Sun
committed
8319233: AArch64: Build failure with clang due to -Wformat-nonliteral warning
Reviewed-by: kbarrett, eastigeevich
1 parent e4803e0 commit 439ed04

File tree

7 files changed

+18
-22
lines changed

7 files changed

+18
-22
lines changed

src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
331331

332332
// End life with a fatal error, message and detail message and the context.
333333
// Note: no need to do any post-processing here (e.g. signal chaining)
334-
va_list va_dummy = nullptr;
335-
VMError::report_and_die(thread, uc, nullptr, 0, msg, detail_msg, va_dummy);
336-
va_end(va_dummy);
334+
VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
337335

338336
ShouldNotReachHere();
339337
}

src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,6 @@ NOINLINE frame os::current_frame() {
193193
}
194194
}
195195

196-
ATTRIBUTE_PRINTF(6, 7)
197-
static void report_and_die(Thread* thread, void* context, const char* filename, int lineno, const char* message,
198-
const char* detail_fmt, ...) {
199-
va_list va;
200-
va_start(va, detail_fmt);
201-
VMError::report_and_die(thread, context, filename, lineno, message, detail_fmt, va);
202-
va_end(va);
203-
}
204-
205196
bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
206197
ucontext_t* uc, JavaThread* thread) {
207198
// 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,
288279

289280
// End life with a fatal error, message and detail message and the context.
290281
// Note: no need to do any post-processing here (e.g. signal chaining)
291-
report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
282+
VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
292283
ShouldNotReachHere();
293284

294285
} else if (sig == SIGFPE &&

src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
262262

263263
// End life with a fatal error, message and detail message and the context.
264264
// Note: no need to do any post-processing here (e.g. signal chaining)
265-
va_list va_dummy;
266-
VMError::report_and_die(thread, uc, nullptr, 0, msg, detail_msg, va_dummy);
267-
va_end(va_dummy);
265+
VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
268266

269267
ShouldNotReachHere();
270268

src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
345345

346346
// End life with a fatal error, message and detail message and the context.
347347
// Note: no need to do any post-processing here (e.g. signal chaining)
348-
va_list va_dummy;
349-
VMError::report_and_die(thread, uc, nullptr, 0, msg, detail_msg, va_dummy);
350-
va_end(va_dummy);
348+
VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
351349

352350
ShouldNotReachHere();
353351

src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
251251

252252
// End life with a fatal error, message and detail message and the context.
253253
// Note: no need to do any post-processing here (e.g. signal chaining)
254-
va_list va_dummy;
255-
VMError::report_and_die(thread, uc, nullptr, 0, msg, detail_msg, va_dummy);
256-
va_end(va_dummy);
254+
VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
257255

258256
ShouldNotReachHere();
259257
} else if (sig == SIGFPE &&

src/hotspot/share/utilities/vmError.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,14 @@ void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void*
15791579
va_end(detail_args);
15801580
}
15811581

1582+
void VMError::report_and_die(Thread* thread, void* context, const char* filename, int lineno, const char* message,
1583+
const char* detail_fmt, ...) {
1584+
va_list detail_args;
1585+
va_start(detail_args, detail_fmt);
1586+
report_and_die(thread, context, filename, lineno, message, detail_fmt, detail_args);
1587+
va_end(detail_args);
1588+
}
1589+
15821590
void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context)
15831591
{
15841592
report_and_die(thread, sig, pc, siginfo, context, "%s", "");

src/hotspot/share/utilities/vmError.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ class VMError : public AllStatic {
169169
static void report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo,
170170
void* context, const char* detail_fmt, ...);
171171

172+
ATTRIBUTE_NORETURN
173+
ATTRIBUTE_PRINTF(6, 7)
174+
static void report_and_die(Thread* thread, void* context, const char* filename, int lineno, const char* message,
175+
const char* detail_fmt, ...);
176+
172177
ATTRIBUTE_NORETURN
173178
ATTRIBUTE_PRINTF(3, 0)
174179
static void report_and_die(int id, const char* message, const char* detail_fmt, va_list detail_args,

0 commit comments

Comments
 (0)