diff mbox series

[32/39] stdio: Fix clang warnings on tests

Message ID 20241222000509.2205895-33-hjl.tools@gmail.com
State Accepted
Commit f6cf084155870578835f6c8e6f1969c8b26d11ac
Headers show
Series [01/39] conform: Use -dD instead of -dN on compiler invocation | expand

Commit Message

H.J. Lu Dec. 22, 2024, 12:04 a.m. UTC
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>

clang does not support 'I' specifier and handles it as a 'length
modifier'.
---
 stdio-common/tst-scanf-to_inpunct.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Sam James Dec. 22, 2024, 4:54 a.m. UTC | #1
"H.J. Lu" <hjl.tools@gmail.com> writes:

> From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>
> clang does not support 'I' specifier and handles it as a 'length
> modifier'.
> ---
>  stdio-common/tst-scanf-to_inpunct.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/stdio-common/tst-scanf-to_inpunct.c b/stdio-common/tst-scanf-to_inpunct.c
> index 6fc038f476..fab1a232b9 100644
> --- a/stdio-common/tst-scanf-to_inpunct.c
> +++ b/stdio-common/tst-scanf-to_inpunct.c
> @@ -18,6 +18,7 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <array_length.h>
> +#include <libc-diag.h>
>  #include <stdio.h>
>  #include <support/support.h>
>  #include <support/check.h>
> @@ -68,7 +69,11 @@ do_test (void)
>    for (int i = 0; i < array_length (inputs); i++)
>      {
>        int n;
> +      /* clang does not support 'I' specifier.  */
> +      DIAG_PUSH_NEEDS_COMMENT_CLANG;
> +      DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat");
>        sscanf (inputs[i].str, "%Id", &n);
> +      DIAG_POP_NEEDS_COMMENT_CLANG;
>        TEST_COMPARE (n, inputs[i].n);
>      }

Reviewed-by: Sam James <sam@gentoo.org>
diff mbox series

Patch

diff --git a/stdio-common/tst-scanf-to_inpunct.c b/stdio-common/tst-scanf-to_inpunct.c
index 6fc038f476..fab1a232b9 100644
--- a/stdio-common/tst-scanf-to_inpunct.c
+++ b/stdio-common/tst-scanf-to_inpunct.c
@@ -18,6 +18,7 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <array_length.h>
+#include <libc-diag.h>
 #include <stdio.h>
 #include <support/support.h>
 #include <support/check.h>
@@ -68,7 +69,11 @@  do_test (void)
   for (int i = 0; i < array_length (inputs); i++)
     {
       int n;
+      /* clang does not support 'I' specifier.  */
+      DIAG_PUSH_NEEDS_COMMENT_CLANG;
+      DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat");
       sscanf (inputs[i].str, "%Id", &n);
+      DIAG_POP_NEEDS_COMMENT_CLANG;
       TEST_COMPARE (n, inputs[i].n);
     }