Commit f4c0131a authored by Andreas Gustafsson's avatar Andreas Gustafsson
Browse files

eliminate "end-of-loop code not reached" warnings on Solaris 2.6

parent eba3ad47
...@@ -62,10 +62,12 @@ ...@@ -62,10 +62,12 @@
- use logging library, not printf - use logging library, not printf
*/ */
#define FAIL(code) do { result = (code); goto failure; } while (0) /**************************************************************************/
#define FAILMSG(code, msg) do { printf("%s\n", msg); \ /*
result = (code); goto failure; } while (0) * Check an operation for failure. These macros all assume that
* the function using them has a 'result' variable and a 'failure'
* label.
*/
#define CHECK(op) do { result = (op); \ #define CHECK(op) do { result = (op); \
if (result != DNS_R_SUCCESS) goto failure; \ if (result != DNS_R_SUCCESS) goto failure; \
} while (0) } while (0)
...@@ -75,7 +77,16 @@ ...@@ -75,7 +77,16 @@
goto failure; \ goto failure; \
} \ } \
} while (0) } while (0)
/*
* Fail unconditionally with result 'code', which must not
* be DNS_R_SUCCESS.
*/
#define FAIL(code) CHECK(code)
#define FAILMSG(code, msg) CHECKMSG(code, msg)
/**************************************************************************/
typedef struct rr rr_t; typedef struct rr rr_t;
struct rr { struct rr {
...@@ -358,19 +369,26 @@ rrset_exists_action(void *data, rr_t *rr) /*ARGSUSED*/ ...@@ -358,19 +369,26 @@ rrset_exists_action(void *data, rr_t *rr) /*ARGSUSED*/
return (DNS_R_EXISTS); return (DNS_R_EXISTS);
} }
#define RETURN_EXISTENCE_FLAG \ /*
do { \ * Utility macro for RR existence checking functions.
if (result == DNS_R_EXISTS) { \ *
*exists = ISC_TRUE; \ * If the variable 'result' has the value DNS_R_EXISTS or
return (DNS_R_SUCCESS); \ * DNS_R_SUCCESS, set *exists to ISC_TRUE or ISC_FALSE,
} else if (result == DNS_R_SUCCESS) { \ * respectively, and return success.
*exists = ISC_FALSE; \ *
return (DNS_R_SUCCESS); \ * If 'result' has any other value, there was a failure.
} else { \ * Return the failure result code and do not set *exists.
return (result); \ *
} \ * This would be more readable as "do { if ... } while(0)",
} while (0) * but that form generates tons of warnings on Solaris 2.6.
*/
#define RETURN_EXISTENCE_FLAG \
return ((result == DNS_R_EXISTS) ? \
(*exists = ISC_TRUE, DNS_R_SUCCESS) : \
((result == DNS_R_SUCCESS) ? \
(*exists = ISC_FALSE, DNS_R_SUCCESS) : \
result));
/* /*
* Set '*exists' to true iff an rrset of the given type exists, * Set '*exists' to true iff an rrset of the given type exists,
* to false otherwise. * to false otherwise.
......
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