* [PATCH] libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions.
@ 2020-09-11 12:23 Christophe Lyon
2020-09-11 12:23 ` [PATCH] libstdc++-v3/libsupc++/eh_call.cc: " Christophe Lyon
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Christophe Lyon @ 2020-09-11 12:23 UTC (permalink / raw)
To: gcc-patches, libstdc++
When building with -fno-exceptions, __GLIBCXX_THROW_OR_ABORT expands to
abort(), causing warnings:
unused parameter '__ecode'
unused parameter '__what'
This patch adds __attribute__((unused)) to avoid them.
2020-09-11 Torbjörn SVENSSON <torbjorn.svensson@st.com>
Christophe Lyon <christophe.lyon@linaro.org>
libstdc++-v3/
* include/bits/regex_error.h: Avoid warning with -fno-exceptions.
---
libstdc++-v3/include/bits/regex_error.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libstdc++-v3/include/bits/regex_error.h b/libstdc++-v3/include/bits/regex_error.h
index 09e9288..88f3f811 100644
--- a/libstdc++-v3/include/bits/regex_error.h
+++ b/libstdc++-v3/include/bits/regex_error.h
@@ -167,7 +167,8 @@ namespace regex_constants
__throw_regex_error(regex_constants::error_type __ecode);
inline void
- __throw_regex_error(regex_constants::error_type __ecode, const char* __what)
+ __throw_regex_error(regex_constants::error_type __ecode __attribute__((unused)),
+ const char* __what__attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(regex_error(__ecode, __what)); }
_GLIBCXX_END_NAMESPACE_VERSION
--
2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] libstdc++-v3/libsupc++/eh_call.cc: Avoid warning with -fno-exceptions.
2020-09-11 12:23 [PATCH] libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions Christophe Lyon
@ 2020-09-11 12:23 ` Christophe Lyon
2020-09-11 12:55 ` Jonathan Wakely
2020-09-11 12:23 ` [PATCH] libstdc++-v3/libsupc++/eh_call.cc: Avoid "set but not used" warning Christophe Lyon
2020-09-11 12:55 ` [PATCH] libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions Jonathan Wakely
2 siblings, 1 reply; 8+ messages in thread
From: Christophe Lyon @ 2020-09-11 12:23 UTC (permalink / raw)
To: gcc-patches, libstdc++
When building with -fno-exceptions, __throw_exception_again expands to
nothing, causing a "suggest braces around empty body in an 'if'
statement" warning.
This patch adds braces, like what was done in eh_personality.cc in svn
r193295 (git g:54ba39f599fc2f3d59fd3cd828a301ce9b731a20)
2020-09-11 Torbjörn SVENSSON <torbjorn.svensson@st.com>
Christophe Lyon <christophe.lyon@linaro.org>
libstdc++-v3/
* libsupc++/eh_call.cc: Avoid warning with -fno-exceptions.
---
libstdc++-v3/libsupc++/eh_call.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libstdc++-v3/libsupc++/eh_call.cc b/libstdc++-v3/libsupc++/eh_call.cc
index ee44b1a..d50c4fb 100644
--- a/libstdc++-v3/libsupc++/eh_call.cc
+++ b/libstdc++-v3/libsupc++/eh_call.cc
@@ -138,7 +138,7 @@ __cxa_call_unexpected(void* exc_obj_in)
if (__cxa_type_match(&new_xh->unwindHeader, catch_type, false,
&new_ptr) != ctm_failed)
- __throw_exception_again;
+ { __throw_exception_again; }
// If the exception spec allows std::bad_exception, throw that.
// We don't have a thrown object to compare against, but since
--
2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] libstdc++-v3/libsupc++/eh_call.cc: Avoid "set but not used" warning
2020-09-11 12:23 [PATCH] libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions Christophe Lyon
2020-09-11 12:23 ` [PATCH] libstdc++-v3/libsupc++/eh_call.cc: " Christophe Lyon
@ 2020-09-11 12:23 ` Christophe Lyon
2020-09-11 12:56 ` Jonathan Wakely
2020-09-11 12:55 ` [PATCH] libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions Jonathan Wakely
2 siblings, 1 reply; 8+ messages in thread
From: Christophe Lyon @ 2020-09-11 12:23 UTC (permalink / raw)
To: gcc-patches, libstdc++
When building with -fno-exceptions, bad_exception_allowed is set but
not used, causing a warning during the build.
This patch adds __attribute__((unused)) to avoid it.
2020-09-11 Torbjörn SVENSSON <torbjorn.svensson@st.com>
Christophe Lyon <christophe.lyon@linaro.org>
libstdc++-v3/
* libsupc++/eh_call.cc: Avoid warning with -fno-exceptions.
---
libstdc++-v3/libsupc++/eh_call.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libstdc++-v3/libsupc++/eh_call.cc b/libstdc++-v3/libsupc++/eh_call.cc
index d50c4fb..3c7426e 100644
--- a/libstdc++-v3/libsupc++/eh_call.cc
+++ b/libstdc++-v3/libsupc++/eh_call.cc
@@ -124,7 +124,7 @@ __cxa_call_unexpected(void* exc_obj_in)
void* new_ptr = __get_object_from_ambiguous_exception (new_xh);
const std::type_info* catch_type;
int n;
- bool bad_exception_allowed = false;
+ bool bad_exception_allowed __attribute__((unused)) = false;
const std::type_info& bad_exc = typeid(std::bad_exception);
// Check the new exception against the rtti list
--
2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions.
2020-09-11 12:23 [PATCH] libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions Christophe Lyon
2020-09-11 12:23 ` [PATCH] libstdc++-v3/libsupc++/eh_call.cc: " Christophe Lyon
2020-09-11 12:23 ` [PATCH] libstdc++-v3/libsupc++/eh_call.cc: Avoid "set but not used" warning Christophe Lyon
@ 2020-09-11 12:55 ` Jonathan Wakely
2020-09-11 13:37 ` Jonathan Wakely
2 siblings, 1 reply; 8+ messages in thread
From: Jonathan Wakely @ 2020-09-11 12:55 UTC (permalink / raw)
To: Christophe Lyon; +Cc: gcc-patches, libstdc++
On 11/09/20 12:23 +0000, Christophe Lyon via Libstdc++ wrote:
>When building with -fno-exceptions, __GLIBCXX_THROW_OR_ABORT expands to
>abort(), causing warnings:
>unused parameter '__ecode'
>unused parameter '__what'
>
>This patch adds __attribute__((unused)) to avoid them.
OK, thanks.
>2020-09-11 Torbjörn SVENSSON <torbjorn.svensson@st.com>
> Christophe Lyon <christophe.lyon@linaro.org>
>
> libstdc++-v3/
> * include/bits/regex_error.h: Avoid warning with -fno-exceptions.
>---
> libstdc++-v3/include/bits/regex_error.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/libstdc++-v3/include/bits/regex_error.h b/libstdc++-v3/include/bits/regex_error.h
>index 09e9288..88f3f811 100644
>--- a/libstdc++-v3/include/bits/regex_error.h
>+++ b/libstdc++-v3/include/bits/regex_error.h
>@@ -167,7 +167,8 @@ namespace regex_constants
> __throw_regex_error(regex_constants::error_type __ecode);
>
> inline void
>- __throw_regex_error(regex_constants::error_type __ecode, const char* __what)
>+ __throw_regex_error(regex_constants::error_type __ecode __attribute__((unused)),
>+ const char* __what__attribute__((unused)))
> { _GLIBCXX_THROW_OR_ABORT(regex_error(__ecode, __what)); }
>
> _GLIBCXX_END_NAMESPACE_VERSION
>--
>2.7.4
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] libstdc++-v3/libsupc++/eh_call.cc: Avoid warning with -fno-exceptions.
2020-09-11 12:23 ` [PATCH] libstdc++-v3/libsupc++/eh_call.cc: " Christophe Lyon
@ 2020-09-11 12:55 ` Jonathan Wakely
0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Wakely @ 2020-09-11 12:55 UTC (permalink / raw)
To: Christophe Lyon; +Cc: gcc-patches, libstdc++
On 11/09/20 12:23 +0000, Christophe Lyon via Libstdc++ wrote:
>When building with -fno-exceptions, __throw_exception_again expands to
>nothing, causing a "suggest braces around empty body in an 'if'
>statement" warning.
>
>This patch adds braces, like what was done in eh_personality.cc in svn
>r193295 (git g:54ba39f599fc2f3d59fd3cd828a301ce9b731a20)
OK, thanks.
>2020-09-11 Torbjörn SVENSSON <torbjorn.svensson@st.com>
> Christophe Lyon <christophe.lyon@linaro.org>
>
> libstdc++-v3/
> * libsupc++/eh_call.cc: Avoid warning with -fno-exceptions.
>---
> libstdc++-v3/libsupc++/eh_call.cc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/libstdc++-v3/libsupc++/eh_call.cc b/libstdc++-v3/libsupc++/eh_call.cc
>index ee44b1a..d50c4fb 100644
>--- a/libstdc++-v3/libsupc++/eh_call.cc
>+++ b/libstdc++-v3/libsupc++/eh_call.cc
>@@ -138,7 +138,7 @@ __cxa_call_unexpected(void* exc_obj_in)
>
> if (__cxa_type_match(&new_xh->unwindHeader, catch_type, false,
> &new_ptr) != ctm_failed)
>- __throw_exception_again;
>+ { __throw_exception_again; }
>
> // If the exception spec allows std::bad_exception, throw that.
> // We don't have a thrown object to compare against, but since
>--
>2.7.4
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] libstdc++-v3/libsupc++/eh_call.cc: Avoid "set but not used" warning
2020-09-11 12:23 ` [PATCH] libstdc++-v3/libsupc++/eh_call.cc: Avoid "set but not used" warning Christophe Lyon
@ 2020-09-11 12:56 ` Jonathan Wakely
0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Wakely @ 2020-09-11 12:56 UTC (permalink / raw)
To: Christophe Lyon; +Cc: gcc-patches, libstdc++
On 11/09/20 12:23 +0000, Christophe Lyon via Libstdc++ wrote:
>When building with -fno-exceptions, bad_exception_allowed is set but
>not used, causing a warning during the build.
>
>This patch adds __attribute__((unused)) to avoid it.
OK, thanks.
>2020-09-11 Torbjörn SVENSSON <torbjorn.svensson@st.com>
> Christophe Lyon <christophe.lyon@linaro.org>
>
> libstdc++-v3/
> * libsupc++/eh_call.cc: Avoid warning with -fno-exceptions.
>---
> libstdc++-v3/libsupc++/eh_call.cc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/libstdc++-v3/libsupc++/eh_call.cc b/libstdc++-v3/libsupc++/eh_call.cc
>index d50c4fb..3c7426e 100644
>--- a/libstdc++-v3/libsupc++/eh_call.cc
>+++ b/libstdc++-v3/libsupc++/eh_call.cc
>@@ -124,7 +124,7 @@ __cxa_call_unexpected(void* exc_obj_in)
> void* new_ptr = __get_object_from_ambiguous_exception (new_xh);
> const std::type_info* catch_type;
> int n;
>- bool bad_exception_allowed = false;
>+ bool bad_exception_allowed __attribute__((unused)) = false;
> const std::type_info& bad_exc = typeid(std::bad_exception);
>
> // Check the new exception against the rtti list
>--
>2.7.4
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions.
2020-09-11 12:55 ` [PATCH] libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions Jonathan Wakely
@ 2020-09-11 13:37 ` Jonathan Wakely
2020-09-11 13:53 ` Jonathan Wakely
0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Wakely @ 2020-09-11 13:37 UTC (permalink / raw)
To: Christophe Lyon; +Cc: gcc-patches, libstdc++
On 11/09/20 13:55 +0100, Jonathan Wakely wrote:
>On 11/09/20 12:23 +0000, Christophe Lyon via Libstdc++ wrote:
>>When building with -fno-exceptions, __GLIBCXX_THROW_OR_ABORT expands to
>>abort(), causing warnings:
>>unused parameter '__ecode'
>>unused parameter '__what'
>>
>>This patch adds __attribute__((unused)) to avoid them.
>
>OK, thanks.
>
>>2020-09-11 Torbjörn SVENSSON <torbjorn.svensson@st.com>
>> Christophe Lyon <christophe.lyon@linaro.org>
>>
>> libstdc++-v3/
>> * include/bits/regex_error.h: Avoid warning with -fno-exceptions.
>>---
>>libstdc++-v3/include/bits/regex_error.h | 3 ++-
>>1 file changed, 2 insertions(+), 1 deletion(-)
>>
>>diff --git a/libstdc++-v3/include/bits/regex_error.h b/libstdc++-v3/include/bits/regex_error.h
>>index 09e9288..88f3f811 100644
>>--- a/libstdc++-v3/include/bits/regex_error.h
>>+++ b/libstdc++-v3/include/bits/regex_error.h
>>@@ -167,7 +167,8 @@ namespace regex_constants
>> __throw_regex_error(regex_constants::error_type __ecode);
>>
>> inline void
>>- __throw_regex_error(regex_constants::error_type __ecode, const char* __what)
>>+ __throw_regex_error(regex_constants::error_type __ecode __attribute__((unused)),
Actually, not OK, because that needs to be __unused__ not unused.
>>+ const char* __what__attribute__((unused)))
And that fails to compile:
/home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/regex_error.h:171:54: error: expected ‘,’ or ‘...’ before ‘(’ token
There's a space missing between the name and the attribute.
>> { _GLIBCXX_THROW_OR_ABORT(regex_error(__ecode, __what)); }
>>
>>_GLIBCXX_END_NAMESPACE_VERSION
>>--
>>2.7.4
>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions.
2020-09-11 13:37 ` Jonathan Wakely
@ 2020-09-11 13:53 ` Jonathan Wakely
0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Wakely @ 2020-09-11 13:53 UTC (permalink / raw)
To: Christophe Lyon; +Cc: gcc-patches, libstdc++
[-- Attachment #1: Type: text/plain, Size: 1682 bytes --]
On 11/09/20 14:37 +0100, Jonathan Wakely wrote:
>On 11/09/20 13:55 +0100, Jonathan Wakely wrote:
>>On 11/09/20 12:23 +0000, Christophe Lyon via Libstdc++ wrote:
>>>When building with -fno-exceptions, __GLIBCXX_THROW_OR_ABORT expands to
>>>abort(), causing warnings:
>>>unused parameter '__ecode'
>>>unused parameter '__what'
>>>
>>>This patch adds __attribute__((unused)) to avoid them.
>>
>>OK, thanks.
>>
>>>2020-09-11 Torbjörn SVENSSON <torbjorn.svensson@st.com>
>>> Christophe Lyon <christophe.lyon@linaro.org>
>>>
>>> libstdc++-v3/
>>> * include/bits/regex_error.h: Avoid warning with -fno-exceptions.
>>>---
>>>libstdc++-v3/include/bits/regex_error.h | 3 ++-
>>>1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>>diff --git a/libstdc++-v3/include/bits/regex_error.h b/libstdc++-v3/include/bits/regex_error.h
>>>index 09e9288..88f3f811 100644
>>>--- a/libstdc++-v3/include/bits/regex_error.h
>>>+++ b/libstdc++-v3/include/bits/regex_error.h
>>>@@ -167,7 +167,8 @@ namespace regex_constants
>>> __throw_regex_error(regex_constants::error_type __ecode);
>>>
>>> inline void
>>>- __throw_regex_error(regex_constants::error_type __ecode, const char* __what)
>>>+ __throw_regex_error(regex_constants::error_type __ecode __attribute__((unused)),
>
>Actually, not OK, because that needs to be __unused__ not unused.
>
>>>+ const char* __what__attribute__((unused)))
>
>
>And that fails to compile:
>
>/home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/regex_error.h:171:54: error: expected ‘,’ or ‘...’ before ‘(’ token
>
>There's a space missing between the name and the attribute.
Fixed with this patch. Untested, but it builds.
[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1087 bytes --]
commit 29216f56d002982f10c33056f4b3d7f07e164122
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Sep 11 14:51:36 2020
libstdc++: Fix build error in <bits/regex_error.h>
libstdc++-v3/ChangeLog:
* include/bits/regex_error.h (__throw_regex_error): Fix
parameter declaration and use reserved attribute names.
diff --git a/libstdc++-v3/include/bits/regex_error.h b/libstdc++-v3/include/bits/regex_error.h
index 88f3f8114a4..f9c01650caa 100644
--- a/libstdc++-v3/include/bits/regex_error.h
+++ b/libstdc++-v3/include/bits/regex_error.h
@@ -167,8 +167,9 @@ namespace regex_constants
__throw_regex_error(regex_constants::error_type __ecode);
inline void
- __throw_regex_error(regex_constants::error_type __ecode __attribute__((unused)),
- const char* __what__attribute__((unused)))
+ __throw_regex_error(regex_constants::error_type __ecode
+ __attribute__((__unused__)),
+ const char* __what __attribute__((__unused__)))
{ _GLIBCXX_THROW_OR_ABORT(regex_error(__ecode, __what)); }
_GLIBCXX_END_NAMESPACE_VERSION
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-09-11 13:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11 12:23 [PATCH] libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions Christophe Lyon
2020-09-11 12:23 ` [PATCH] libstdc++-v3/libsupc++/eh_call.cc: " Christophe Lyon
2020-09-11 12:55 ` Jonathan Wakely
2020-09-11 12:23 ` [PATCH] libstdc++-v3/libsupc++/eh_call.cc: Avoid "set but not used" warning Christophe Lyon
2020-09-11 12:56 ` Jonathan Wakely
2020-09-11 12:55 ` [PATCH] libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions Jonathan Wakely
2020-09-11 13:37 ` Jonathan Wakely
2020-09-11 13:53 ` 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).