From f2fdfe7c42f3b10f3653f851ce5a0a90ee5ac1f9 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 10 May 2000 03:33:57 +0000 Subject: [PATCH] Silence "end-of-loop condition not reached" warnings from Solaris compiler --- CHANGES | 7 +++++-- bin/named/notify.c | 13 ++++++++++--- bin/named/update.c | 13 ++++++++++--- bin/named/xfrout.c | 6 ++++-- lib/dns/journal.c | 10 +++++++++- lib/dns/xfrin.c | 20 +++++++++++++++----- lib/lwres/getaddrinfo.c | 33 +++++++++++++++++++++++++-------- lib/lwres/getnameinfo.c | 9 ++++++++- 8 files changed, 86 insertions(+), 25 deletions(-) diff --git a/CHANGES b/CHANGES index 9e29a9fd68..9cea757b2d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,10 +1,13 @@ + 165. [cleanup] Silence "end-of-loop condition not reached" warnings + from Solaris compiler. - 164. [cleanup] Added functions isc_file_fopen(), isc_file_fclose(), + 164. [func] Added functions isc_file_fopen(), isc_file_fclose(), isc_file_fseek(), isc_file_fread(), isc_file_fwrite(), isc_file_fflush(), isc_file_ffsync(), isc_file_remove() to encapsulate nonportable usage of errno and fflush(). - 163. [func] Added result codes ISC_R_FILENOTFOUND and ISC_R_FILEEXISTS. + 163. [func] Added result codes ISC_R_FILENOTFOUND and + ISC_R_FILEEXISTS. 162. [bug] Ensure proper range for arguments to ctype.h functions. diff --git a/bin/named/notify.c b/bin/named/notify.c index 28a30777ec..b9994353ee 100644 --- a/bin/named/notify.c +++ b/bin/named/notify.c @@ -71,16 +71,21 @@ * Fail unconditionally with result 'code', which must not * be ISC_R_SUCCESS. The reason for failure presumably has * been logged already. + * + * The test is there to keep the Solaris compiler from complaining + * about "end-of-loop code not reached". */ #define FAIL(code) \ do { \ result = (code); \ - goto failure; \ + if (code != ISC_R_SUCCESS) goto failure; \ } while (0) /* * Fail unconditionally and log as a client error. + * The test against ISC_R_SUCCESS is there to keep the Solaris compiler + * from complaining about "end-of-loop code not reached". */ #define FAILC(code, msg) \ do { \ @@ -88,11 +93,13 @@ isc_log_write(NOTIFY_PROTOCOL_LOGARGS, \ "notify failed: %s (%s)", \ msg, isc_result_totext(code)); \ - goto failure; \ + if (code != ISC_R_SUCCESS) goto failure; \ } while (0) /* * Fail unconditionally and log as a server error. + * The test against ISC_R_SUCCESS is there to keep the Solaris compiler + * from complaining about "end-of-loop code not reached". */ #define FAILS(code, msg) \ do { \ @@ -100,7 +107,7 @@ isc_log_write(NOTIFY_PROTOCOL_LOGARGS, \ "notify error: %s: %s", \ msg, isc_result_totext(code)); \ - goto failure; \ + if (code != ISC_R_SUCCESS) goto failure; \ } while (0) /**************************************************************************/ diff --git a/bin/named/update.c b/bin/named/update.c index 9a0f9930a4..37d4d763bd 100644 --- a/bin/named/update.c +++ b/bin/named/update.c @@ -89,16 +89,21 @@ * Fail unconditionally with result 'code', which must not * be ISC_R_SUCCESS. The reason for failure presumably has * been logged already. + * + * The test against ISC_R_SUCCESS is there to keep the Solaris compiler + * from complaining about "end-of-loop code not reached". */ #define FAIL(code) \ do { \ result = (code); \ - goto failure; \ + if (code != ISC_R_SUCCESS) goto failure; \ } while (0) /* * Fail unconditionally and log as a client error. + * The test against ISC_R_SUCCESS is there to keep the Solaris compiler + * from complaining about "end-of-loop code not reached". */ #define FAILC(code, msg) \ do { \ @@ -106,11 +111,13 @@ isc_log_write(UPDATE_PROTOCOL_LOGARGS, \ "dynamic update failed: %s (%s)", \ msg, isc_result_totext(code)); \ - goto failure; \ + if (code != ISC_R_SUCCESS) goto failure; \ } while (0) /* * Fail unconditionally and log as a server error. + * The test against ISC_R_SUCCESS is there to keep the Solaris compiler + * from complaining about "end-of-loop code not reached". */ #define FAILS(code, msg) \ do { \ @@ -118,7 +125,7 @@ isc_log_write(UPDATE_PROTOCOL_LOGARGS, \ "dynamic update error: %s: %s", \ msg, isc_result_totext(code)); \ - goto failure; \ + if (code != ISC_R_SUCCESS) goto failure; \ } while (0) /**************************************************************************/ diff --git a/bin/named/xfrout.c b/bin/named/xfrout.c index 0539d5f344..8d9b08bfd0 100644 --- a/bin/named/xfrout.c +++ b/bin/named/xfrout.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: xfrout.c,v 1.60 2000/05/08 14:33:01 tale Exp $ */ +/* $Id: xfrout.c,v 1.61 2000/05/10 03:33:52 tale Exp $ */ #include @@ -62,6 +62,8 @@ /* * Fail unconditionally and log as a client error. + * The test against ISC_R_SUCCESS is there to keep the Solaris compiler + * from complaining about "end-of-loop code not reached". */ #define FAILC(code, msg) \ do { \ @@ -70,7 +72,7 @@ NS_LOGMODULE_XFER_OUT, ISC_LOG_INFO, \ "bad zone transfer request: %s (%s)", \ msg, isc_result_totext(code)); \ - goto failure; \ + if (result != ISC_R_SUCCESS) goto failure; \ } while (0) #define CHECK(op) \ diff --git a/lib/dns/journal.c b/lib/dns/journal.c index 72b4d61f6c..e8eabd16d8 100644 --- a/lib/dns/journal.c +++ b/lib/dns/journal.c @@ -55,7 +55,15 @@ static isc_boolean_t bind8_compat = ISC_TRUE; /* XXX config */ #define JOURNAL_DEBUG_LOGARGS(n) \ JOURNAL_COMMON_LOGARGS, ISC_LOG_DEBUG(n) -#define FAIL(code) do { result = (code); goto failure; } while (0) +/* + * It would be non-sensical (or at least obtuse) to use FAIL() with an + * ISC_R_SUCCESS code, but the test is there to keep the Solaris compiler + * from complaining about "end-of-loop code not reached". + */ +#define FAIL(code) \ + do { result = (code); \ + if (result != ISC_R_SUCCESS) goto failure; \ + } while (0) #define CHECK(op) \ do { result = (op); \ diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c index 15974c81c3..a0d22ad49e 100644 --- a/lib/dns/xfrin.c +++ b/lib/dns/xfrin.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: xfrin.c,v 1.67 2000/05/08 19:23:22 tale Exp $ */ +/* $Id: xfrin.c,v 1.68 2000/05/10 03:33:54 tale Exp $ */ #include @@ -45,10 +45,20 @@ * Incoming AXFR and IXFR. */ -#define FAIL(code) do { result = (code); goto failure; } while (0) -#define CHECK(op) do { result = (op); \ - if (result != ISC_R_SUCCESS) goto failure; \ - } while (0) +/* + * It would be non-sensical (or at least obtuse) to use FAIL() with an + * ISC_R_SUCCESS code, but the test is there to keep the Solaris compiler + * from complaining about "end-of-loop code not reached". + */ +#define FAIL(code) \ + do { result = (code); \ + if (result != ISC_R_SUCCESS) goto failure; \ + } while (0) + +#define CHECK(op) \ + do { result = (op); \ + if (result != ISC_R_SUCCESS) goto failure; \ + } while (0) /* * The states of the *XFR state machine. We handle both IXFR and AXFR diff --git a/lib/lwres/getaddrinfo.c b/lib/lwres/getaddrinfo.c index 32ad3885a4..4626c45933 100644 --- a/lib/lwres/getaddrinfo.c +++ b/lib/lwres/getaddrinfo.c @@ -3,7 +3,7 @@ * The Berkeley Software Design Inc. software License Agreement specifies * the terms and conditions for redistribution. * - * BSDI $Id: getaddrinfo.c,v 1.15 2000/04/28 02:08:12 tale Exp $ + * BSDI $Id: getaddrinfo.c,v 1.16 2000/05/10 03:33:56 tale Exp $ */ #include @@ -219,7 +219,9 @@ lwres_getaddrinfo(const char *hostname, const char *servname, if (lwres_net_aton(hostname, (struct in_addr *)abuf)) { if (family == AF_INET6) { - /* Convert to a V4 mapped address */ + /* + * Convert to a V4 mapped address. + */ struct in6_addr *a6 = (struct in6_addr *)abuf; memcpy(&a6->s6_addr[12], &a6->s6_addr[0], 4); memset(&a6->s6_addr[10], 0xff, 2); @@ -319,7 +321,9 @@ set_order(family, net_order) order = getenv("NET_ORDER"); found = 0; while (order != NULL) { - /* We ignore any unknown names. */ + /* + * We ignore any unknown names. + */ tok = lwres_strsep(&order, ":"); if (strcasecmp(tok, "inet6") == 0) { if ((found & FOUND_IPV6) == 0) @@ -333,7 +337,9 @@ set_order(family, net_order) } } - /* Add in anything that we didn't find */ + /* + * Add in anything that we didn't find. + */ if ((found & FOUND_IPV4) == 0) *net_order++ = add_ipv4; if ((found & FOUND_IPV6) == 0) @@ -345,11 +351,18 @@ set_order(family, net_order) static char v4_loop[4] = { 127, 0, 0, 1 }; -#define ERR(x) do { result = (x); goto cleanup; } while (0) +/* + * The test against 0 is there to keep the Solaris compiler + * from complaining about "end-of-loop code not reached". + */ +#define ERR(code) \ + do { result = (code); \ + if (result != 0) goto cleanup; \ + } while (0) static int add_ipv4(const char *hostname, int flags, struct addrinfo **aip, - int socktype, int port) + int socktype, int port) { struct addrinfo *ai; lwres_context_t *lwrctx = NULL; @@ -551,10 +564,14 @@ ai_reverse(struct addrinfo *oai) { nai = NULL; while (oai) { - /* grab one off the old list */ + /* + * Grab one off the old list. + */ tai = oai; oai = oai->ai_next; - /* put it on the front of the new list */ + /* + * Put it on the front of the new list. + */ tai->ai_next = nai; nai = tai; } diff --git a/lib/lwres/getnameinfo.c b/lib/lwres/getnameinfo.c index 4d28192e52..9c66b6966b 100644 --- a/lib/lwres/getnameinfo.c +++ b/lib/lwres/getnameinfo.c @@ -74,7 +74,14 @@ static struct afd { #define ENI_FAMILY 5 #define ENI_SALEN 6 -#define ERR(x) do { result = (x); goto cleanup; } while (0) +/* + * The test against 0 is there to keep the Solaris compiler + * from complaining about "end-of-loop code not reached". + */ +#define ERR(code) \ + do { result = (code); \ + if (result != 0) goto cleanup; \ + } while (0) int lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,