[PATCH v5 03/11] client: define EPROTO if it's not defined

Pekka Paalanen ppaalanen at gmail.com
Mon Feb 25 12:00:13 UTC 2019


On Wed, 13 Feb 2019 13:39:08 +0200
Leonid Bobrov via wayland-devel <wayland-devel at lists.freedesktop.org> wrote:

> Signed-off-by: Leonid Bobrov <mazocomp at disroot.org>
> ---
>  src/wayland-client.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/wayland-client.h b/src/wayland-client.h
> index 9f70fa3..690c446 100644
> --- a/src/wayland-client.h
> +++ b/src/wayland-client.h
> @@ -39,4 +39,8 @@
>  #include "wayland-client-core.h"
>  #include "wayland-client-protocol.h"
>  
> +#ifndef EPROTO
> +#define EPROTO ENOPROTOOPT
> +#endif
> +
>  #endif

Hi Leonid,

the things in wayland-client.h are mostly deprecated stuff that could
not be removed because of stable API. New stuff should go to
wayland-client-core.h.

I'm a little confused. The Linux manual for errno says:

ENOPROTOOPT     Protocol not available (POSIX.1-2001).
EPROTO          Protocol error (POSIX.1-2001).

So both are provided by the same specification, and they are different
codes. How come you have one but not the other?

If you do this, you must also #include <errno.h> first, because you
cannot rely on the user to do that. If errno.h is not included first,
EPROTO is possibly undefined at that point, and then the real
definition through errno.h will conflict later.

I'm also not sure if wayland-client-core.h is the right place, but I
don't have better suggestions.

What if some other library uses a different fallback definition for
EPROTO? Then the order of includes would determine which library's
definition the program gets and then it unavoidably conflicts with the
other library's use.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20190225/00c6734f/attachment.sig>


More information about the wayland-devel mailing list