errno groveler in C Lassi Kortela (27 Jun 2020 12:03 UTC)
Re: errno groveler in C John Cowan (27 Jun 2020 12:10 UTC)
Re: errno groveler in C Lassi Kortela (27 Jun 2020 12:16 UTC)
Re: errno groveler in C hga@xxxxxx (27 Jun 2020 12:26 UTC)
SRFI directory layout Lassi Kortela (27 Jun 2020 12:40 UTC)
Re: SRFI directory layout hga@xxxxxx (27 Jun 2020 13:42 UTC)
Re: SRFI directory layout Arthur A. Gleckler (27 Jun 2020 20:07 UTC)
Re: SRFI directory layout John Cowan (27 Jun 2020 13:53 UTC)
Re: SRFI directory layout Arthur A. Gleckler (27 Jun 2020 20:01 UTC)
Re: errno groveler in C Arthur A. Gleckler (27 Jun 2020 16:35 UTC)
Re: errno groveler in C hga@xxxxxx (27 Jun 2020 12:21 UTC)
Re: errno groveler in C Lassi Kortela (27 Jun 2020 12:34 UTC)
Re: errno groveler in C Lassi Kortela (27 Jun 2020 13:51 UTC)
Re: errno groveler in C hga@xxxxxx (27 Jun 2020 14:24 UTC)
Re: errno groveler in C Lassi Kortela (27 Jun 2020 14:32 UTC)

Re: errno groveler in C Lassi Kortela 27 Jun 2020 14:32 UTC

>> The POSIX ones are printed unconditionally -- we assume they are
>> always defined and do no #ifdef check.
>
> Unfortunately it's not true for OpenBSD, it omits 2 of the reserved
> defines, and 4 from System V STREAMS.  I wonder if any others refuse
> to define all of them, despite the option of just ignoring the ones
> they don't use.

Wow, thank you for being vigilant! It's always a pleasure to work with
detail-oriented people.

I managed to replicate your situation with OpenBSD:

$ clang -Weverything -ansi -pedantic -o grovel grovel.c && ./grovel
grovel.c:166:8: error: use of undeclared identifier 'EMULTIHOP'
     PR(EMULTIHOP);
        ^
grovel.c:188:8: error: use of undeclared identifier 'ENODATA'
     PR(ENODATA);
        ^
grovel.c:196:8: error: use of undeclared identifier 'ENOLINK'
     PR(ENOLINK);
        ^
grovel.c:210:8: error: use of undeclared identifier 'ENOSR'
     PR(ENOSR);
        ^
grovel.c:211:8: error: use of undeclared identifier 'ENOSTR'
     PR(ENOSTR);
        ^
grovel.c:294:8: error: use of undeclared identifier 'ETIME'
     PR(ETIME);
        ^
6 errors generated.

POSIX
(https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html)
gives the impression that all of the errno values listed there are
required -- none are optional. If OpenBSD strives to be POSIX-compliant,
those errors would be bugs in OpenBSD.

However, as a practical matter, if something as correctness-obsessed as
OpenBSD omits some of the values, other OSes probably do as well. Hence
we should probably #ifdef-guard all of them. Do you agree.