about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-03-24 15:46:34 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-04-17 16:12:40 -0300
commitf86656747932c7e67b5aef0ee36aa05a08c66074 (patch)
tree384fbe1c48fc022f2015971fe32a8da55c70f3cf
parente402c515c7b9c2cffc2579c009b0c4059b8dbf64 (diff)
downloadglibc-f86656747932c7e67b5aef0ee36aa05a08c66074.tar.gz
glibc-f86656747932c7e67b5aef0ee36aa05a08c66074.tar.xz
glibc-f86656747932c7e67b5aef0ee36aa05a08c66074.zip
stdio: Disable clang warning on scanf13 test
-rw-r--r--stdio-common/scanf13.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/stdio-common/scanf13.c b/stdio-common/scanf13.c
index 60aa62a26f..6f3ddfa1e0 100644
--- a/stdio-common/scanf13.c
+++ b/stdio-common/scanf13.c
@@ -3,6 +3,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
+#include <libc-diag.h>
 
 int
 main (void)
@@ -20,6 +21,11 @@ main (void)
   } while (0)
 
   setlocale (LC_ALL, "de_DE.UTF-8");
+  /* TODO: explain why clang need these.  */
+  DIAG_PUSH_NEEDS_COMMENT_CLANG;
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-invalid-specifier");
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-extra-args");
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wfortify-source");
   if (sscanf ("A  \xc3\x84-\t\t\xc3\x84-abcdefbcd\t\xc3\x84-B",
 	      "A%ms%10ms%4m[bcd]%4mcB", &sp1, &sp2, &sp3, &sp4) != 4)
     FAIL ();
@@ -57,6 +63,7 @@ main (void)
 	FAIL ();
       free (lsp4);
     }
+  DIAG_POP_NEEDS_COMMENT_CLANG;
 
   memset (buf, '/', sizeof (buf));
   buf[0] = '\t';
@@ -86,6 +93,9 @@ main (void)
 	FAIL ();
       free (sp2);
     }
+  /* TODO: explain why clang need these.  */
+  DIAG_PUSH_NEEDS_COMMENT_CLANG;
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wfortify-source");
   if (sscanf (buf, "%2048ms%mc", &sp3, &sp4) != 2)
     FAIL ();
   else
@@ -126,6 +136,7 @@ main (void)
 	FAIL ();
       free (sp4);
     }
+  DIAG_POP_NEEDS_COMMENT_CLANG;
   if (sscanf (buf, "%mS%mC", &lsp1, &lsp2) != 2)
     FAIL ();
   else
@@ -142,6 +153,9 @@ main (void)
 	FAIL ();
       free (lsp2);
     }
+  DIAG_PUSH_NEEDS_COMMENT_CLANG;
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-invalid-specifier");
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-extra-args");
   if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2)
     FAIL ();
   else
@@ -182,6 +196,7 @@ main (void)
 	FAIL ();
       free (lsp4);
     }
+  DIAG_POP_NEEDS_COMMENT_CLANG;
 
   return result;
 }