[glib: 1/2] Tests: Mark printf wrappers with G_GNUC_PRINTF



commit 6b0b4381bfaab6483e49c5147c7031eab6cef9f3
Author: Simon McVittie <smcv collabora com>
Date:   Thu Sep 27 09:21:32 2018 +0100

    Tests: Mark printf wrappers with G_GNUC_PRINTF
    
    If we tell clang that we're passing the arguments on to a compatible
    printf call, it can see that we're doing it right, and won't warn us
    about -Wformat-nonliteral. This follows up from commit abac67c0.
    
    Signed-off-by: Simon McVittie <smcv collabora com>

 tests/unicode-encoding.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/tests/unicode-encoding.c b/tests/unicode-encoding.c
index 80427bd86..c729b284d 100644
--- a/tests/unicode-encoding.c
+++ b/tests/unicode-encoding.c
@@ -9,8 +9,7 @@
 
 static gint exit_status = 0;
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+G_GNUC_PRINTF (1, 2)
 static void
 croak (char *format, ...)
 {
@@ -23,6 +22,7 @@ croak (char *format, ...)
   exit (1);
 }
 
+G_GNUC_PRINTF (1, 2)
 static void
 fail (char *format, ...)
 {
@@ -34,7 +34,6 @@ fail (char *format, ...)
 
   exit_status |= 1;
 }
-#pragma GCC diagnostic pop
 
 typedef enum
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]