diff mbox series

libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions.

Message ID 1599826987-5240-1-git-send-email-christophe.lyon@linaro.org
State New
Headers show
Series libstdc++-v3/include/bits/regex_error.h: Avoid warning with -fno-exceptions. | expand

Commit Message

Christophe Lyon Sept. 11, 2020, 12:23 p.m. UTC
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(-)

Comments

Jonathan Wakely Sept. 11, 2020, 12:55 p.m. UTC | #1
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
>
Jonathan Wakely Sept. 11, 2020, 1:37 p.m. UTC | #2
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
>>
Jonathan Wakely Sept. 11, 2020, 1:53 p.m. UTC | #3
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.
diff mbox series

Patch

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