Commit a6531913 authored by David King's avatar David King Committed by Simon McVittie

_dbus_get_is_errno_eagain_or_ewouldblock: Avoid warning

EAGAIN and EWOULDBLOCK are documented to possibly be numerically equal,
for instance in errno(3), and a simple logical OR check will trigger the
-Wlogical-op warning of GCC. The GCC developers consider the warning to
work as-designed in this case:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602

Avoid such a warning by explicitly checking if the values are identical.

Fixes: dbus/dbus#225Signed-off-by: 's avatarDavid King <dking@redhat.com>
Reviewed-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent 70bfb94b
Pipeline #5953 passed with stage
in 20 minutes and 31 seconds
......@@ -4604,7 +4604,15 @@ _dbus_daemon_unpublish_session_bus_address (void)
dbus_bool_t
_dbus_get_is_errno_eagain_or_ewouldblock (int e)
{
/* Avoid the -Wlogical-op GCC warning, which can be triggered when EAGAIN and
* EWOULDBLOCK are numerically equal, which is permitted as described by
* errno(3).
*/
#if EAGAIN == EWOULDBLOCK
return e == EAGAIN;
#else
return e == EAGAIN || e == EWOULDBLOCK;
#endif
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment