sim: Suppress non-literal printf warning
authorTsukasa OI <research_trasio@irq.a4lg.com>
Thu, 6 Oct 2022 06:43:51 +0000 (06:43 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Tue, 11 Oct 2022 14:18:14 +0000 (15:18 +0100)
commit96894c19ad2b91db76b9b606d48c56ad354b4801
tree06ec6e55b3d9f2fff45fd33b909b8221e5dbd867
parent25ae9e265976b45897865d14ed454ec3c937bd78
sim: Suppress non-literal printf warning

Clang generates a warning if the format string of a printf-like function is
not a literal ("-Wformat-nonliteral"). On the default configuration, it
causes a build failure (unless "--disable-werror" is specified).

To avoid this warning, this commit now uses vsnprintf to format error
message and pass the message to sim_engine_abort function with another
printf-style formatting.

This patch is mostly authored by Andrew Burgess and slightly modified by
Tsukasa OI.

Co-authored-by: Andrew Burgess <aburgess@redhat.com>
Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com>
sim/common/hw-device.h
sim/common/sim-hw.c