public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Fix -Wunused-parameter warnings
@ 2023-08-29 12:04 Pekka Seppänen
  2023-09-07 16:40 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Pekka Seppänen @ 2023-08-29 12:04 UTC (permalink / raw)
  To: gcc-patches

libstdc++: Fix -Wunused-parameter warnings when _GLIBCXX_USE_WCHAR_T is
not defined.

libstdc++-v3/ChangeLog:

	* src/c++11/cow-locale_init.cc: Add [[maybe_unused]] attribute.
	* src/c++17/fs_path.cc (path::_S_convert_loc): Likewise.
	* src/filesystem/path.cc (path::_S_convert_loc): Likewise.
---
  libstdc++-v3/src/c++11/cow-locale_init.cc | 4 ++--
  libstdc++-v3/src/c++17/fs_path.cc         | 2 +-
  libstdc++-v3/src/filesystem/path.cc       | 2 +-
  3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc 
b/libstdc++-v3/src/c++11/cow-locale_init.cc
index 85277763427..9554ed1ebf9 100644
--- a/libstdc++-v3/src/c++11/cow-locale_init.cc
+++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
@@ -137,8 +137,8 @@ namespace
    }

    void
-  locale::_Impl::_M_init_extra(void* cloc, void* clocm,
-                               const char* __s, const char* __smon)
+  locale::_Impl::_M_init_extra(void* cloc, [[maybe_unused]] void* 
clocm,
+			       const char* __s, [[maybe_unused]] const char* __smon)
    {
      auto& __cloc = *static_cast<__c_locale*>(cloc);

diff --git a/libstdc++-v3/src/c++17/fs_path.cc 
b/libstdc++-v3/src/c++17/fs_path.cc
index aaea7d2725d..d65b5482e8b 100644
--- a/libstdc++-v3/src/c++17/fs_path.cc
+++ b/libstdc++-v3/src/c++17/fs_path.cc
@@ -1947,7 +1947,7 @@ path::_M_split_cmpts()

  path::string_type
  path::_S_convert_loc(const char* __first, const char* __last,
-		     const std::locale& __loc)
+		     [[maybe_unused]] const std::locale& __loc)
  {
  #if _GLIBCXX_USE_WCHAR_T
    auto& __cvt = std::use_facet<codecvt<wchar_t, char, 
mbstate_t>>(__loc);
diff --git a/libstdc++-v3/src/filesystem/path.cc 
b/libstdc++-v3/src/filesystem/path.cc
index 4c218bdae49..d04ba6d465d 100644
--- a/libstdc++-v3/src/filesystem/path.cc
+++ b/libstdc++-v3/src/filesystem/path.cc
@@ -498,7 +498,7 @@ path::_M_trim()

  path::string_type
  path::_S_convert_loc(const char* __first, const char* __last,
-		     const std::locale& __loc)
+		     [[maybe_unused]] const std::locale& __loc)
  {
  #if _GLIBCXX_USE_WCHAR_T
    auto& __cvt = std::use_facet<codecvt<wchar_t, char, 
mbstate_t>>(__loc);
-- 
2.34.1

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

* Re: [PATCH] libstdc++: Fix -Wunused-parameter warnings
  2023-08-29 12:04 [PATCH] libstdc++: Fix -Wunused-parameter warnings Pekka Seppänen
@ 2023-09-07 16:40 ` Jonathan Wakely
  2023-09-07 19:30   ` [PATCH v2] " Pekka Seppänen
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2023-09-07 16:40 UTC (permalink / raw)
  To: Pekka Seppänen; +Cc: gcc-patches, libstdc++

On 29/08/23 15:04 +0300, Pekka Seppänen wrote:
>libstdc++: Fix -Wunused-parameter warnings when _GLIBCXX_USE_WCHAR_T is
>not defined.
>
>libstdc++-v3/ChangeLog:
>
>	* src/c++11/cow-locale_init.cc: Add [[maybe_unused]] attribute.
>	* src/c++17/fs_path.cc (path::_S_convert_loc): Likewise.
>	* src/filesystem/path.cc (path::_S_convert_loc): Likewise.
>---
>  libstdc++-v3/src/c++11/cow-locale_init.cc | 4 ++--
>  libstdc++-v3/src/c++17/fs_path.cc         | 2 +-
>  libstdc++-v3/src/filesystem/path.cc       | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
>mbstate_t>>(__loc);
>
>diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc
>b/libstdc++-v3/src/c++11/cow-locale_init.cc
>index 85277763427..9554ed1ebf9 100644
>--- a/libstdc++-v3/src/c++11/cow-locale_init.cc
>+++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
>@@ -137,8 +137,8 @@ namespace
>    }
>
>    void
>-  locale::_Impl::_M_init_extra(void* cloc, void* clocm,
>-                               const char* __s, const char* __smon)
>+  locale::_Impl::_M_init_extra(void* cloc, [[maybe_unused]] void*
>clocm,
>+			       const char* __s, [[maybe_unused]] const char* __smon)

This line should be split to keepo it below 80 columns.

Otherwise the patch looks good, but please CC the libstdc++ list for
libstdc++ patches. Otherwise I won't see them, and they won't be
reviewed.

Do you have a GCC copyright assignment on file? If not, please add a
sign-off to confirm you can submit this under the DCO terms:
https://gcc.gnu.org/dco.html


>    {
>      auto& __cloc = *static_cast<__c_locale*>(cloc);
>
>diff --git a/libstdc++-v3/src/c++17/fs_path.cc
>b/libstdc++-v3/src/c++17/fs_path.cc
>index aaea7d2725d..d65b5482e8b 100644
>--- a/libstdc++-v3/src/c++17/fs_path.cc
>+++ b/libstdc++-v3/src/c++17/fs_path.cc
>@@ -1947,7 +1947,7 @@ path::_M_split_cmpts()
>
>  path::string_type
>  path::_S_convert_loc(const char* __first, const char* __last,
>-		     const std::locale& __loc)
>+		     [[maybe_unused]] const std::locale& __loc)
>  {
>  #if _GLIBCXX_USE_WCHAR_T
>    auto& __cvt = std::use_facet<codecvt<wchar_t, char,
>mbstate_t>>(__loc);
>diff --git a/libstdc++-v3/src/filesystem/path.cc
>b/libstdc++-v3/src/filesystem/path.cc
>index 4c218bdae49..d04ba6d465d 100644
>--- a/libstdc++-v3/src/filesystem/path.cc
>+++ b/libstdc++-v3/src/filesystem/path.cc
>@@ -498,7 +498,7 @@ path::_M_trim()
>
>  path::string_type
>  path::_S_convert_loc(const char* __first, const char* __last,
>-		     const std::locale& __loc)
>+		     [[maybe_unused]] const std::locale& __loc)
>  {
>  #if _GLIBCXX_USE_WCHAR_T
>    auto& __cvt = std::use_facet<codecvt<wchar_t, char,


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

* [PATCH v2] libstdc++: Fix -Wunused-parameter warnings
  2023-09-07 16:40 ` Jonathan Wakely
@ 2023-09-07 19:30   ` Pekka Seppänen
  2023-09-08 17:12     ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Pekka Seppänen @ 2023-09-07 19:30 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++

On 7.9.2023 19:40, Jonathan Wakely wrote:
> On 29/08/23 15:04 +0300, Pekka Seppänen wrote:
>> libstdc++: Fix -Wunused-parameter warnings when _GLIBCXX_USE_WCHAR_T is
>> not defined.
>>
>> libstdc++-v3/ChangeLog:
>>
>>     * src/c++11/cow-locale_init.cc: Add [[maybe_unused]] attribute.
>>     * src/c++17/fs_path.cc (path::_S_convert_loc): Likewise.
>>     * src/filesystem/path.cc (path::_S_convert_loc): Likewise.
>> ---
>>  libstdc++-v3/src/c++11/cow-locale_init.cc | 4 ++--
>>  libstdc++-v3/src/c++17/fs_path.cc         | 2 +-
>>  libstdc++-v3/src/filesystem/path.cc       | 2 +-
>>  3 files changed, 4 insertions(+), 4 deletions(-)
>>
>> mbstate_t>>(__loc);
>>
>> diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc
>> b/libstdc++-v3/src/c++11/cow-locale_init.cc
>> index 85277763427..9554ed1ebf9 100644
>> --- a/libstdc++-v3/src/c++11/cow-locale_init.cc
>> +++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
>> @@ -137,8 +137,8 @@ namespace
>>    }
>>
>>    void
>> -  locale::_Impl::_M_init_extra(void* cloc, void* clocm,
>> -                               const char* __s, const char* __smon)
>> +  locale::_Impl::_M_init_extra(void* cloc, [[maybe_unused]] void*
>> clocm,
>> +                   const char* __s, [[maybe_unused]] const char* __smon)
> 
> This line should be split to keepo it below 80 columns.
> 

Done, v2 follows.

> Otherwise the patch looks good, but please CC the libstdc++ list for
> libstdc++ patches. Otherwise I won't see them, and they won't be
> reviewed.
> 

My bad, I wasn't aware of this.

> Do you have a GCC copyright assignment on file? If not, please add a
> sign-off to confirm you can submit this under the DCO terms:
> https://gcc.gnu.org/dco.html
> 

Will add.

> 
>>    {
>>      auto& __cloc = *static_cast<__c_locale*>(cloc);
>>
>> diff --git a/libstdc++-v3/src/c++17/fs_path.cc
>> b/libstdc++-v3/src/c++17/fs_path.cc
>> index aaea7d2725d..d65b5482e8b 100644
>> --- a/libstdc++-v3/src/c++17/fs_path.cc
>> +++ b/libstdc++-v3/src/c++17/fs_path.cc
>> @@ -1947,7 +1947,7 @@ path::_M_split_cmpts()
>>
>>  path::string_type
>>  path::_S_convert_loc(const char* __first, const char* __last,
>> -             const std::locale& __loc)
>> +             [[maybe_unused]] const std::locale& __loc)
>>  {
>>  #if _GLIBCXX_USE_WCHAR_T
>>    auto& __cvt = std::use_facet<codecvt<wchar_t, char,
>> mbstate_t>>(__loc);
>> diff --git a/libstdc++-v3/src/filesystem/path.cc
>> b/libstdc++-v3/src/filesystem/path.cc
>> index 4c218bdae49..d04ba6d465d 100644
>> --- a/libstdc++-v3/src/filesystem/path.cc
>> +++ b/libstdc++-v3/src/filesystem/path.cc
>> @@ -498,7 +498,7 @@ path::_M_trim()
>>
>>  path::string_type
>>  path::_S_convert_loc(const char* __first, const char* __last,
>> -             const std::locale& __loc)
>> +             [[maybe_unused]] const std::locale& __loc)
>>  {
>>  #if _GLIBCXX_USE_WCHAR_T
>>    auto& __cvt = std::use_facet<codecvt<wchar_t, char,
> 
> 

-- >8 --
libstdc++: Fix -Wunused-parameter warnings when _GLIBCXX_USE_WCHAR_T is
not defined.

libstdc++-v3/ChangeLog:

	* src/c++11/cow-locale_init.cc: Add [[maybe_unused]] attribute.
	* src/c++17/fs_path.cc (path::_S_convert_loc): Likewise.
	* src/filesystem/path.cc (path::_S_convert_loc): Likewise.

Signed-off-by: Pekka Seppänen <pexu@gcc.mail.kapsi.fi>
---
 libstdc++-v3/src/c++11/cow-locale_init.cc | 5 +++--
 libstdc++-v3/src/c++17/fs_path.cc         | 2 +-
 libstdc++-v3/src/filesystem/path.cc       | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc b/libstdc++-v3/src/c++11/cow-locale_init.cc
index 85277763427..f48561f5b12 100644
--- a/libstdc++-v3/src/c++11/cow-locale_init.cc
+++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
@@ -137,8 +137,9 @@ namespace
   }
 
   void
-  locale::_Impl::_M_init_extra(void* cloc, void* clocm,
-                               const char* __s, const char* __smon)
+  locale::_Impl::_M_init_extra(void* cloc, [[maybe_unused]] void* clocm,
+			       const char* __s,
+			       [[maybe_unused]] const char* __smon)
   {
     auto& __cloc = *static_cast<__c_locale*>(cloc);
 
diff --git a/libstdc++-v3/src/c++17/fs_path.cc b/libstdc++-v3/src/c++17/fs_path.cc
index aaea7d2725d..d65b5482e8b 100644
--- a/libstdc++-v3/src/c++17/fs_path.cc
+++ b/libstdc++-v3/src/c++17/fs_path.cc
@@ -1947,7 +1947,7 @@ path::_M_split_cmpts()
 
 path::string_type
 path::_S_convert_loc(const char* __first, const char* __last,
-		     const std::locale& __loc)
+		     [[maybe_unused]] const std::locale& __loc)
 {
 #if _GLIBCXX_USE_WCHAR_T
   auto& __cvt = std::use_facet<codecvt<wchar_t, char, mbstate_t>>(__loc);
diff --git a/libstdc++-v3/src/filesystem/path.cc b/libstdc++-v3/src/filesystem/path.cc
index 4c218bdae49..d04ba6d465d 100644
--- a/libstdc++-v3/src/filesystem/path.cc
+++ b/libstdc++-v3/src/filesystem/path.cc
@@ -498,7 +498,7 @@ path::_M_trim()
 
 path::string_type
 path::_S_convert_loc(const char* __first, const char* __last,
-		     const std::locale& __loc)
+		     [[maybe_unused]] const std::locale& __loc)
 {
 #if _GLIBCXX_USE_WCHAR_T
   auto& __cvt = std::use_facet<codecvt<wchar_t, char, mbstate_t>>(__loc);
-- 
2.42.0



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

* Re: [PATCH v2] libstdc++: Fix -Wunused-parameter warnings
  2023-09-07 19:30   ` [PATCH v2] " Pekka Seppänen
@ 2023-09-08 17:12     ` Jonathan Wakely
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2023-09-08 17:12 UTC (permalink / raw)
  To: Pekka Seppänen; +Cc: gcc-patches, libstdc++

On Thu, 7 Sept 2023 at 20:30, Pekka Seppänen <pexu@gcc.mail.kapsi.fi> wrote:
>
> On 7.9.2023 19:40, Jonathan Wakely wrote:
> > On 29/08/23 15:04 +0300, Pekka Seppänen wrote:
> >> libstdc++: Fix -Wunused-parameter warnings when _GLIBCXX_USE_WCHAR_T is
> >> not defined.
> >>
> >> libstdc++-v3/ChangeLog:
> >>
> >>     * src/c++11/cow-locale_init.cc: Add [[maybe_unused]] attribute.
> >>     * src/c++17/fs_path.cc (path::_S_convert_loc): Likewise.
> >>     * src/filesystem/path.cc (path::_S_convert_loc): Likewise.
> >> ---
> >>  libstdc++-v3/src/c++11/cow-locale_init.cc | 4 ++--
> >>  libstdc++-v3/src/c++17/fs_path.cc         | 2 +-
> >>  libstdc++-v3/src/filesystem/path.cc       | 2 +-
> >>  3 files changed, 4 insertions(+), 4 deletions(-)
> >>
> >> mbstate_t>>(__loc);
> >>
> >> diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc
> >> b/libstdc++-v3/src/c++11/cow-locale_init.cc
> >> index 85277763427..9554ed1ebf9 100644
> >> --- a/libstdc++-v3/src/c++11/cow-locale_init.cc
> >> +++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
> >> @@ -137,8 +137,8 @@ namespace
> >>    }
> >>
> >>    void
> >> -  locale::_Impl::_M_init_extra(void* cloc, void* clocm,
> >> -                               const char* __s, const char* __smon)
> >> +  locale::_Impl::_M_init_extra(void* cloc, [[maybe_unused]] void*
> >> clocm,
> >> +                   const char* __s, [[maybe_unused]] const char* __smon)
> >
> > This line should be split to keepo it below 80 columns.
> >
>
> Done, v2 follows.

Thanks, I'll get this one committed+pushed.


>
> > Otherwise the patch looks good, but please CC the libstdc++ list for
> > libstdc++ patches. Otherwise I won't see them, and they won't be
> > reviewed.
> >
>
> My bad, I wasn't aware of this.
>
> > Do you have a GCC copyright assignment on file? If not, please add a
> > sign-off to confirm you can submit this under the DCO terms:
> > https://gcc.gnu.org/dco.html
> >
>
> Will add.
>
> >
> >>    {
> >>      auto& __cloc = *static_cast<__c_locale*>(cloc);
> >>
> >> diff --git a/libstdc++-v3/src/c++17/fs_path.cc
> >> b/libstdc++-v3/src/c++17/fs_path.cc
> >> index aaea7d2725d..d65b5482e8b 100644
> >> --- a/libstdc++-v3/src/c++17/fs_path.cc
> >> +++ b/libstdc++-v3/src/c++17/fs_path.cc
> >> @@ -1947,7 +1947,7 @@ path::_M_split_cmpts()
> >>
> >>  path::string_type
> >>  path::_S_convert_loc(const char* __first, const char* __last,
> >> -             const std::locale& __loc)
> >> +             [[maybe_unused]] const std::locale& __loc)
> >>  {
> >>  #if _GLIBCXX_USE_WCHAR_T
> >>    auto& __cvt = std::use_facet<codecvt<wchar_t, char,
> >> mbstate_t>>(__loc);
> >> diff --git a/libstdc++-v3/src/filesystem/path.cc
> >> b/libstdc++-v3/src/filesystem/path.cc
> >> index 4c218bdae49..d04ba6d465d 100644
> >> --- a/libstdc++-v3/src/filesystem/path.cc
> >> +++ b/libstdc++-v3/src/filesystem/path.cc
> >> @@ -498,7 +498,7 @@ path::_M_trim()
> >>
> >>  path::string_type
> >>  path::_S_convert_loc(const char* __first, const char* __last,
> >> -             const std::locale& __loc)
> >> +             [[maybe_unused]] const std::locale& __loc)
> >>  {
> >>  #if _GLIBCXX_USE_WCHAR_T
> >>    auto& __cvt = std::use_facet<codecvt<wchar_t, char,
> >
> >
>
> -- >8 --
> libstdc++: Fix -Wunused-parameter warnings when _GLIBCXX_USE_WCHAR_T is
> not defined.
>
> libstdc++-v3/ChangeLog:
>
>         * src/c++11/cow-locale_init.cc: Add [[maybe_unused]] attribute.
>         * src/c++17/fs_path.cc (path::_S_convert_loc): Likewise.
>         * src/filesystem/path.cc (path::_S_convert_loc): Likewise.
>
> Signed-off-by: Pekka Seppänen <pexu@gcc.mail.kapsi.fi>
> ---
>  libstdc++-v3/src/c++11/cow-locale_init.cc | 5 +++--
>  libstdc++-v3/src/c++17/fs_path.cc         | 2 +-
>  libstdc++-v3/src/filesystem/path.cc       | 2 +-
>  3 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc b/libstdc++-v3/src/c++11/cow-locale_init.cc
> index 85277763427..f48561f5b12 100644
> --- a/libstdc++-v3/src/c++11/cow-locale_init.cc
> +++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
> @@ -137,8 +137,9 @@ namespace
>    }
>
>    void
> -  locale::_Impl::_M_init_extra(void* cloc, void* clocm,
> -                               const char* __s, const char* __smon)
> +  locale::_Impl::_M_init_extra(void* cloc, [[maybe_unused]] void* clocm,
> +                              const char* __s,
> +                              [[maybe_unused]] const char* __smon)
>    {
>      auto& __cloc = *static_cast<__c_locale*>(cloc);
>
> diff --git a/libstdc++-v3/src/c++17/fs_path.cc b/libstdc++-v3/src/c++17/fs_path.cc
> index aaea7d2725d..d65b5482e8b 100644
> --- a/libstdc++-v3/src/c++17/fs_path.cc
> +++ b/libstdc++-v3/src/c++17/fs_path.cc
> @@ -1947,7 +1947,7 @@ path::_M_split_cmpts()
>
>  path::string_type
>  path::_S_convert_loc(const char* __first, const char* __last,
> -                    const std::locale& __loc)
> +                    [[maybe_unused]] const std::locale& __loc)
>  {
>  #if _GLIBCXX_USE_WCHAR_T
>    auto& __cvt = std::use_facet<codecvt<wchar_t, char, mbstate_t>>(__loc);
> diff --git a/libstdc++-v3/src/filesystem/path.cc b/libstdc++-v3/src/filesystem/path.cc
> index 4c218bdae49..d04ba6d465d 100644
> --- a/libstdc++-v3/src/filesystem/path.cc
> +++ b/libstdc++-v3/src/filesystem/path.cc
> @@ -498,7 +498,7 @@ path::_M_trim()
>
>  path::string_type
>  path::_S_convert_loc(const char* __first, const char* __last,
> -                    const std::locale& __loc)
> +                    [[maybe_unused]] const std::locale& __loc)
>  {
>  #if _GLIBCXX_USE_WCHAR_T
>    auto& __cvt = std::use_facet<codecvt<wchar_t, char, mbstate_t>>(__loc);
> --
> 2.42.0
>
>


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

end of thread, other threads:[~2023-09-08 17:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-29 12:04 [PATCH] libstdc++: Fix -Wunused-parameter warnings Pekka Seppänen
2023-09-07 16:40 ` Jonathan Wakely
2023-09-07 19:30   ` [PATCH v2] " Pekka Seppänen
2023-09-08 17:12     ` 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).