Hi Ilya,
On Sun, Jul 26, 2020 at 03:06:06PM +0500, ???? ??????? wrote:
> From e5a49969d374e3e8e9da695dca48cb6fa82ca13d Mon Sep 17 00:00:00 2001
> From: Ilya Shipitsin <[email protected]>
> Date: Sun, 26 Jul 2020 15:01:10 +0500
> Subject: [PATCH] CLEANUP: suppress coverity warnings
>
> Coverity is not happy when return value is not examined. Those
> warnings are already marked as "Intentional", let us explicitely
> mark them with DISGUISE(..)
(...)
> - setsockopt(conn->handle.fd, IPPROTO_IP, IP_TOS, &tos,
> sizeof(tos));
> + DISGUISE(setsockopt(conn->handle.fd, IPPROTO_IP, IP_TOS, &tos,
> sizeof(tos)));
(...)
This is getting quite ugly over time. We already had to deal with some
of these when some libcs added a must_check attribute to some calls
like write() which we used only for debugging.
Your change doesn't just address Coverity's caprices but could as well
serve if some libcs add this attribute later. But I don't like what the
code looks like (mainly because it becomes ubiquitous and not exceptional
anymore).
Probably we should proceed differently and have something like these
for the cases where no return is desired:
fcntl_noret() => unchecked fcntl()
setsockopt_noret() => unchecked setsockopt()
Both would be just static inline functions wrapping the other ones in a
DISGUISE() if needed.
Then we could change the calls above to be more explicit about the intent
of not having a return, and less ugly to read.
Do you want to try to do something like this ?
Thanks,
Willy