public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/clang] stdio: Suppress clang warnings for tst-vprintf-width-i18n.c
Date: Wed, 30 Aug 2023 12:39:13 +0000 (GMT)	[thread overview]
Message-ID: <20230830123913.240073858296@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=948cce6cf63c2aa3182f3e6018724ac3c0229fe7

commit 948cce6cf63c2aa3182f3e6018724ac3c0229fe7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Jun 3 10:43:42 2022 -0300

    stdio: Suppress clang warnings for tst-vprintf-width-i18n.c
    
    Clang issues the following warning:
    
      tst-vfprintf-width-i18n.c:51:34: error: invalid conversion specifier '1'
      [-Werror,-Wformat-invalid-specifier]
        TEST_COMPARE (sprintf (buf, "%I16d", 12345), 16);
                                     ~~^
    
    Since it does not how to handle %I.

Diff:
---
 stdio-common/tst-vfprintf-width-i18n.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/stdio-common/tst-vfprintf-width-i18n.c b/stdio-common/tst-vfprintf-width-i18n.c
index 6d5a5f8a59..b9c0a16c63 100644
--- a/stdio-common/tst-vfprintf-width-i18n.c
+++ b/stdio-common/tst-vfprintf-width-i18n.c
@@ -23,6 +23,7 @@
 #include <stdio.h>
 #include <support/support.h>
 #include <support/check.h>
+#include <libc-diag.h>
 
 static int
 do_test (void)
@@ -48,6 +49,9 @@ do_test (void)
   TEST_COMPARE_STRING (buf, " INR12,345.67");
 
   /* Translated.  */
+  /* clang does not know about the GNU extension 'I'.  */
+  DIAG_PUSH_NEEDS_COMMENT_CLANG;
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (14, "-Wformat-invalid-specifier");
   TEST_COMPARE (sprintf (buf, "%I16d", 12345), 16);
   TEST_COMPARE_STRING (buf, " १२३४५");
   TEST_COMPARE (sprintf (buf, "%I12.2f", 12345.67), 26);
@@ -58,6 +62,7 @@ do_test (void)
   TEST_COMPARE_STRING (buf, " १२,३४५");
   TEST_COMPARE (sprintf (buf, "%'I12.2f", 12345.67), 26);
   TEST_COMPARE_STRING (buf, "   १२,३४५.६७");
+  DIAG_POP_NEEDS_COMMENT_CLANG;
 
   xsetlocale (LC_ALL, "ps_AF.UTF-8");
 
@@ -78,6 +83,8 @@ do_test (void)
   TEST_COMPARE_STRING (buf, "  12٬346 AFN"); /* Counts bytes.   */
 
   /* Translated.  */
+  DIAG_PUSH_NEEDS_COMMENT_CLANG;
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (14, "-Wformat-invalid-specifier");
   TEST_COMPARE (sprintf (buf, "%I11d", 12345), 11);
   TEST_COMPARE_STRING (buf, " ١٢٣۴٥");
   TEST_COMPARE (sprintf (buf, "%I12.2f", 12345.67), 20);
@@ -88,6 +95,7 @@ do_test (void)
   TEST_COMPARE_STRING (buf, " ١٢٬٣۴٥");
   TEST_COMPARE (sprintf (buf, "%'I12.2f", 12345.67), 21);
   TEST_COMPARE_STRING (buf, "   ١٢٬٣۴٥٫٦٧");
+  DIAG_POP_NEEDS_COMMENT_CLANG;
 
   return 0;
 }

             reply	other threads:[~2023-08-30 12:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30 12:39 Adhemerval Zanella [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-02 15:56 Adhemerval Zanella
2024-02-09 17:34 Adhemerval Zanella
2024-02-07 14:09 Adhemerval Zanella
2024-01-29 18:00 Adhemerval Zanella
2023-12-21 18:56 Adhemerval Zanella
2023-09-28 17:54 Adhemerval Zanella
2023-02-09 19:51 Adhemerval Zanella
2022-10-28 17:44 Adhemerval Zanella
2022-10-04 13:02 Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230830123913.240073858296@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).