From: Mark Andrews Date: Thu, 19 Oct 2017 01:26:32 +0000 (+1100) Subject: 4774. [bug] was incorrectly included in several X-Git-Tag: v9.12.0b2~107 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=fe79e2efbf94c10af2cc6abe7f7feb0437393e82;p=thirdparty%2Fbind9.git 4774. [bug] was incorrectly included in several header files. [RT #46311] --- diff --git a/CHANGES b/CHANGES index 0246afed7c8..8c3fd4ede6d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4774. [bug] was incorrectly included in several + header files. [RT #46311] + 4773. [doc] Fixed generating Doxygen documentation for functions annotated using certain macros. Miscellaneous Doxygen-related cleanups. [RT #46276] diff --git a/bin/named/logconf.c b/bin/named/logconf.c index c573bf8e313..e686cc22861 100644 --- a/bin/named/logconf.c +++ b/bin/named/logconf.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index 58992215486..b9370f875ae 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/bin/named/tsigconf.c b/bin/named/tsigconf.c index e892b4d1f4d..7f58a8112e8 100644 --- a/bin/named/tsigconf.c +++ b/bin/named/tsigconf.c @@ -16,6 +16,7 @@ #include #include #include +#include #include diff --git a/bin/tests/system/dyndb/driver/db.c b/bin/tests/system/dyndb/driver/db.c index 8d642021b6d..f3f03c8dde2 100644 --- a/bin/tests/system/dyndb/driver/db.c +++ b/bin/tests/system/dyndb/driver/db.c @@ -13,6 +13,7 @@ #include #include +#include #include #include diff --git a/bin/tests/system/dyndb/driver/syncptr.c b/bin/tests/system/dyndb/driver/syncptr.c index 2191bae087b..7ca2d3f2794 100644 --- a/bin/tests/system/dyndb/driver/syncptr.c +++ b/bin/tests/system/dyndb/driver/syncptr.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/lib/dns/catz.c b/lib/dns/catz.c index 156b37ed206..eaa30c2a304 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/lib/dns/include/dns/db.h b/lib/dns/include/dns/db.h index 2a8f315996f..0eb310aa1c2 100644 --- a/lib/dns/include/dns/db.h +++ b/lib/dns/include/dns/db.h @@ -45,6 +45,7 @@ ***** Imports *****/ +#include #include #include #include diff --git a/lib/dns/include/dns/rpz.h b/lib/dns/include/dns/rpz.h index 2fd604128a4..e59fa8abd77 100644 --- a/lib/dns/include/dns/rpz.h +++ b/lib/dns/include/dns/rpz.h @@ -10,12 +10,13 @@ #ifndef DNS_RPZ_H #define DNS_RPZ_H 1 +#include +#include +#include #include #include #include -#include #include -#include #include #include diff --git a/lib/dns/iptable.c b/lib/dns/iptable.c index 2522c4aa818..c02a1f0125b 100644 --- a/lib/dns/iptable.c +++ b/lib/dns/iptable.c @@ -10,6 +10,7 @@ #include #include +#include #include diff --git a/lib/dns/private.c b/lib/dns/private.c index a305d8a22b1..51e3d0aea1f 100644 --- a/lib/dns/private.c +++ b/lib/dns/private.c @@ -6,8 +6,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* $Id$ */ - #include "config.h" #include @@ -15,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/lib/dns/rrl.c b/lib/dns/rrl.c index 31166ed610c..2c346e9bff6 100644 --- a/lib/dns/rrl.c +++ b/lib/dns/rrl.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/lib/dns/tsec.c b/lib/dns/tsec.c index 11d1f8517db..39dfec30b22 100644 --- a/lib/dns/tsec.c +++ b/lib/dns/tsec.c @@ -6,11 +6,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* $Id: tsec.c,v 1.7 2010/12/09 00:54:34 marka Exp $ */ - #include #include +#include #include diff --git a/lib/isc/include/isc/Makefile.in b/lib/isc/include/isc/Makefile.in index 505b263ed76..26d4203b14c 100644 --- a/lib/isc/include/isc/Makefile.in +++ b/lib/isc/include/isc/Makefile.in @@ -17,12 +17,12 @@ VERSION=@BIND9_VERSION@ # HEADERS = aes.h app.h assertions.h backtrace.h base32.h base64.h \ bind9.h boolean.h buffer.h bufferlist.h \ - commandline.h counter.h crc64.h \ + commandline.h counter.h crc64.h deprecated.h \ entropy.h errno.h error.h event.h eventclass.h \ file.h formatcheck.h fsaccess.h fuzz.h \ hash.h heap.h hex.h hmacmd5.h hmacsha.h ht.h httpd.h \ interfaceiter.h @ISC_IPV6_H@ iterated_hash.h \ - json.h lang.h lex.h lfsr.h lib.h list.h log.h \ + json.h lang.h lex.h lfsr.h lib.h likely.h list.h log.h \ magic.h md5.h mem.h meminfo.h msgcat.h msgs.h mutexblock.h \ netaddr.h netscope.h ondestroy.h os.h parseint.h \ pool.h portset.h print.h queue.h quota.h \ diff --git a/lib/isc/include/isc/buffer.h b/lib/isc/include/isc/buffer.h index ae9fc412b83..c4f21b774df 100644 --- a/lib/isc/include/isc/buffer.h +++ b/lib/isc/include/isc/buffer.h @@ -96,6 +96,7 @@ *** Imports ***/ +#include #include #include #include diff --git a/lib/isc/include/isc/deprecated.h b/lib/isc/include/isc/deprecated.h new file mode 100644 index 00000000000..0b7f2a02ba3 --- /dev/null +++ b/lib/isc/include/isc/deprecated.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + + +#ifndef ISC_DEPRECATED_H +#define ISC_DEPRECATED_H + +#ifdef __GNUC__ +#define ISC_DEPRECATED __attribute__((deprecated)) +#else +#define ISC_DEPRECATED /* none */ +#endif /* __GNUC __ */ + +#endif diff --git a/lib/isc/include/isc/hash.h b/lib/isc/include/isc/hash.h index 8e007a380b4..e2f8fe46ca2 100644 --- a/lib/isc/include/isc/hash.h +++ b/lib/isc/include/isc/hash.h @@ -9,8 +9,8 @@ #ifndef ISC_HASH_H #define ISC_HASH_H 1 +#include #include -#include /***** ***** Module Info diff --git a/lib/isc/include/isc/likely.h b/lib/isc/include/isc/likely.h new file mode 100644 index 00000000000..14161a2d90d --- /dev/null +++ b/lib/isc/include/isc/likely.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef ISC_LIKELY_H +#define ISC_LIKELY_H 1 + +/*% + * Performance + */ +#ifdef HAVE_BUILTIN_EXPECT +#define ISC_LIKELY(x) __builtin_expect(!!(x), 1) +#define ISC_UNLIKELY(x) __builtin_expect(!!(x), 0) +#else +#define ISC_LIKELY(x) (x) +#define ISC_UNLIKELY(x) (x) +#endif + +#endif /* ISC_LIKELY_H */ diff --git a/lib/isc/include/isc/magic.h b/lib/isc/include/isc/magic.h index 6c4d54d4030..16099cf7f85 100644 --- a/lib/isc/include/isc/magic.h +++ b/lib/isc/include/isc/magic.h @@ -11,7 +11,7 @@ #ifndef ISC_MAGIC_H #define ISC_MAGIC_H 1 -#include +#include /*! \file isc/magic.h */ diff --git a/lib/isc/include/isc/refcount.h b/lib/isc/include/isc/refcount.h index 24ad9dae945..705cf12f949 100644 --- a/lib/isc/include/isc/refcount.h +++ b/lib/isc/include/isc/refcount.h @@ -11,12 +11,13 @@ #ifndef ISC_REFCOUNT_H #define ISC_REFCOUNT_H 1 +#include #include +#include #include #include #include #include -#include #if defined(ISC_PLATFORM_HAVESTDATOMIC) #include @@ -109,7 +110,7 @@ typedef struct isc_refcount { #define isc_refcount_current(rp) \ ((unsigned int)(atomic_load_explicit(&(rp)->refs, \ memory_order_relaxed))) -#define isc_refcount_destroy(rp) REQUIRE(isc_refcount_current(rp) == 0) +#define isc_refcount_destroy(rp) ISC_REQUIRE(isc_refcount_current(rp) == 0) #define isc_refcount_increment0(rp, tp) \ do { \ @@ -127,7 +128,7 @@ typedef struct isc_refcount { isc_int32_t prev; \ prev = atomic_fetch_add_explicit \ (&(rp)->refs, 1, memory_order_relaxed); \ - REQUIRE(prev > 0); \ + ISC_REQUIRE(prev > 0); \ if (_tmp != NULL) \ *_tmp = prev + 1; \ } while (0) @@ -138,7 +139,7 @@ typedef struct isc_refcount { isc_int32_t prev; \ prev = atomic_fetch_sub_explicit \ (&(rp)->refs, 1, memory_order_relaxed); \ - REQUIRE(prev > 0); \ + ISC_REQUIRE(prev > 0); \ if (_tmp != NULL) \ *_tmp = prev - 1; \ } while (0) @@ -147,7 +148,7 @@ typedef struct isc_refcount { #define isc_refcount_current(rp) \ ((unsigned int)(isc_atomic_xadd(&(rp)->refs, 0))) -#define isc_refcount_destroy(rp) REQUIRE(isc_refcount_current(rp) == 0) +#define isc_refcount_destroy(rp) ISC_REQUIRE(isc_refcount_current(rp) == 0) #define isc_refcount_increment0(rp, tp) \ do { \ @@ -163,7 +164,7 @@ typedef struct isc_refcount { unsigned int *_tmp = (unsigned int *)(tp); \ isc_int32_t prev; \ prev = isc_atomic_xadd(&(rp)->refs, 1); \ - REQUIRE(prev > 0); \ + ISC_REQUIRE(prev > 0); \ if (_tmp != NULL) \ *_tmp = prev + 1; \ } while (0) @@ -173,7 +174,7 @@ typedef struct isc_refcount { unsigned int *_tmp = (unsigned int *)(tp); \ isc_int32_t prev; \ prev = isc_atomic_xadd(&(rp)->refs, -1); \ - REQUIRE(prev > 0); \ + ISC_REQUIRE(prev > 0); \ if (_tmp != NULL) \ *_tmp = prev - 1; \ } while (0) @@ -188,46 +189,63 @@ typedef struct isc_refcount { } isc_refcount_t; /*% Destroys a reference counter. */ -#define isc_refcount_destroy(rp) \ - do { \ - REQUIRE((rp)->refs == 0); \ - DESTROYLOCK(&(rp)->lock); \ +#define isc_refcount_destroy(rp) \ + do { \ + isc_result_t _result; \ + ISC_REQUIRE((rp)->refs == 0); \ + _result = isc_mutex_destroy(&(rp)->lock); \ + ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ } while (0) #define isc_refcount_current(rp) ((unsigned int)((rp)->refs)) -/*% Increments the reference count, returning the new value in targetp if it's not NULL. */ -#define isc_refcount_increment0(rp, tp) \ - do { \ - unsigned int *_tmp = (unsigned int *)(tp); \ - LOCK(&(rp)->lock); \ - ++((rp)->refs); \ - if (_tmp != NULL) \ - *_tmp = ((rp)->refs); \ - UNLOCK(&(rp)->lock); \ +/*% + * Increments the reference count, returning the new value in + * 'tp' if it's not NULL. + */ +#define isc_refcount_increment0(rp, tp) \ + do { \ + isc_result_t _result; \ + unsigned int *_tmp = (unsigned int *)(tp); \ + _result = isc_mutex_lock(&(rp)->lock); \ + ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ + ++((rp)->refs); \ + if (_tmp != NULL) \ + *_tmp = ((rp)->refs); \ + _result = isc_mutex_unlock(&(rp)->lock); \ + ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ } while (0) -#define isc_refcount_increment(rp, tp) \ - do { \ - unsigned int *_tmp = (unsigned int *)(tp); \ - LOCK(&(rp)->lock); \ - REQUIRE((rp)->refs > 0); \ - ++((rp)->refs); \ - if (_tmp != NULL) \ - *_tmp = ((rp)->refs); \ - UNLOCK(&(rp)->lock); \ +#define isc_refcount_increment(rp, tp) \ + do { \ + isc_result_t _result; \ + unsigned int *_tmp = (unsigned int *)(tp); \ + _result = isc_mutex_lock(&(rp)->lock); \ + ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ + ISC_REQUIRE((rp)->refs > 0); \ + ++((rp)->refs); \ + if (_tmp != NULL) \ + *_tmp = ((rp)->refs); \ + _result = isc_mutex_unlock(&(rp)->lock); \ + ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ } while (0) -/*% Decrements the reference count, returning the new value in targetp if it's not NULL. */ -#define isc_refcount_decrement(rp, tp) \ - do { \ - unsigned int *_tmp = (unsigned int *)(tp); \ - LOCK(&(rp)->lock); \ - REQUIRE((rp)->refs > 0); \ - --((rp)->refs); \ - if (_tmp != NULL) \ - *_tmp = ((rp)->refs); \ - UNLOCK(&(rp)->lock); \ +/*% + * Decrements the reference count, returning the new value in 'tp' + * if it's not NULL. + */ +#define isc_refcount_decrement(rp, tp) \ + do { \ + isc_result_t _result; \ + unsigned int *_tmp = (unsigned int *)(tp); \ + _result = isc_mutex_lock(&(rp)->lock); \ + ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ + ISC_REQUIRE((rp)->refs > 0); \ + --((rp)->refs); \ + if (_tmp != NULL) \ + *_tmp = ((rp)->refs); \ + _result = isc_mutex_unlock(&(rp)->lock); \ + ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ } while (0) #endif /* (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || defined(ISC_PLATFORM_HAVEXADD) */ @@ -237,7 +255,7 @@ typedef struct isc_refcount { int refs; } isc_refcount_t; -#define isc_refcount_destroy(rp) REQUIRE((rp)->refs == 0) +#define isc_refcount_destroy(rp) ISC_REQUIRE((rp)->refs == 0) #define isc_refcount_current(rp) ((unsigned int)((rp)->refs)) #define isc_refcount_increment0(rp, tp) \ @@ -252,7 +270,7 @@ typedef struct isc_refcount { do { \ unsigned int *_tmp = (unsigned int *)(tp); \ int _n; \ - REQUIRE((rp)->refs > 0); \ + ISC_REQUIRE((rp)->refs > 0); \ _n = ++(rp)->refs; \ if (_tmp != NULL) \ *_tmp = _n; \ @@ -262,7 +280,7 @@ typedef struct isc_refcount { do { \ unsigned int *_tmp = (unsigned int *)(tp); \ int _n; \ - REQUIRE((rp)->refs > 0); \ + ISC_REQUIRE((rp)->refs > 0); \ _n = --(rp)->refs; \ if (_tmp != NULL) \ *_tmp = _n; \ diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index f2cda262c35..c85d52ac8c7 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -6,8 +6,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* $Id$ */ - #ifndef ISC_UTIL_H #define ISC_UTIL_H 1 @@ -200,13 +198,7 @@ /*% * Performance */ -#ifdef HAVE_BUILTIN_EXPECT -#define ISC_LIKELY(x) __builtin_expect(!!(x), 1) -#define ISC_UNLIKELY(x) __builtin_expect(!!(x), 0) -#else -#define ISC_LIKELY(x) (x) -#define ISC_UNLIKELY(x) (x) -#endif +#include /* * Assertions @@ -240,12 +232,8 @@ #define TIME_NOW(tp) RUNTIME_CHECK(isc_time_now((tp)) == ISC_R_SUCCESS) /*% - * Misc. + * Misc */ -#ifdef __GNUC__ -#define ISC_DEPRECATED __attribute__((deprecated)) -#else -#define ISC_DEPRECATED /* none */ -#endif /* __GNUC __ */ +#include #endif /* ISC_UTIL_H */ diff --git a/lib/isc/refcount.c b/lib/isc/refcount.c index 2fee52d997a..e5820f497ef 100644 --- a/lib/isc/refcount.c +++ b/lib/isc/refcount.c @@ -15,6 +15,7 @@ #include #include #include +#include isc_result_t isc_refcount_init(isc_refcount_t *ref, unsigned int n) { diff --git a/lib/isc/x86_32/include/isc/atomic.h b/lib/isc/x86_32/include/isc/atomic.h index 17005a2466a..c8b121158c1 100644 --- a/lib/isc/x86_32/include/isc/atomic.h +++ b/lib/isc/x86_32/include/isc/atomic.h @@ -122,12 +122,10 @@ isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { * positions of the stack frame, which would not actually point to the * intended address in the embedded mnemonic. */ -#include /* for 'UNUSED' macro */ - static isc_int32_t isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { - UNUSED(p); - UNUSED(val); + (void)(p); + (void)(val); __asm ( "movl 8(%ebp), %ecx\n" @@ -148,8 +146,8 @@ isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { static void isc_atomic_store(isc_int32_t *p, isc_int32_t val) { - UNUSED(p); - UNUSED(val); + (void)(p); + (void)(val); __asm ( "movl 8(%ebp), %ecx\n" @@ -163,9 +161,9 @@ isc_atomic_store(isc_int32_t *p, isc_int32_t val) { static isc_int32_t isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { - UNUSED(p); - UNUSED(cmpval); - UNUSED(val); + (void)(p); + (void)(cmpval); + (void)(val); __asm ( "movl 8(%ebp), %ecx\n" diff --git a/lib/isc/x86_64/include/isc/atomic.h b/lib/isc/x86_64/include/isc/atomic.h index f0267834df7..ef5140f1ecd 100644 --- a/lib/isc/x86_64/include/isc/atomic.h +++ b/lib/isc/x86_64/include/isc/atomic.h @@ -27,12 +27,11 @@ * registers for arguments, which would not actually correspond to the * intended address or value in the embedded mnemonic. */ -#include /* for 'UNUSED' macro */ static isc_int32_t isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { - UNUSED(p); - UNUSED(val); + (void)(p); + (void)(val); __asm ( "movq %rdi, %rdx\n" @@ -50,8 +49,8 @@ isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { #ifdef ISC_PLATFORM_HAVEXADDQ static isc_int64_t isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) { - UNUSED(p); - UNUSED(val); + (void)(p); + (void)(val); __asm ( "movq %rdi, %rdx\n" @@ -69,8 +68,8 @@ isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) { static void isc_atomic_store(isc_int32_t *p, isc_int32_t val) { - UNUSED(p); - UNUSED(val); + (void)(p); + (void)(val); __asm ( "movq %rdi, %rax\n" @@ -85,8 +84,8 @@ isc_atomic_store(isc_int32_t *p, isc_int32_t val) { #ifdef ISC_PLATFORM_HAVEATOMICSTOREQ static void isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) { - UNUSED(p); - UNUSED(val); + (void)(p); + (void)(val); __asm ( "movq %rdi, %rax\n" @@ -101,9 +100,9 @@ isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) { static isc_int32_t isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { - UNUSED(p); - UNUSED(cmpval); - UNUSED(val); + (void)(p); + (void)(cmpval); + (void)(val); __asm ( /* diff --git a/lib/ns/server.c b/lib/ns/server.c index 2c5dc36251c..559704fec67 100644 --- a/lib/ns/server.c +++ b/lib/ns/server.c @@ -12,6 +12,7 @@ #include #include +#include #include #include