c6d234
commit 0f88636c09686b1f8e876bfa88b40bacbcae8c11
c6d234
Author: Joseph Myers <joseph@codesourcery.com>
c6d234
Date:   Wed Dec 10 00:44:54 2014 +0000
c6d234
c6d234
    Disable -Wdeprecated-declarations for register_printf_function calls in tst-printfsz.c.
c6d234
    
c6d234
    This patch uses diagnostic control pragmas to disable warnings in
c6d234
    stdio-common/tst-printfsz.c for use of the deprecated
c6d234
    register_printf_function.  Because this test is testing printf_size
c6d234
    and printf_size_info, and the latter has the interface expected for
c6d234
    register_printf_function instead of the newer
c6d234
    register_printf_specifier, it seems correct for this test to use the
c6d234
    deprecated interface (wrapping printf_size_info in some way to use
c6d234
    register_printf_specifier would seem an excessive change to what's
c6d234
    tested).
c6d234
    
c6d234
    Tested for x86_64.
c6d234
    
c6d234
            * stdio-common/tst-printfsz.c: Include <libc-internal.h>.
c6d234
            (main): Disable -Wdeprecated-declarations around calls to
c6d234
            register_printf_function.
c6d234
c6d234
diff --git a/stdio-common/tst-printfsz.c b/stdio-common/tst-printfsz.c
c6d234
index 5925050b59e90b79..74d67d2f694f344b 100644
c6d234
--- a/stdio-common/tst-printfsz.c
c6d234
+++ b/stdio-common/tst-printfsz.c
c6d234
@@ -2,6 +2,7 @@
c6d234
 #include <printf.h>
c6d234
 #include <stdio.h>
c6d234
 #include <string.h>
c6d234
+#include <libc-internal.h>
c6d234
 
c6d234
 #define V       12345678.12345678
c6d234
 
c6d234
@@ -12,9 +13,15 @@ main (int argc, char *argv[])
c6d234
   char buf[1024];
c6d234
   int result = 0;
c6d234
 
c6d234
+  /* Testing printf_size_info requires using the deprecated
c6d234
+     register_printf_function, resulting in warnings
c6d234
+     "'register_printf_function' is deprecated".  */
c6d234
+  DIAG_PUSH_NEEDS_COMMENT;
c6d234
+  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
c6d234
   /* Register the printf handlers.  */
c6d234
   register_printf_function ('b', printf_size, printf_size_info);
c6d234
   register_printf_function ('B', printf_size, printf_size_info);
c6d234
+  DIAG_POP_NEEDS_COMMENT;
c6d234
 
c6d234
 
c6d234
   sprintf (buf, "%g %b %B %.0b %.0B %.1b %.1B %8.0b %08.0B",