diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index ace180b685cadaab806a0d6e07722c23c70bc579..6242908d6cd8d7228be8f797b0b45f22155b79f2 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -141,6 +141,7 @@ build_append_namestringv(GArray *array, const char *format, va_list ap)
     g_strfreev(segs);
 }
 
+GCC_FMT_ATTR(2, 3)
 static void build_append_namestring(GArray *array, const char *format, ...)
 {
     va_list ap;