* [PATCH] libstdc++: Fix up experimental/net/timer/waitable/dest.cc testcase
@ 2023-03-27 8:35 Jakub Jelinek
2023-03-27 9:36 ` Jonathan Wakely
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2023-03-27 8:35 UTC (permalink / raw)
To: libstdc++; +Cc: gcc-patches
Hi!
In Fedora package build I've noticed a failure
/builddir/build/BUILD/gcc-13.0.1-20230324/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc: In function 'void test01()':
/builddir/build/BUILD/gcc-13.0.1-20230324/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc:41: warning: format '%lu' expects argument of type 'long unsigned int', but a
rgument 2 has type 'unsigned int' [-Wformat=]
FAIL: experimental/net/timer/waitable/dest.cc (test for excess errors)
Excess errors:
/builddir/build/BUILD/gcc-13.0.1-20230324/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc:41: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'unsigned int' [-Wformat=]
because we build with -Wformat.
The test uses %lu for size_t argument, which can be anything from unsigned
int to unsigned long long. As for printf I'm not sure we can use %zu
portably and given the n == 1 assertion, I think the options are to kill
the printf, or cast to long.
Ok for trunk?
2023-03-27 Jakub Jelinek <jakub@redhat.com>
* testsuite/experimental/net/timer/waitable/dest.cc: Avoid -Wformat
warning if size_t is not unsigned long.
--- libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc.jj 2023-01-16 11:52:17.394714745 +0100
+++ libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc 2023-03-25 14:35:49.046639413 +0100
@@ -38,7 +38,7 @@ test01()
timer.async_wait([&ec](std::error_code e) { ec = e; });
}
auto n = ctx.run();
- __builtin_printf("ran %lu\n", n);
+ __builtin_printf("ran %lu\n", long(n));
VERIFY( n == 1 );
VERIFY( ec == std::errc::operation_canceled );
}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] libstdc++: Fix up experimental/net/timer/waitable/dest.cc testcase
2023-03-27 8:35 [PATCH] libstdc++: Fix up experimental/net/timer/waitable/dest.cc testcase Jakub Jelinek
@ 2023-03-27 9:36 ` Jonathan Wakely
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2023-03-27 9:36 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 2088 bytes --]
On Monday, March 27, 2023, Jakub Jelinek via Libstdc++ <
libstdc++@gcc.gnu.org> wrote:
> Hi!
>
> In Fedora package build I've noticed a failure
>
/builddir/build/BUILD/gcc-13.0.1-20230324/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc:
In function 'void test01()':
>
/builddir/build/BUILD/gcc-13.0.1-20230324/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc:41:
warning: format '%lu' expects argument of type 'long unsigned int', but a
> rgument 2 has type 'unsigned int' [-Wformat=]
> FAIL: experimental/net/timer/waitable/dest.cc (test for excess errors)
> Excess errors:
>
/builddir/build/BUILD/gcc-13.0.1-20230324/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc:41:
warning: format '%lu' expects argument of type 'long unsigned int', but
argument 2 has type 'unsigned int' [-Wformat=]
> because we build with -Wformat.
>
> The test uses %lu for size_t argument, which can be anything from unsigned
> int to unsigned long long. As for printf I'm not sure we can use %zu
> portably and given the n == 1 assertion, I think the options are to kill
> the printf, or cast to long.
>
> Ok for trunk?
Based on the use of __builtin_printf instead of including <stdio.h> and
doing it properly, I suspect I didn't mean to leave that print enabled, and
should have removed it before committing. But this fix is fine, OK for
trunk, thanks!
>
> 2023-03-27 Jakub Jelinek <jakub@redhat.com>
>
> * testsuite/experimental/net/timer/waitable/dest.cc: Avoid
-Wformat
> warning if size_t is not unsigned long.
>
> --- libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc.jj
2023-01-16 11:52:17.394714745 +0100
> +++ libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
2023-03-25 14:35:49.046639413 +0100
> @@ -38,7 +38,7 @@ test01()
> timer.async_wait([&ec](std::error_code e) { ec = e; });
> }
> auto n = ctx.run();
> - __builtin_printf("ran %lu\n", n);
> + __builtin_printf("ran %lu\n", long(n));
> VERIFY( n == 1 );
> VERIFY( ec == std::errc::operation_canceled );
> }
>
>
> Jakub
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-27 9:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-27 8:35 [PATCH] libstdc++: Fix up experimental/net/timer/waitable/dest.cc testcase Jakub Jelinek
2023-03-27 9:36 ` Jonathan Wakely
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).