diff mbox series

[1/1] libstdc++: Deal with ENOSYS == ENOTSUP

Message ID 20200306084123.8961-1-krebbel@linux.ibm.com
State New
Headers show
Series [1/1] libstdc++: Deal with ENOSYS == ENOTSUP | expand

Commit Message

Andreas Krebbel March 6, 2020, 8:41 a.m. UTC
zTPF uses the same numeric value for ENOSYS and ENOTSUP.

Ok for mainline?

libstdc++-v3/ChangeLog:

2020-03-06  Andreas Krebbel  <krebbel@linux.ibm.com>

	* src/c++11/system_error.cc: Omit the ENOTSUP case statement if it
	would match ENOSYS.
---
 libstdc++-v3/src/c++11/system_error.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ville Voutilainen March 6, 2020, 9:15 a.m. UTC | #1
On Fri, 6 Mar 2020 at 10:41, Andreas Krebbel <krebbel@linux.ibm.com> wrote:
>
> zTPF uses the same numeric value for ENOSYS and ENOTSUP.
>
> Ok for mainline?
>
> libstdc++-v3/ChangeLog:
>
> 2020-03-06  Andreas Krebbel  <krebbel@linux.ibm.com>
>
>         * src/c++11/system_error.cc: Omit the ENOTSUP case statement if it
>         would match ENOSYS.
> ---
>  libstdc++-v3/src/c++11/system_error.cc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/src/c++11/system_error.cc b/libstdc++-v3/src/c++11/system_error.cc
> index 7844afe6d2a..1f06e67feea 100644
> --- a/libstdc++-v3/src/c++11/system_error.cc
> +++ b/libstdc++-v3/src/c++11/system_error.cc
> @@ -251,7 +251,8 @@ namespace
>  #ifdef ENOTSOCK
>        case ENOTSOCK:
>  #endif
> -#ifdef ENOTSUP
> +#if defined ENOTSUP && (!defined ENOSYS || ENOTSUP != ENOSYS)

Hmm, what system does not have ENOSYS but has ENOTSUP? Meaning the
!defined ENOSYS
bit?
Andreas Krebbel March 6, 2020, 9:52 a.m. UTC | #2
On 3/6/20 10:15 AM, Ville Voutilainen wrote:
> On Fri, 6 Mar 2020 at 10:41, Andreas Krebbel <krebbel@linux.ibm.com> wrote:
>>
>> zTPF uses the same numeric value for ENOSYS and ENOTSUP.
>>
>> Ok for mainline?
>>
>> libstdc++-v3/ChangeLog:
>>
>> 2020-03-06  Andreas Krebbel  <krebbel@linux.ibm.com>
>>
>>         * src/c++11/system_error.cc: Omit the ENOTSUP case statement if it
>>         would match ENOSYS.
>> ---
>>  libstdc++-v3/src/c++11/system_error.cc | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/libstdc++-v3/src/c++11/system_error.cc b/libstdc++-v3/src/c++11/system_error.cc
>> index 7844afe6d2a..1f06e67feea 100644
>> --- a/libstdc++-v3/src/c++11/system_error.cc
>> +++ b/libstdc++-v3/src/c++11/system_error.cc
>> @@ -251,7 +251,8 @@ namespace
>>  #ifdef ENOTSOCK
>>        case ENOTSOCK:
>>  #endif
>> -#ifdef ENOTSUP
>> +#if defined ENOTSUP && (!defined ENOSYS || ENOTSUP != ENOSYS)
> 
> Hmm, what system does not have ENOSYS but has ENOTSUP? Meaning the
> !defined ENOSYS
> bit?
> 
None that I know about. It is just to make sure the compare afterwards operates on defined inputs.

Andreas
Ville Voutilainen March 6, 2020, 9:58 a.m. UTC | #3
On Fri, 6 Mar 2020 at 11:52, Andreas Krebbel <krebbel@linux.ibm.com> wrote:

> > Hmm, what system does not have ENOSYS but has ENOTSUP? Meaning the
> > !defined ENOSYS
> > bit?
> >
> None that I know about. It is just to make sure the compare afterwards operates on defined inputs.

Ah, I see, indeed. This dance is done also for EOPNOTSUPP, looks good
to me (but Jonathan still needs
to do the approval).
Jonathan Wakely March 6, 2020, 10 a.m. UTC | #4
On Fri, 6 Mar 2020 at 09:52, Andreas Krebbel <krebbel@linux.ibm.com> wrote:
>
> On 3/6/20 10:15 AM, Ville Voutilainen wrote:
> > On Fri, 6 Mar 2020 at 10:41, Andreas Krebbel <krebbel@linux.ibm.com> wrote:
> >>
> >> zTPF uses the same numeric value for ENOSYS and ENOTSUP.
> >>
> >> Ok for mainline?
> >>
> >> libstdc++-v3/ChangeLog:
> >>
> >> 2020-03-06  Andreas Krebbel  <krebbel@linux.ibm.com>
> >>
> >>         * src/c++11/system_error.cc: Omit the ENOTSUP case statement if it
> >>         would match ENOSYS.
> >> ---
> >>  libstdc++-v3/src/c++11/system_error.cc | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/libstdc++-v3/src/c++11/system_error.cc b/libstdc++-v3/src/c++11/system_error.cc
> >> index 7844afe6d2a..1f06e67feea 100644
> >> --- a/libstdc++-v3/src/c++11/system_error.cc
> >> +++ b/libstdc++-v3/src/c++11/system_error.cc
> >> @@ -251,7 +251,8 @@ namespace
> >>  #ifdef ENOTSOCK
> >>        case ENOTSOCK:
> >>  #endif
> >> -#ifdef ENOTSUP
> >> +#if defined ENOTSUP && (!defined ENOSYS || ENOTSUP != ENOSYS)
> >
> > Hmm, what system does not have ENOSYS but has ENOTSUP? Meaning the
> > !defined ENOSYS
> > bit?
> >
> None that I know about. It is just to make sure the compare afterwards operates on defined inputs.

Right, it's the same pattern we use for the other cases of possibly
duplicated values.

OK to commit, thanks.
diff mbox series

Patch

diff --git a/libstdc++-v3/src/c++11/system_error.cc b/libstdc++-v3/src/c++11/system_error.cc
index 7844afe6d2a..1f06e67feea 100644
--- a/libstdc++-v3/src/c++11/system_error.cc
+++ b/libstdc++-v3/src/c++11/system_error.cc
@@ -251,7 +251,8 @@  namespace
 #ifdef ENOTSOCK
       case ENOTSOCK:
 #endif
-#ifdef ENOTSUP
+#if defined ENOTSUP && (!defined ENOSYS || ENOTSUP != ENOSYS)
+      // zTPF uses the same value for ENOSYS and ENOTSUP
       case ENOTSUP:
 #endif
 #ifdef ENOTTY