From debd489a44363870f96f75818e89ec27d3cab736 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Tue, 29 Sep 2009 15:06:07 +0000 Subject: [PATCH] noreturn RT #20257 --- CHANGES | 4 +++- bin/check/named-checkconf.c | 5 ++++- bin/check/named-checkzone.c | 5 ++++- bin/confgen/ddns-confgen.c | 5 ++++- bin/confgen/rndc-confgen.c | 5 ++++- bin/confgen/util.h | 8 +++++--- bin/dig/dig.c | 5 ++++- bin/dig/host.c | 5 ++++- bin/dig/include/dig/dig.h | 7 ++++--- bin/dnssec/dnssec-dsfromkey.c | 5 ++++- bin/dnssec/dnssec-keyfromlabel.c | 5 ++++- bin/dnssec/dnssec-keygen.c | 5 ++++- bin/dnssec/dnssec-revoke.c | 5 ++++- bin/dnssec/dnssec-settime.c | 5 ++++- bin/dnssec/dnssec-signzone.c | 5 ++++- bin/dnssec/dnssectool.h | 7 ++++--- bin/named/include/named/main.h | 7 ++++--- bin/named/main.c | 11 ++++++++--- bin/named/server.c | 6 +++--- bin/nsupdate/nsupdate.c | 8 +++++--- bin/rndc/rndc.c | 5 ++++- bin/rndc/util.h | 8 +++++--- bin/tools/nsec3hash.c | 5 ++++- configure.in | 16 +++++++++++++++- lib/dns/include/dns/rbt.h | 4 ++-- lib/export/samples/nsprobe.c | 7 +++++-- lib/export/samples/sample-async.c | 7 +++++-- lib/export/samples/sample-request.c | 7 +++++-- lib/export/samples/sample-update.c | 7 +++++-- lib/export/samples/sample.c | 7 +++++-- lib/isc/assertions.c | 23 +++++++++++++++-------- lib/isc/include/isc/assertions.h | 6 ++++-- lib/isc/include/isc/error.h | 7 ++++--- lib/isc/include/isc/platform.h.in | 8 +++++++- lib/isc/include/isc/refcount.h | 6 +++--- lib/isc/win32/include/isc/platform.h | 8 +++++++- lib/isc/win32/libisc.def | 2 +- 37 files changed, 180 insertions(+), 71 deletions(-) diff --git a/CHANGES b/CHANGES index 62018c56dd..44304cf062 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ -2792. [port] win32: 32/64 bit cleanups. [RT #128244] +2793. [port] Add some noreturn attributes. [RT #20257] + +2792. [port] win32: 32/64 bit cleanups. [RT #20335] 2691. [func] dnssec-signzone: retain the existing NSEC or NSEC3 chain when re-signing a previously-signed zone. diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index 51c40704e9..3ef766cc84 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: named-checkconf.c,v 1.49 2009/07/13 06:57:21 marka Exp $ */ +/* $Id: named-checkconf.c,v 1.50 2009/09/29 15:06:05 fdupont Exp $ */ /*! \file */ @@ -59,6 +59,9 @@ isc_log_t *logc = NULL; } while (0) /*% usage */ +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void usage(void) { fprintf(stderr, "usage: %s [-h] [-j] [-v] [-z] [-t directory] " diff --git a/bin/check/named-checkzone.c b/bin/check/named-checkzone.c index 88f3347480..c36152b3e9 100644 --- a/bin/check/named-checkzone.c +++ b/bin/check/named-checkzone.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: named-checkzone.c,v 1.54 2009/05/29 02:14:31 marka Exp $ */ +/* $Id: named-checkzone.c,v 1.55 2009/09/29 15:06:05 fdupont Exp $ */ /*! \file */ @@ -70,6 +70,9 @@ static enum { progmode_check, progmode_compile } progmode; } \ } while (0) +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void usage(void) { fprintf(stderr, diff --git a/bin/confgen/ddns-confgen.c b/bin/confgen/ddns-confgen.c index c2ec61e1dc..44f9c27dfc 100644 --- a/bin/confgen/ddns-confgen.c +++ b/bin/confgen/ddns-confgen.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ddns-confgen.c,v 1.8 2009/07/29 17:52:00 each Exp $ */ +/* $Id: ddns-confgen.c,v 1.9 2009/09/29 15:06:05 fdupont Exp $ */ /*! \file */ @@ -60,6 +60,9 @@ const char *progname; isc_boolean_t verbose = ISC_FALSE; +ISC_PLATFORM_NORETURN_PRE static void +usage(int status) ISC_PLATFORM_NORETURN_POST; + static void usage(int status) { diff --git a/bin/confgen/rndc-confgen.c b/bin/confgen/rndc-confgen.c index 33647eea1e..cea8cc7da7 100644 --- a/bin/confgen/rndc-confgen.c +++ b/bin/confgen/rndc-confgen.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rndc-confgen.c,v 1.4 2009/06/15 23:47:59 tbox Exp $ */ +/* $Id: rndc-confgen.c,v 1.5 2009/09/29 15:06:05 fdupont Exp $ */ /*! \file */ @@ -69,6 +69,9 @@ isc_boolean_t verbose = ISC_FALSE; const char *keyfile, *keydef; +ISC_PLATFORM_NORETURN_PRE static void +usage(int status) ISC_PLATFORM_NORETURN_POST; + static void usage(int status) { diff --git a/bin/confgen/util.h b/bin/confgen/util.h index 89a09d7ca7..f3b2ec9dee 100644 --- a/bin/confgen/util.h +++ b/bin/confgen/util.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: util.h,v 1.3 2009/06/11 23:47:55 tbox Exp $ */ +/* $Id: util.h,v 1.4 2009/09/29 15:06:05 fdupont Exp $ */ #ifndef RNDC_UTIL_H #define RNDC_UTIL_H 1 @@ -22,6 +22,7 @@ /*! \file */ #include +#include #include @@ -42,8 +43,9 @@ ISC_LANG_BEGINDECLS void notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2); -void -fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); +ISC_PLATFORM_NORETURN_PRE void +fatal(const char *format, ...) +ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; ISC_LANG_ENDDECLS diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 66e76e4f98..884cc95388 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.c,v 1.231 2009/09/23 06:21:36 each Exp $ */ +/* $Id: dig.c,v 1.232 2009/09/29 15:06:05 fdupont Exp $ */ /*! \file */ @@ -138,6 +138,9 @@ print_usage(FILE *fp) { " [ host [@local-server] {local-d-opt} [...]]\n", fp); } +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void usage(void) { print_usage(stderr); diff --git a/bin/dig/host.c b/bin/dig/host.c index a278a3df81..6a00cfce32 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: host.c,v 1.119 2009/09/08 23:23:22 marka Exp $ */ +/* $Id: host.c,v 1.120 2009/09/29 15:06:05 fdupont Exp $ */ /*! \file */ @@ -141,6 +141,9 @@ rcode_totext(dns_rcode_t rcode) return totext.deconsttext; } +ISC_PLATFORM_NORETURN_PRE static void +show_usage(void) ISC_PLATFORM_NORETURN_POST; + static void show_usage(void) { fputs( diff --git a/bin/dig/include/dig/dig.h b/bin/dig/include/dig/dig.h index d463afb35f..5ac1d30e60 100644 --- a/bin/dig/include/dig/dig.h +++ b/bin/dig/include/dig/dig.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.h,v 1.110 2009/09/15 23:48:09 tbox Exp $ */ +/* $Id: dig.h,v 1.111 2009/09/29 15:06:06 fdupont Exp $ */ #ifndef DIG_H #define DIG_H @@ -292,8 +292,9 @@ isc_result_t get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int, isc_boolean_t strict); -void -fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); +ISC_PLATFORM_NORETURN_PRE void +fatal(const char *format, ...) +ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; void debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); diff --git a/bin/dnssec/dnssec-dsfromkey.c b/bin/dnssec/dnssec-dsfromkey.c index 9b1b55a8b7..9a89b56965 100644 --- a/bin/dnssec/dnssec-dsfromkey.c +++ b/bin/dnssec/dnssec-dsfromkey.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-dsfromkey.c,v 1.13 2009/09/01 00:22:24 jinmei Exp $ */ +/* $Id: dnssec-dsfromkey.c,v 1.14 2009/09/29 15:06:06 fdupont Exp $ */ /*! \file */ @@ -282,6 +282,9 @@ emit(unsigned int dtype, isc_boolean_t showall, char *lookaside, putchar('\n'); } +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void usage(void) { fprintf(stderr, "Usage:\n"); diff --git a/bin/dnssec/dnssec-keyfromlabel.c b/bin/dnssec/dnssec-keyfromlabel.c index 8baa19870b..370b02a5e9 100644 --- a/bin/dnssec/dnssec-keyfromlabel.c +++ b/bin/dnssec/dnssec-keyfromlabel.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-keyfromlabel.c,v 1.15 2009/09/23 16:01:56 each Exp $ */ +/* $Id: dnssec-keyfromlabel.c,v 1.16 2009/09/29 15:06:06 fdupont Exp $ */ /*! \file */ @@ -51,6 +51,9 @@ int verbose; static const char *algs = "RSA | RSAMD5 | DH | DSA | RSASHA1 |" " NSEC3DSA | NSEC3RSASHA1"; +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void usage(void) { fprintf(stderr, "Usage:\n"); diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c index 5cdf108e2b..86d8bbdee1 100644 --- a/bin/dnssec/dnssec-keygen.c +++ b/bin/dnssec/dnssec-keygen.c @@ -29,7 +29,7 @@ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-keygen.c,v 1.96 2009/09/23 16:01:56 each Exp $ */ +/* $Id: dnssec-keygen.c,v 1.97 2009/09/29 15:06:06 fdupont Exp $ */ /*! \file */ @@ -73,6 +73,9 @@ dsa_size_ok(int size) { return (ISC_TF(size >= 512 && size <= 1024 && size % 64 == 0)); } +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void usage(void) { fprintf(stderr, "Usage:\n"); diff --git a/bin/dnssec/dnssec-revoke.c b/bin/dnssec/dnssec-revoke.c index 2b484ad9eb..7f2f6d301c 100644 --- a/bin/dnssec/dnssec-revoke.c +++ b/bin/dnssec/dnssec-revoke.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-revoke.c,v 1.12 2009/09/23 16:01:56 each Exp $ */ +/* $Id: dnssec-revoke.c,v 1.13 2009/09/29 15:06:06 fdupont Exp $ */ /*! \file */ @@ -46,6 +46,9 @@ int verbose; static isc_mem_t *mctx = NULL; +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void usage(void) { fprintf(stderr, "Usage:\n"); diff --git a/bin/dnssec/dnssec-settime.c b/bin/dnssec/dnssec-settime.c index 848ac1550b..ff323c337d 100644 --- a/bin/dnssec/dnssec-settime.c +++ b/bin/dnssec/dnssec-settime.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-settime.c,v 1.13 2009/09/23 16:01:56 each Exp $ */ +/* $Id: dnssec-settime.c,v 1.14 2009/09/29 15:06:06 fdupont Exp $ */ /*! \file */ @@ -48,6 +48,9 @@ int verbose; static isc_mem_t *mctx = NULL; +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void usage(void) { fprintf(stderr, "Usage:\n"); diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 3672947037..4e9ed94983 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -29,7 +29,7 @@ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-signzone.c,v 1.237 2009/09/25 23:48:10 tbox Exp $ */ +/* $Id: dnssec-signzone.c,v 1.238 2009/09/29 15:06:06 fdupont Exp $ */ /*! \file */ @@ -3273,6 +3273,9 @@ print_version(FILE *fp) { fprintf(fp, "; dnssec_signzone version " VERSION "\n"); } +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void usage(void) { fprintf(stderr, "Usage:\n"); diff --git a/bin/dnssec/dnssectool.h b/bin/dnssec/dnssectool.h index df714e703b..40213bcfd8 100644 --- a/bin/dnssec/dnssectool.h +++ b/bin/dnssec/dnssectool.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssectool.h,v 1.25 2009/09/04 02:31:29 marka Exp $ */ +/* $Id: dnssectool.h,v 1.26 2009/09/29 15:06:06 fdupont Exp $ */ #ifndef DNSSECTOOL_H #define DNSSECTOOL_H 1 @@ -27,8 +27,9 @@ typedef void (fatalcallback_t)(void); -void -fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); +ISC_PLATFORM_NORETURN_PRE void +fatal(const char *format, ...) +ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; void setfatalcallback(fatalcallback_t *callback); diff --git a/bin/named/include/named/main.h b/bin/named/include/named/main.h index e834539467..d91dd39871 100644 --- a/bin/named/include/named/main.h +++ b/bin/named/include/named/main.h @@ -15,15 +15,16 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: main.h,v 1.15 2007/06/19 23:46:59 tbox Exp $ */ +/* $Id: main.h,v 1.16 2009/09/29 15:06:06 fdupont Exp $ */ #ifndef NAMED_MAIN_H #define NAMED_MAIN_H 1 /*! \file */ -void -ns_main_earlyfatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); +ISC_PLATFORM_NORETURN_PRE void +ns_main_earlyfatal(const char *format, ...) +ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; void ns_main_earlywarning(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); diff --git a/bin/named/main.c b/bin/named/main.c index b0f0514133..c6a640dd95 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: main.c,v 1.173 2009/09/01 18:40:25 jinmei Exp $ */ +/* $Id: main.c,v 1.174 2009/09/29 15:06:06 fdupont Exp $ */ /*! \file */ @@ -138,6 +138,10 @@ ns_main_earlyfatal(const char *format, ...) { exit(1); } +ISC_PLATFORM_NORETURN_PRE static void +assertion_failed(const char *file, int line, isc_assertiontype_t type, + const char *cond) ISC_PLATFORM_NORETURN_POST; + static void assertion_failed(const char *file, int line, isc_assertiontype_t type, const char *cond) @@ -207,9 +211,10 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type, exit(1); } -static void +ISC_PLATFORM_NORETURN_PRE static void library_fatal_error(const char *file, int line, const char *format, - va_list args) ISC_FORMAT_PRINTF(3, 0); + va_list args) +ISC_FORMAT_PRINTF(3, 0) ISC_PLATFORM_NORETURN_POST; static void library_fatal_error(const char *file, int line, const char *format, diff --git a/bin/named/server.c b/bin/named/server.c index 4258ee9dcc..4f81a99361 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.548 2009/09/10 01:49:29 each Exp $ */ +/* $Id: server.c,v 1.549 2009/09/29 15:06:06 fdupont Exp $ */ /*! \file */ @@ -243,8 +243,8 @@ static const struct { { NULL, ISC_FALSE } }; -static void -fatal(const char *msg, isc_result_t result); +ISC_PLATFORM_NORETURN_PRE static void +fatal(const char *msg, isc_result_t result) ISC_PLATFORM_NORETURN_POST; static void ns_server_reload(isc_task_t *task, isc_event_t *event); diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index c62a8418bf..a24590ad54 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsupdate.c,v 1.172 2009/09/01 00:22:25 jinmei Exp $ */ +/* $Id: nsupdate.c,v 1.173 2009/09/29 15:06:06 fdupont Exp $ */ /*! \file */ @@ -181,8 +181,10 @@ typedef struct nsu_requestinfo { static void sendrequest(isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, dns_message_t *msg, dns_request_t **request); -static void -fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); + +ISC_PLATFORM_NORETURN_PRE static void +fatal(const char *format, ...) +ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; static void debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index 532ce901f7..6ea6355606 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rndc.c,v 1.125 2009/05/04 17:38:56 jreed Exp $ */ +/* $Id: rndc.c,v 1.126 2009/09/29 15:06:06 fdupont Exp $ */ /*! \file */ @@ -90,6 +90,9 @@ static isc_uint32_t serial; static void rndc_startconnect(isc_sockaddr_t *addr, isc_task_t *task); +ISC_PLATFORM_NORETURN_PRE static void +usage(int status) ISC_PLATFORM_NORETURN_POST; + static void usage(int status) { fprintf(stderr, "\ diff --git a/bin/rndc/util.h b/bin/rndc/util.h index 7adcaa5bfa..14b011ba52 100644 --- a/bin/rndc/util.h +++ b/bin/rndc/util.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: util.h,v 1.10 2007/06/19 23:46:59 tbox Exp $ */ +/* $Id: util.h,v 1.11 2009/09/29 15:06:06 fdupont Exp $ */ #ifndef RNDC_UTIL_H #define RNDC_UTIL_H 1 @@ -23,6 +23,7 @@ /*! \file */ #include +#include #include @@ -43,8 +44,9 @@ ISC_LANG_BEGINDECLS void notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2); -void -fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); +ISC_PLATFORM_NORETURN_PRE void +fatal(const char *format, ...) +ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; ISC_LANG_ENDDECLS diff --git a/bin/tools/nsec3hash.c b/bin/tools/nsec3hash.c index 65bddf6fec..13702674eb 100644 --- a/bin/tools/nsec3hash.c +++ b/bin/tools/nsec3hash.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsec3hash.c,v 1.4 2009/03/07 23:47:45 tbox Exp $ */ +/* $Id: nsec3hash.c,v 1.5 2009/09/29 15:06:06 fdupont Exp $ */ #include @@ -36,6 +36,9 @@ const char *program = "nsec3hash"; +ISC_PLATFORM_NORETURN_PRE static void +fatal(const char *format, ...) ISC_PLATFORM_NORETURN_POST; + static void fatal(const char *format, ...) { va_list args; diff --git a/configure.in b/configure.in index 6a2741ff3e..73c4477935 100644 --- a/configure.in +++ b/configure.in @@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl esyscmd([sed "s/^/# /" COPYRIGHT])dnl AC_DIVERT_POP()dnl -AC_REVISION($Revision: 1.479 $) +AC_REVISION($Revision: 1.480 $) AC_INIT(lib/dns/name.c) AC_PREREQ(2.59) @@ -338,6 +338,20 @@ AC_TRY_COMPILE([],[long long i = 0; return (0);], ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG"]) AC_SUBST(ISC_PLATFORM_HAVELONGLONG) +# +# check for GCC noreturn attribute +# +AC_MSG_CHECKING(for GCC noreturn attribute) +AC_TRY_COMPILE([],[void foo() __attribute__((noreturn));], + [AC_MSG_RESULT(yes) + ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE" + ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST __attribute__((noreturn))"], + [AC_MSG_RESULT(no) + ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE" + ISC_PLATFORM_NORETURN="#define ISC_PLATFORM_NORETURN_POST"]) +AC_SUBST(ISC_PLATFORM_NORETURN_PRE) +AC_SUBST(ISC_PLATFORM_NORETURN_POST) + # # check if we have lifconf # diff --git a/lib/dns/include/dns/rbt.h b/lib/dns/include/dns/rbt.h index bd11f40b13..a33bda4d34 100644 --- a/lib/dns/include/dns/rbt.h +++ b/lib/dns/include/dns/rbt.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rbt.h,v 1.73 2009/01/17 23:47:43 tbox Exp $ */ +/* $Id: rbt.h,v 1.74 2009/09/29 15:06:06 fdupont Exp $ */ #ifndef DNS_RBT_H #define DNS_RBT_H 1 @@ -909,7 +909,7 @@ dns_rbtnodechain_nextflat(dns_rbtnodechain_t *chain, dns_name_t *name); } while (0) #else /* DNS_RBT_USEISCREFCOUNT */ #define dns_rbtnode_refinit(node, n) ((node)->references = (n)) -#define dns_rbtnode_refdestroy(node) (REQUIRE((node)->references == 0)) +#define dns_rbtnode_refdestroy(node) REQUIRE((node)->references == 0) #define dns_rbtnode_refcurrent(node) ((node)->references) #define dns_rbtnode_refincrement0(node, refs) \ do { \ diff --git a/lib/export/samples/nsprobe.c b/lib/export/samples/nsprobe.c index e706e29023..1fc364c9d0 100644 --- a/lib/export/samples/nsprobe.c +++ b/lib/export/samples/nsprobe.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsprobe.c,v 1.4 2009/09/02 23:48:02 tbox Exp $ */ +/* $Id: nsprobe.c,v 1.5 2009/09/29 15:06:06 fdupont Exp $ */ #include @@ -1015,8 +1015,11 @@ probe_domain(struct probe_trans *trans) { return (result); } +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void -usage() { +usage(void) { fprintf(stderr, "usage: nsprobe [-d] [-v [-v...]] [-c cache_address] " "[input_file]\n"); diff --git a/lib/export/samples/sample-async.c b/lib/export/samples/sample-async.c index 014b6a65d0..e646e795e9 100644 --- a/lib/export/samples/sample-async.c +++ b/lib/export/samples/sample-async.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sample-async.c,v 1.4 2009/09/02 23:48:02 tbox Exp $ */ +/* $Id: sample-async.c,v 1.5 2009/09/29 15:06:07 fdupont Exp $ */ #include @@ -247,8 +247,11 @@ dispatch_query(struct query_trans *trans) { return (result); } +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void -usage() { +usage(void) { fprintf(stderr, "usage: sample-async [-s server_address] [-t RR type] " "input_file\n"); diff --git a/lib/export/samples/sample-request.c b/lib/export/samples/sample-request.c index 4d7d2fc9ef..d5d2312e30 100644 --- a/lib/export/samples/sample-request.c +++ b/lib/export/samples/sample-request.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sample-request.c,v 1.4 2009/09/02 23:48:02 tbox Exp $ */ +/* $Id: sample-request.c,v 1.5 2009/09/29 15:06:07 fdupont Exp $ */ #include @@ -57,8 +57,11 @@ static isc_mem_t *mctx; static dns_fixedname_t fixedqname; +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void -usage() { +usage(void) { fprintf(stderr, "sample-request [-t RRtype] server_address hostname\n"); exit(1); diff --git a/lib/export/samples/sample-update.c b/lib/export/samples/sample-update.c index c614e77c6e..7357106e7f 100644 --- a/lib/export/samples/sample-update.c +++ b/lib/export/samples/sample-update.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sample-update.c,v 1.4 2009/09/02 23:48:02 tbox Exp $ */ +/* $Id: sample-update.c,v 1.5 2009/09/29 15:06:07 fdupont Exp $ */ #include @@ -67,8 +67,11 @@ static void update_addordelete(isc_mem_t *mctx, char *cmdline, isc_boolean_t isdelete, dns_name_t *name); static void evaluate_prereq(isc_mem_t *mctx, char *cmdline, dns_name_t *name); +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void -usage() { +usage(void) { fprintf(stderr, "sample-update " "[-a auth_server] " "[-k keyfile] " diff --git a/lib/export/samples/sample.c b/lib/export/samples/sample.c index f547e893e9..7fc6a303ff 100644 --- a/lib/export/samples/sample.c +++ b/lib/export/samples/sample.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sample.c,v 1.4 2009/09/02 23:48:02 tbox Exp $ */ +/* $Id: sample.c,v 1.5 2009/09/29 15:06:07 fdupont Exp $ */ #include @@ -78,8 +78,11 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner) { return (ISC_R_SUCCESS); } +ISC_PLATFORM_NORETURN_PRE static void +usage(void) ISC_PLATFORM_NORETURN_POST; + static void -usage() { +usage(void) { fprintf(stderr, "sample [-t RRtype] " "[[-a algorithm] [-e] -k keyname -K keystring] " "[-s domain:serveraddr_for_domain ] " diff --git a/lib/isc/assertions.c b/lib/isc/assertions.c index 368e90052c..31c4fe7c9f 100644 --- a/lib/isc/assertions.c +++ b/lib/isc/assertions.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: assertions.c,v 1.25 2009/09/02 23:48:02 tbox Exp $ */ +/* $Id: assertions.c,v 1.26 2009/09/29 15:06:07 fdupont Exp $ */ /*! \file */ @@ -39,24 +39,33 @@ /*% * Forward. */ -/* coverity[+kill] */ static void default_callback(const char *, int, isc_assertiontype_t, const char *); +static isc_assertioncallback_t isc_assertion_failed_cb = default_callback; + /*% * Public. */ -LIBISC_EXTERNAL_DATA isc_assertioncallback_t isc_assertion_failed = - default_callback; +/*% assertion failed handler */ +/* coverity[+kill] */ +void +isc_assertion_failed(const char *file, int line, isc_assertiontype_t type, + const char *cond) +{ + isc_assertion_failed_cb(file, line, type, cond); + abort(); + /* NOTREACHED */ +} /*% Set callback. */ void isc_assertion_setcallback(isc_assertioncallback_t cb) { if (cb == NULL) - isc_assertion_failed = default_callback; + isc_assertion_failed_cb = default_callback; else - isc_assertion_failed = cb; + isc_assertion_failed_cb = cb; } /*% Type to Text */ @@ -127,6 +136,4 @@ default_callback(const char *file, int line, isc_assertiontype_t type, } } fflush(stderr); - abort(); - /* NOTREACHED */ } diff --git a/lib/isc/include/isc/assertions.h b/lib/isc/include/isc/assertions.h index b031152169..26d3fa1dbe 100644 --- a/lib/isc/include/isc/assertions.h +++ b/lib/isc/include/isc/assertions.h @@ -16,7 +16,7 @@ */ /* - * $Id: assertions.h,v 1.26 2008/10/15 23:47:31 tbox Exp $ + * $Id: assertions.h,v 1.27 2009/09/29 15:06:07 fdupont Exp $ */ /*! \file isc/assertions.h */ @@ -41,7 +41,9 @@ typedef void (*isc_assertioncallback_t)(const char *, int, isc_assertiontype_t, const char *); /* coverity[+kill] */ -LIBISC_EXTERNAL_DATA extern isc_assertioncallback_t isc_assertion_failed; +ISC_PLATFORM_NORETURN_PRE +void isc_assertion_failed(const char *, int, isc_assertiontype_t, + const char *) ISC_PLATFORM_NORETURN_POST; void isc_assertion_setcallback(isc_assertioncallback_t); diff --git a/lib/isc/include/isc/error.h b/lib/isc/include/isc/error.h index efb9b5f3a1..160b549b1e 100644 --- a/lib/isc/include/isc/error.h +++ b/lib/isc/include/isc/error.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: error.h,v 1.20 2007/06/19 23:47:18 tbox Exp $ */ +/* $Id: error.h,v 1.21 2009/09/29 15:06:07 fdupont Exp $ */ #ifndef ISC_ERROR_H #define ISC_ERROR_H 1 @@ -26,6 +26,7 @@ #include #include +#include ISC_LANG_BEGINDECLS @@ -45,9 +46,9 @@ isc_error_unexpected(const char *, int, const char *, ...) ISC_FORMAT_PRINTF(3, 4); /*% fatal error */ -void +ISC_PLATFORM_NORETURN_PRE void isc_error_fatal(const char *, int, const char *, ...) - ISC_FORMAT_PRINTF(3, 4); +ISC_FORMAT_PRINTF(3, 4) ISC_PLATFORM_NORETURN_POST; /*% runtimecheck error */ void diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index ef49d3298d..eb2ff0bfad 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: platform.h.in,v 1.52 2009/09/01 18:40:25 jinmei Exp $ */ +/* $Id: platform.h.in,v 1.53 2009/09/29 15:06:07 fdupont Exp $ */ #ifndef ISC_PLATFORM_H #define ISC_PLATFORM_H 1 @@ -294,6 +294,12 @@ */ @ISC_PLATFORM_OPENSSLHASH@ +/* + * Defines for the noreturn attribute. + */ +@ISC_PLATFORM_NORETURN_PRE@ +@ISC_PLATFORM_NORETURN_POST@ + /*** *** Windows dll support. ***/ diff --git a/lib/isc/include/isc/refcount.h b/lib/isc/include/isc/refcount.h index 6ab14ae732..98086b71a8 100644 --- a/lib/isc/include/isc/refcount.h +++ b/lib/isc/include/isc/refcount.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: refcount.h,v 1.15 2007/06/19 23:47:18 tbox Exp $ */ +/* $Id: refcount.h,v 1.16 2009/09/29 15:06:07 fdupont Exp $ */ #ifndef ISC_REFCOUNT_H #define ISC_REFCOUNT_H 1 @@ -103,7 +103,7 @@ typedef struct isc_refcount { isc_int32_t refs; } isc_refcount_t; -#define isc_refcount_destroy(rp) (REQUIRE((rp)->refs == 0)) +#define isc_refcount_destroy(rp) REQUIRE((rp)->refs == 0) #define isc_refcount_current(rp) ((unsigned int)((rp)->refs)) #define isc_refcount_increment0(rp, tp) \ @@ -192,7 +192,7 @@ typedef struct isc_refcount { int refs; } isc_refcount_t; -#define isc_refcount_destroy(rp) (REQUIRE((rp)->refs == 0)) +#define isc_refcount_destroy(rp) REQUIRE((rp)->refs == 0) #define isc_refcount_current(rp) ((unsigned int)((rp)->refs)) #define isc_refcount_increment0(rp, tp) \ diff --git a/lib/isc/win32/include/isc/platform.h b/lib/isc/win32/include/isc/platform.h index 3e23fe2b87..b9c0c26d50 100644 --- a/lib/isc/win32/include/isc/platform.h +++ b/lib/isc/win32/include/isc/platform.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: platform.h,v 1.17 2008/12/01 03:51:47 marka Exp $ */ +/* $Id: platform.h,v 1.18 2009/09/29 15:06:07 fdupont Exp $ */ #ifndef ISC_PLATFORM_H #define ISC_PLATFORM_H 1 @@ -63,6 +63,12 @@ */ #undef ISC_PLATFORM_HAVESYSUNH +/* + * Defines for the noreturn attribute. + */ +#define ISC_PLATFORM_NORETURN_PRE __declspec(noreturn) +#define ISC_PLATFORM_NORETURN_POST + /* * Set up a macro for importing and exporting from the DLL */ diff --git a/lib/isc/win32/libisc.def b/lib/isc/win32/libisc.def index 4133c419c6..c1eebe4011 100644 --- a/lib/isc/win32/libisc.def +++ b/lib/isc/win32/libisc.def @@ -48,6 +48,7 @@ isc__app_run isc__app_shutdown isc__app_start isc__app_unblock +isc_assertion_failed isc_assertion_setcallback isc_assertion_typetotext isc_backtrace_getsymbol @@ -552,7 +553,6 @@ syslog EXPORTS -isc_assertion_failed DATA isc_commandline_argument DATA isc_commandline_errprint DATA isc_commandline_index DATA