Skip to content

Commit 072651a

Browse files
committed
8319233: AArch64: Build failure with clang due to -Wformat-nonliteral warning
Backport-of: 439ed046e451fc41a875993819a6d4335a0efad5
1 parent 4e19a9b commit 072651a

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
@@ -199,15 +199,6 @@ NOINLINE frame os::current_frame() {
199199
}
200200
}
201201

202-
ATTRIBUTE_PRINTF(6, 7)
203-
static void report_and_die(Thread* thread, void* context, const char* filename, int lineno, const char* message,
204-
const char* detail_fmt, ...) {
205-
va_list va;
206-
va_start(va, detail_fmt);
207-
VMError::report_and_die(thread, context, filename, lineno, message, detail_fmt, va);
208-
va_end(va);
209-
}
210-
211202
bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
212203
ucontext_t* uc, JavaThread* thread) {
213204
// Enable WXWrite: this function is called by the signal handler at arbitrary
@@ -294,7 +285,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
294285

295286
// End life with a fatal error, message and detail message and the context.
296287
// Note: no need to do any post-processing here (e.g. signal chaining)
297-
report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
288+
VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
298289
ShouldNotReachHere();
299290

300291
} 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
@@ -351,9 +351,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
351351

352352
// End life with a fatal error, message and detail message and the context.
353353
// Note: no need to do any post-processing here (e.g. signal chaining)
354-
va_list va_dummy;
355-
VMError::report_and_die(thread, uc, nullptr, 0, msg, detail_msg, va_dummy);
356-
va_end(va_dummy);
354+
VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
357355

358356
ShouldNotReachHere();
359357

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
@@ -1576,6 +1576,14 @@ void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void*
15761576
va_end(detail_args);
15771577
}
15781578

1579+
void VMError::report_and_die(Thread* thread, void* context, const char* filename, int lineno, const char* message,
1580+
const char* detail_fmt, ...) {
1581+
va_list detail_args;
1582+
va_start(detail_args, detail_fmt);
1583+
report_and_die(thread, context, filename, lineno, message, detail_fmt, detail_args);
1584+
va_end(detail_args);
1585+
}
1586+
15791587
void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context)
15801588
{
15811589
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)