[PATCH] tst-unlockedio.c: Explicitly cast double to size_t
H.J. Lu
hjl.tools@gmail.com
Tue Dec 17 01:35:31 GMT 2024
On Tue, Dec 17, 2024 at 8:05 AM Joseph Myers <josmyers@redhat.com> wrote:
>
> On Tue, 17 Dec 2024, H.J. Lu wrote:
>
> > On Tue, Dec 17, 2024 at 6:14 AM Andreas Schwab <schwab@linux-m68k.org> wrote:
> > >
> > > That doesn't make sense. The point of the test is to check that the
> > > macro does the needed conversion.
> >
> > There is no cast to size_t in fwrite_unlocked nor fread_unlocked.
> > Compiler does implicit conversion.
>
> Yes, that's what we want. It's important that macro definitions of
> library functions do implicit conversion of arguments to the types in the
> prototype, not casts, so that users with arguments of bad types get the
> same diagnostics they would get with a direct function call not involving
> a macro.
>
> > Should I suppress Clang error
> > with -Wno-literal-conversion on this file instead?
>
> Suppressing diagnostics is generally appropriate in cases such as this,
Will do it as part of the Clang test patch set.
> where the compiler is warning about something the test is doing
> deliberately (tests often need to verify how glibc behaves in cases of
> questionable code that compilers ought to warn about).
>
> --
> Joseph S. Myers
> josmyers@redhat.com
--
H.J.
More information about the Libc-alpha
mailing list