]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Make fixes for GCC 6 (#42721)
authorMukund Sivaraman <muks@isc.org>
Wed, 13 Jul 2016 08:24:12 +0000 (13:54 +0530)
committerMukund Sivaraman <muks@isc.org>
Wed, 13 Jul 2016 08:25:50 +0000 (13:55 +0530)
CHANGES
bin/dig/dighost.c
bin/named/client.c
bin/named/logconf.c
bin/tools/mdig.c
lib/dns/rdata/generic/opt_41.c
lib/isc/radix.c
lib/isc/unix/include/isc/offset.h
lib/isc/win32/include/isc/offset.h

diff --git a/CHANGES b/CHANGES
index 8a50133630b024906d3644ade1362ae8b06d0244..00c2b49a383ebd16a4fa0a02074b8cf7c1d36dd7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4412.  [cleanup]       Make fixes for GCC 6. ISC_OFFSET_MAXIMUM macro was
+                       removed. [RT #42721]
+
 4411.  [func]          "rndc dnstap -roll" automatically rolls the 
                        dnstap output file; the previous version is
                        saved with ".0" suffix, and earlier versions
index 7a3126b2d54ab854876360c5d9755794d61e52ed..d02f6c5ee7db8eb2882c0433aebfc701bf27f110 100644 (file)
@@ -2549,7 +2549,7 @@ setup_lookup(dig_lookup_t *lookup) {
 
                        /* Mask off last address byte */
                        if (addrl > 0 && (plen % 8) != 0)
-                               addr[addrl - 1] &= ~0 << (8 - (plen % 8));
+                               addr[addrl - 1] &= ~0U << (8 - (plen % 8));
 
                        /* family */
                        isc_buffer_putuint16(&b, family);
index e0c3558d8261aaae42f660986d17385a98d6e3cc..3faf6d2e11b24c5e5556f1581b34037f31186e3c 100644 (file)
@@ -2037,7 +2037,7 @@ process_ecs(ns_client_t *client, isc_buffer_t *buf, size_t optlen) {
                optlen -= addrbytes;
 
                if ((addrlen % 8) != 0) {
-                       isc_uint8_t bits = ~0 << (8 - (addrlen % 8));
+                       isc_uint8_t bits = ~0U << (8 - (addrlen % 8));
                        bits &= paddr[addrbytes - 1];
                        if (bits != paddr[addrbytes - 1])
                                return (DNS_R_OPTERR);
index 3dad682397cc3306ec688c4404088c9ea34022a7..5442e06399bae76c2931a5ce79a19536e0b65183 100644 (file)
@@ -135,6 +135,22 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig)
                                 cfg_tuple_get(fileobj, "versions");
                isc_int32_t versions = ISC_LOG_ROLLNEVER;
                isc_offset_t size = 0;
+               isc_uint64_t maxoffset;
+
+               /*
+                * isc_offset_t is a signed integer type, so the maximum
+                * value is all 1s except for the MSB.
+                */
+               switch (sizeof(isc_offset_t)) {
+               case 4:
+                       maxoffset = 0x7fffffffLLU;
+                       break;
+               case 8:
+                       maxoffset = 0x7fffffffffffffffLLU;
+                       break;
+               default:
+                       INSIST(0);
+               }
 
                type = ISC_LOG_TOFILE;
 
@@ -145,7 +161,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig)
                        versions = ISC_LOG_ROLLINFINITE;
                if (sizeobj != NULL &&
                    cfg_obj_isuint64(sizeobj) &&
-                   cfg_obj_asuint64(sizeobj) < ISC_OFFSET_MAXIMUM)
+                   cfg_obj_asuint64(sizeobj) < maxoffset)
                        size = (isc_offset_t)cfg_obj_asuint64(sizeobj);
                dest.file.stream = NULL;
                dest.file.name = cfg_obj_asstring(pathobj);
index 0c85ece6899b4a132d615a19fac7046d6b663148..9f63cd1523fe37b490a72a8d3346f2db4c99f475 100644 (file)
@@ -606,7 +606,7 @@ sendquery(struct query *query, isc_task_t *task)
                                memmove(addr, &sin->sin_addr, 4);
                                if ((plen % 8) != 0)
                                        addr[addrl-1] &=
-                                               ~0 << (8 - (plen % 8));
+                                               ~0U << (8 - (plen % 8));
                        } else {
                                family = 2;
                                sin6 = (struct sockaddr_in6 *) sa;
@@ -615,7 +615,7 @@ sendquery(struct query *query, isc_task_t *task)
 
                        /* Mask off last address byte */
                        if (addrl > 0 && (plen % 8) != 0)
-                               addr[addrl - 1] &= ~0 << (8 - (plen % 8));
+                               addr[addrl - 1] &= ~0U << (8 - (plen % 8));
 
                        /* family */
                        isc_buffer_putuint16(&b, family);
index 353ac25e1bf2e289518955496a9401a7ea1eda05..cd02399472075aa5d173d170c2810bb7985dfa95 100644 (file)
@@ -158,7 +158,7 @@ fromwire_opt(ARGS_FROMWIRE) {
                                return (DNS_R_OPTERR);
 
                        if (addrbytes != 0U && (addrlen % 8) != 0) {
-                               isc_uint8_t bits = ~0 << (8 - (addrlen % 8));
+                               isc_uint8_t bits = ~0U << (8 - (addrlen % 8));
                                bits &= sregion.base[addrbytes - 1];
                                if (bits != sregion.base[addrbytes - 1])
                                        return (DNS_R_OPTERR);
index b85ce5a30194e96f0818eaaee4561082bf99e3b1..415a660dfd42e35bb825b974d35ac4e116c1c1d2 100644 (file)
@@ -122,8 +122,8 @@ _comp_with_mask(void *addr, void *dest, u_int mask) {
                return (1);
 
        if (memcmp(addr, dest, mask / 8) == 0) {
-               int n = mask / 8;
-               int m = ((~0) << (8 - (mask % 8)));
+               u_int n = mask / 8;
+               u_int m = ((~0U) << (8 - (mask % 8)));
 
                if ((mask % 8) == 0 ||
                    (((u_char *)addr)[n] & m) == (((u_char *)dest)[n] & m))
index f28aa509da283ba8d5c591ec8c464875bcc8fb64..d63ae99f9f30bf41a9cb3960e844cc1e5542923c 100644 (file)
 
 typedef off_t isc_offset_t;
 
-/*%
- * POSIX says "Additionally, blkcnt_t and off_t are extended signed integral
- * types", so the maximum value is all 1s except for the high bit.
- * This definition is more complex than it really needs to be because it was
- * crafted to keep both the SunOS 5.6 and the HP/UX 11 compilers quiet about
- * integer overflow.  For example, though this is equivalent to just left
- * shifting 1 to the high bit and then inverting the bits, the SunOS compiler
- * is unhappy about shifting a positive "1" to negative in a signed integer.
- */
-#define ISC_OFFSET_MAXIMUM \
-       (~(((off_t)-1 >> (sizeof(off_t) * CHAR_BIT - 1)) \
-                     << (sizeof(off_t) * CHAR_BIT - 1)))
-
 #endif /* ISC_OFFSET_H */
index ce25f5784298ff594366c5614352594e15ea1ea6..ef26ea96a9aa38ea9b9fb052ddec68af30865a5c 100644 (file)
 
 typedef _off_t isc_offset_t;
 
-/*
- * POSIX says "Additionally, blkcnt_t and off_t are extended signed integral
- * types", so the maximum value is all 1s except for the high bit.
- * This definition is more complex than it really needs to be because it was
- * crafted to keep both the SunOS 5.6 and the HP/UX 11 compilers quiet about
- * integer overflow.  For example, though this is equivalent to just left
- * shifting 1 to the high bit and then inverting the bits, the SunOS compiler
- * is unhappy about shifting a positive "1" to negative in a signed integer.
- */
-#define ISC_OFFSET_MAXIMUM \
-       (~(((off_t)-1 >> (sizeof(off_t) * CHAR_BIT - 1)) \
-                     << (sizeof(off_t) * CHAR_BIT - 1)))
-
 #endif /* ISC_OFFSET_H */