public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Fix testsuite with -Wformat
@ 2023-12-06 14:34 Gwenole Beauchesne
  2024-01-05 14:12 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Gwenole Beauchesne @ 2023-12-06 14:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: Gwenole Beauchesne

Tested on x86_64-pc-linux-gnu with --enable-languages=c,c++ and
additional -Wformat to CXXFLAGS.

-- >8 --

Fix testsuite when compiling with -Wformat. Use nonnull arguments so
that -Wformat does not cause extraneous output to be reported as an
error.

FAIL: tr1/8_c_compatibility/cinttypes/functions.cc (test for excess errors)

libstdc++-v3/ChangeLog:

    * testsuite/tr1/8_c_compatibility/cinttypes/functions.cc: Use
    nonnull arguments to strtoimax() and wcstoimax() functions.

Signed-off-by: Gwenole Beauchesne <gb.devel@gmail.com>
---
 .../testsuite/tr1/8_c_compatibility/cinttypes/functions.cc    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
index 518ddf49875..21f5263b5cc 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
@@ -29,10 +29,10 @@ void test01()
 #if _GLIBCXX_USE_C99_INTTYPES_TR1
 
   std::tr1::intmax_t i = 0, numer = 0, denom = 0, base = 0;
-  const char* s = 0;
+  const char* s = "0";
   char** endptr = 0;
 #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
-  const wchar_t* ws = 0;
+  const wchar_t* ws = L"0";
   wchar_t** wendptr = 0;
 #endif
 
-- 
2.39.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libstdc++: Fix testsuite with -Wformat
  2023-12-06 14:34 [PATCH] libstdc++: Fix testsuite with -Wformat Gwenole Beauchesne
@ 2024-01-05 14:12 ` Jonathan Wakely
  2024-01-06 15:14   ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2024-01-05 14:12 UTC (permalink / raw)
  To: Gwenole Beauchesne; +Cc: gcc-patches, libstdc++

On 06/12/23 15:34 +0100, Gwenole Beauchesne wrote:
>Tested on x86_64-pc-linux-gnu with --enable-languages=c,c++ and
>additional -Wformat to CXXFLAGS.

Please CC the libstdc++@gcc.gnu.org list on all libstdc++ patches, as
documented at https://gcc.gnu.org/lists.html

Otherwise I won't see the patches unless I happen to glance at the
gcc-patches archive by chance.

The patch seems OK, but what exactly is it fixing? I don't see any
warning when adding -Wformat to the test flags.

>-- >8 --
>
>Fix testsuite when compiling with -Wformat. Use nonnull arguments so
>that -Wformat does not cause extraneous output to be reported as an
>error.
>
>FAIL: tr1/8_c_compatibility/cinttypes/functions.cc (test for excess errors)
>
>libstdc++-v3/ChangeLog:
>
>    * testsuite/tr1/8_c_compatibility/cinttypes/functions.cc: Use
>    nonnull arguments to strtoimax() and wcstoimax() functions.
>
>Signed-off-by: Gwenole Beauchesne <gb.devel@gmail.com>
>---
> .../testsuite/tr1/8_c_compatibility/cinttypes/functions.cc    | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
>index 518ddf49875..21f5263b5cc 100644
>--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
>+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
>@@ -29,10 +29,10 @@ void test01()
> #if _GLIBCXX_USE_C99_INTTYPES_TR1
>
>   std::tr1::intmax_t i = 0, numer = 0, denom = 0, base = 0;
>-  const char* s = 0;
>+  const char* s = "0";
>   char** endptr = 0;
> #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
>-  const wchar_t* ws = 0;
>+  const wchar_t* ws = L"0";
>   wchar_t** wendptr = 0;
> #endif
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libstdc++: Fix testsuite with -Wformat
  2024-01-05 14:12 ` Jonathan Wakely
@ 2024-01-06 15:14   ` Jonathan Wakely
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2024-01-06 15:14 UTC (permalink / raw)
  To: Gwenole Beauchesne; +Cc: gcc-patches, libstdc++

On Fri, 5 Jan 2024 at 14:12, Jonathan Wakely wrote:
>
> On 06/12/23 15:34 +0100, Gwenole Beauchesne wrote:
> >Tested on x86_64-pc-linux-gnu with --enable-languages=c,c++ and
> >additional -Wformat to CXXFLAGS.
>
> Please CC the libstdc++@gcc.gnu.org list on all libstdc++ patches, as
> documented at https://gcc.gnu.org/lists.html
>
> Otherwise I won't see the patches unless I happen to glance at the
> gcc-patches archive by chance.
>
> The patch seems OK, but what exactly is it fixing? I don't see any
> warning when adding -Wformat to the test flags.

I've pushed the patch to trunk, but I'm still curious why I don't see warnings.


>
> >-- >8 --
> >
> >Fix testsuite when compiling with -Wformat. Use nonnull arguments so
> >that -Wformat does not cause extraneous output to be reported as an
> >error.
> >
> >FAIL: tr1/8_c_compatibility/cinttypes/functions.cc (test for excess errors)
> >
> >libstdc++-v3/ChangeLog:
> >
> >    * testsuite/tr1/8_c_compatibility/cinttypes/functions.cc: Use
> >    nonnull arguments to strtoimax() and wcstoimax() functions.
> >
> >Signed-off-by: Gwenole Beauchesne <gb.devel@gmail.com>
> >---
> > .../testsuite/tr1/8_c_compatibility/cinttypes/functions.cc    | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
> >index 518ddf49875..21f5263b5cc 100644
> >--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
> >+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
> >@@ -29,10 +29,10 @@ void test01()
> > #if _GLIBCXX_USE_C99_INTTYPES_TR1
> >
> >   std::tr1::intmax_t i = 0, numer = 0, denom = 0, base = 0;
> >-  const char* s = 0;
> >+  const char* s = "0";
> >   char** endptr = 0;
> > #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
> >-  const wchar_t* ws = 0;
> >+  const wchar_t* ws = L"0";
> >   wchar_t** wendptr = 0;
> > #endif
> >
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-06 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-06 14:34 [PATCH] libstdc++: Fix testsuite with -Wformat Gwenole Beauchesne
2024-01-05 14:12 ` Jonathan Wakely
2024-01-06 15:14   ` 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).