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-unlockedio.c
Date: Thu, 21 Dec 2023 18:56:33 +0000 (GMT)	[thread overview]
Message-ID: <20231221185633.48B6B3858C2A@sourceware.org> (raw)

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

commit f903387cf2edc009d82d27b95c61eb279b20f17d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 24 16:03:16 2022 -0300

    stdio: Suppress clang warnings for tst-unlockedio.c
    
    Clang issues the following warnings:
    
      tst-unlockedio.c:63:36: error: implicit conversion from 'double' to
      'size_t' (aka 'unsigned long') changes value from -0 to 0
      [-Werror,-Wliteral-conversion]
            || fwrite_unlocked (blah, 0, -0.0, fp) != 0
               ~~~~~~~~~~~~~~~           ^~~~
      tst-unlockedio.c:61:33: error: implicit conversion from 'double' to
      'size_t' (aka 'unsigned long') changes value from 0.25 to 0
      [-Werror,-Wliteral-conversion]
            || fwrite_unlocked (--cp, 0.25, 16, fp) != 0
               ~~~~~~~~~~~~~~~        ^~~~
      tst-unlockedio.c:59:37: error: implicit conversion from 'double' to
      'size_t' (aka 'unsigned long') changes value from 0.25 to 0
      [-Werror,-Wliteral-conversion]
            || fwrite_unlocked (cp++, 16, 0.25, fp) != 0
               ~~~~~~~~~~~~~~~            ^~~~
      tst-unlockedio.c:116:34: error: implicit conversion from 'double' to
      'size_t' (aka 'unsigned long') changes value from -0 to 0
      [-Werror,-Wliteral-conversion]
            || fread_unlocked (buf, 0, -0.0, fp) != 0
               ~~~~~~~~~~~~~~          ^~~~
      tst-unlockedio.c:114:32: error: implicit conversion from 'double' to
      'size_t' (aka 'unsigned long') changes value from 0.25 to 0
      [-Werror,-Wliteral-conversion]
            || fread_unlocked (--wp, 0.25, 16, fp) != 0
               ~~~~~~~~~~~~~~        ^~~~
      tst-unlockedio.c:112:36: error: implicit conversion from 'double' to
      'size_t' (aka 'unsigned long') changes value from 0.25 to 0
      [-Werror,-Wliteral-conversion]
            || fread_unlocked (wp++, 16, 0.25, fp) != 0
               ~~~~~~~~~~~~~~            ^~~~

Diff:
---
 stdio-common/tst-unlockedio.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/stdio-common/tst-unlockedio.c b/stdio-common/tst-unlockedio.c
index 67a7d621f5..c9c55fdad2 100644
--- a/stdio-common/tst-unlockedio.c
+++ b/stdio-common/tst-unlockedio.c
@@ -51,6 +51,9 @@ do_test (void)
      fread_unlocked below as well.  */
   DIAG_PUSH_NEEDS_COMMENT;
   DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdiv-by-zero");
+  /* clang warns about the implicit conversion from double to size_t,
+     which is required by this tests.  */
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wliteral-conversion");
   if (ftello (fp) != 0
       || fwrite_unlocked (blah, blah - blah, strlen (blah), f++) != 0
       || f != fp + 1
@@ -104,6 +107,7 @@ do_test (void)
   /* See explanation above.  */
   DIAG_PUSH_NEEDS_COMMENT;
   DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdiv-by-zero");
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wliteral-conversion");
   if (ftello (fp) != 0
       || fread_unlocked (buf, buf - buf, strlen (blah), f++) != 0
       || f != fp + 1

             reply	other threads:[~2023-12-21 18:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21 18:56 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-09-28 17:54 Adhemerval Zanella
2023-08-30 12:39 Adhemerval Zanella
2023-02-09 19:51 Adhemerval Zanella
2022-10-28 17:44 Adhemerval Zanella
2022-10-04 13:01 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=20231221185633.48B6B3858C2A@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).