aboutsummaryrefslogtreecommitdiff
path: root/sim/common/callback.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-04-22 12:07:14 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-04-22 12:07:14 -0400
commit2f63213381e3b073f169ee776043486b44ea2e68 (patch)
tree55947613d8a4dc4a2262758c5ae053b950e7f0e1 /sim/common/callback.c
parent4efeb0d3e8ee210cd61b15355cca39b16b66004d (diff)
downloadgdb-2f63213381e3b073f169ee776043486b44ea2e68.zip
gdb-2f63213381e3b073f169ee776043486b44ea2e68.tar.gz
gdb-2f63213381e3b073f169ee776043486b44ea2e68.tar.bz2
sim: sprinkle some ATTRIBUTE_PRINTF
Add some ATTRIBUTE_PRINTF attributes to functions that take a format string, to fix a few -Wformat-nonliteral warnings. Use the ATTRIBUTE_PRINTF macro like we use in GDB, instead of spelling out __attribute__((format...)). Use ATTRIBUTE_NULL_PRINTF at one place, because callers expect to be able to pass NULL. sim/common/ChangeLog: * callback.c (os_printf_filtered, os_vprintf_filtered, os_evprintf_filtered, os_error): Use ATTRIBUTE_PRINTF. * sim-engine.h (sim_engine_abort, sim_engine_vabort): Likewise. * sim-events.h (sim_events_schedule_tracef, sim_events_schedule_vtracef): Use ATTRIBUTE_NULL_PRINTF. Change-Id: Icd206f7b2c325e8b144f72eb129fb2a6b5af2fa3
Diffstat (limited to 'sim/common/callback.c')
-rw-r--r--sim/common/callback.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sim/common/callback.c b/sim/common/callback.c
index f9e848f..2fec270 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -639,7 +639,7 @@ os_init (host_callback *p)
/* DEPRECATED */
/* VARARGS */
-static void
+static void ATTRIBUTE_PRINTF (2, 3)
os_printf_filtered (host_callback *p ATTRIBUTE_UNUSED, const char *format, ...)
{
va_list args;
@@ -650,14 +650,14 @@ os_printf_filtered (host_callback *p ATTRIBUTE_UNUSED, const char *format, ...)
}
/* VARARGS */
-static void
+static void ATTRIBUTE_PRINTF (2, 0)
os_vprintf_filtered (host_callback *p ATTRIBUTE_UNUSED, const char *format, va_list args)
{
vprintf (format, args);
}
/* VARARGS */
-static void
+static void ATTRIBUTE_PRINTF (2, 0)
os_evprintf_filtered (host_callback *p ATTRIBUTE_UNUSED, const char *format, va_list args)
{
vfprintf (stderr, format, args);
@@ -667,7 +667,7 @@ os_evprintf_filtered (host_callback *p ATTRIBUTE_UNUSED, const char *format, va_
#ifdef __GNUC__
__attribute__ ((__noreturn__))
#endif
-static void
+static void ATTRIBUTE_PRINTF (2, 3)
os_error (host_callback *p ATTRIBUTE_UNUSED, const char *format, ...)
{
va_list args;