about summary refs log tree commit diff
path: root/stdio-common/tstgetln.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-09-01 09:29:23 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-04-17 16:12:41 -0300
commitd57642f9fa4bb0a21c37ef0b19965c62c16ae46a (patch)
treef56f8036363927fadd7ccf6b5e0b4e792cfe8972 /stdio-common/tstgetln.c
parentf9d1356c695ae82b1209233f119d7b03da528e66 (diff)
downloadglibc-d57642f9fa4bb0a21c37ef0b19965c62c16ae46a.tar.gz
glibc-d57642f9fa4bb0a21c37ef0b19965c62c16ae46a.tar.xz
glibc-d57642f9fa4bb0a21c37ef0b19965c62c16ae46a.zip
stdio: Suppress %Z format for clang
clang does not handle %Z on print, and just suppressing
-Wformat-invalid-specifier might trigger another warning for extra
arguments (since %Z is ignored).  So suppress -Wformat-extra-args
as well.

For tst-fphex.c a heavy hammer is used since the printf is more
complex and clang thrown a more generic warning.
Diffstat (limited to 'stdio-common/tstgetln.c')
-rw-r--r--stdio-common/tstgetln.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/stdio-common/tstgetln.c b/stdio-common/tstgetln.c
index b2e8263283..c0a64d22c7 100644
--- a/stdio-common/tstgetln.c
+++ b/stdio-common/tstgetln.c
@@ -16,6 +16,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <stdio.h>
+#include <libc-diag.h>
 
 int
 main (int argc, char *argv[])
@@ -26,7 +27,12 @@ main (int argc, char *argv[])
 
   while ((len = getline (&buf, &size, stdin)) != -1)
     {
+      /* clang do not handle %Z format.  */
+      DIAG_PUSH_NEEDS_COMMENT_CLANG;
+      DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-invalid-specifier");
+      DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-extra-args");
       printf ("bufsize %Zu; read %Zd: ", size, len);
+      DIAG_POP_NEEDS_COMMENT_CLANG;
       if (fwrite (buf, len, 1, stdout) != 1)
 	{
 	  perror ("fwrite");