Bug #6771
end-of-loop code not reached in common/dnssd_clientstub.c
100%
Description
A build with Studio as the shadow compiler produced this error:
"../common/dnssd_clientstub.c", line 675: end-of-loop code not reached (E_END_OF_LOOP_CODE_NOT_REACHED) cc: acomp failed for ../common/dnssd_clientstub.c
Here's the code in usr/src/lib/libdns_sd/common/dnssd_clientstub.c:
599 static DNSServiceErrorType deliver_request(ipc_msg_hdr *hdr, DNSServiceOp *sdr) 600 { ... 633 #if defined(USE_TCP_LOOPBACK) ... 651 #elif defined(USE_NAMED_ERROR_RETURN_SOCKET) ... 672 #else 673 { 674 dnssd_sock_t sp[2]; ------------------------------------------------------------------------------- 675 if (socketpair(AF_DNSSD, SOCK_STREAM, 0, sp) < 0) deliver_request_bailout("socketpair"); ------------------------------------------------------------------------------- 676 else 677 { ... 689 #endif
The deliver_request_bailout macro is defined this way:
+ #define deliver_request_bailout(MSG) \ do { syslog(LOG_WARNING, "dnssd_clientstub deliver_request: %s failed %d (%s)", (MSG), dnssd_errno, dnssd_strerror(dnssd_errno)); goto cleanup; } while(0)
The compiler is complaining about the jump out of the do/while loop. There are two possible solutions. One is to alter the macro by removing the loop. The other is to suppress the error by adding -erroff=E_END_OF_LOOP_CODE_NOT_REACHED to the appropriate Makefile.
Updated by Toomas Soome almost 5 years ago
Gary Mills wrote:
A build with Studio as the shadow compiler produced this error:
[...]
Here's the code in usr/src/lib/libdns_sd/common/dnssd_clientstub.c:
[...]
The deliver_request_bailout macro is defined this way:
[...]
The compiler is complaining about the jump out of the do/while loop. There are two possible solutions. One is to alter the macro by removing the loop. The other is to suppress the error by adding -erroff=E_END_OF_LOOP_CODE_NOT_REACHED to the appropriate Makefile.
Hm, are your build options somewhat different or was this appearing on sparc? Because this code was specifically cleaned/tested with shadow build enabled and I'm curious why this case was not picked up back then. I could run shadow build now again to see if it is still clean or not...
Updated by Gary Mills almost 5 years ago
This build was done on SPARC, but that shouldn't have made any difference in this case. I suspect the compiler. It was:
64-bit compiler /opt/onbld/bin/sparc/cw -_gcc cw version 1.30 primary: /opt/gcc/4.4.4/bin/gcc gcc (Illumos tags/gcc-4.4.4-il-2) 4.4.4 shadow: /opt/SUNWspro/bin/cc cc: Sun C 5.10 SunOS_sparc 2009/06/03
gcc did compile it without errors.
Updated by Toomas Soome almost 5 years ago
Gary Mills wrote:
This build was done on SPARC, but that shouldn't have made any difference in this case. I suspect the compiler. It was:
[...]
gcc did compile it without errors.
yep, gcc was ok on first attempt and on pre-integration build Robert did discover the shadow compile fail. on x86 the cc is the same:
cc: Sun C 5.10 SunOS_i386 2009/06/03
so I suspect the cc does behave differently on x86 and sparc, which explains the error. To be honest, I don't have preference about which way to go - to pollute Makefile with cc flags or remove do while() - to clean up the cc errors. I had to update the source anyhow, so adding this one does not make much difference ...
Updated by Gary Mills almost 5 years ago
Adding a line to Makefile.com proved be the simplest change. I'll also test this change on x86, just to ensure that it doesn't cause any problems there. I'll be submitting a webrev soon.
Updated by Gary Mills almost 5 years ago
Well, the simple change seemed to be unacceptable by the advocates. I'm doing the more complicated one now, with changes to the definition and invocations of the deliver_request_bailout macro in dnssd_clientstub.c . The build is also successful, both on SPARC and x86. I'll be submitting a webrev soon.
Updated by Electric Monk almost 5 years ago
- Status changed from Feedback to Closed
- % Done changed from 40 to 100
git commit 5dee1fa64fd5ddfe4221aaa94bc981e0b9d78b92
commit 5dee1fa64fd5ddfe4221aaa94bc981e0b9d78b92 Author: Gary Mills <gary_mills@fastmail.fm> Date: 2016-04-04T21:19:37.000Z 6771 end-of-loop code not reached in common/dnssd_clientstub.c Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: "Garrett D'Amore" <garrett@damore.org> Approved by: Robert Mustacchi <rm@joyent.com>