BIND 10 trac826, updated. bb716290447c9f45ecb29dd979ce114669a1c65f [trac826] Cleanup (including less warnings and Linux/GCC compat)

BIND 10 source code commits bind10-changes at lists.isc.org
Thu May 5 12:13:00 UTC 2011


The branch, trac826 has been updated
       via  bb716290447c9f45ecb29dd979ce114669a1c65f (commit)
      from  4d0d8ac7760d6673ac435118267a4e2f0ef9bab9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bb716290447c9f45ecb29dd979ce114669a1c65f
Author: Francis Dupont <fdupont at isc.org>
Date:   Thu May 5 14:11:46 2011 +0200

    [trac826] Cleanup (including less warnings and Linux/GCC compat)

-----------------------------------------------------------------------

Summary of changes:
 WIN32-NOTES                                        |    4 +-
 src/lib/asiodns/dns_lookup.h                       |    2 +-
 src/lib/asiodns/dns_server.h                       |    2 +-
 src/lib/asiodns/dns_service.cc                     |    3 +
 src/lib/asiodns/io_fetch.cc                        |    7 +++
 src/lib/asiodns/io_fetch.h                         |    2 +-
 src/lib/asiodns/tcp_server.h                       |    2 +
 src/lib/asiodns/tests/dns_server_unittest.cc       |    2 +-
 src/lib/asiodns/tests/io_fetch_unittest.cc         |   23 ++++++++-
 src/lib/asiodns/udp_server.cc                      |    3 +
 src/lib/asiodns/udp_server.h                       |    4 +-
 src/lib/asiolink/interval_timer.cc                 |    3 +
 src/lib/asiolink/simple_callback.h                 |    2 +-
 src/lib/asiolink/tcp_socket.h                      |    9 +++-
 src/lib/asiolink/tests/interval_timer_unittest.cc  |   11 +++++
 src/lib/asiolink/tests/udp_socket_unittest.cc      |    4 +-
 src/lib/cache/message_entry.cc                     |    4 +-
 src/lib/cache/resolver_cache.cc                    |    6 +-
 src/lib/cache/resolver_cache.h                     |    2 +
 src/lib/cache/tests/message_entry_unittest.cc      |    2 +
 src/lib/cache/tests/negative_cache_unittest.cc     |    6 +-
 src/lib/cache/tests/rrset_entry_unittest.cc        |    6 +-
 src/lib/cc/data.cc                                 |   20 +++++++--
 src/lib/cc/data.h                                  |   10 ++++
 src/lib/config/ccsession.h                         |    2 +
 src/lib/config/module_spec.cc                      |    9 ++++
 src/lib/config/module_spec.h                       |    9 ++++
 src/lib/config/tests/fake_session.cc               |   11 ++---
 src/lib/cryptolink/crypto_hmac.cc                  |    9 ++++
 src/lib/cryptolink/cryptolink.cc                   |    8 +++
 src/lib/datasrc/data_source.cc                     |   14 ++++++
 src/lib/datasrc/data_source.h                      |    4 ++
 src/lib/datasrc/memory_datasrc.cc                  |    4 ++
 src/lib/datasrc/memory_datasrc.h                   |    4 ++
 src/lib/datasrc/rbtree.h                           |    8 ++--
 src/lib/datasrc/sqlite3_datasrc.h                  |    9 ++++
 src/lib/datasrc/static_datasrc.cc                  |    3 +
 src/lib/datasrc/tests/cache_unittest.cc            |    2 +-
 src/lib/datasrc/tests/memory_datasrc_unittest.cc   |    4 ++
 src/lib/datasrc/tests/rbtree_unittest.cc           |    2 +-
 src/lib/datasrc/tests/test_datasrc.cc              |   48 ++++++++++++-------
 src/lib/datasrc/zone.h                             |    4 ++
 src/lib/datasrc/zonetable.h                        |    4 ++
 src/lib/dns/edns.h                                 |    2 +-
 src/lib/dns/message.cc                             |    9 ++++
 src/lib/dns/messagerenderer.cc                     |    2 +-
 src/lib/dns/messagerenderer.h                      |    5 ++
 src/lib/dns/rcode.h                                |    2 +
 src/lib/dns/rdata/any_255/tsig_250.cc              |    6 +++
 src/lib/dns/rdata/generic/dnskey_48.cc             |    5 ++-
 src/lib/dns/rdata/generic/ds_43.cc                 |    3 +
 src/lib/dns/rdata/generic/nsec3_50.cc              |    2 +-
 src/lib/dns/rdata/generic/nsec3param_51.cc         |    3 +
 src/lib/dns/rdata/generic/nsec_47.cc               |    2 +-
 src/lib/dns/rdata/generic/rrsig_46.cc              |    3 +
 src/lib/dns/rdatafields.cc                         |    7 ++-
 src/lib/dns/rrclass-placeholder.h                  |    2 +
 src/lib/dns/tests/edns_unittest.cc                 |    2 +-
 src/lib/dns/tests/masterload_unittest.cc           |    4 ++
 src/lib/dns/tests/message_unittest.cc              |    2 +-
 src/lib/dns/tests/name_unittest.cc                 |    2 +-
 src/lib/dns/tests/unittest_util.cc                 |    4 +-
 src/lib/dns/tsig.h                                 |    2 +
 src/lib/dns/tsigkey.cc                             |    3 +
 src/lib/dns/tsigkey.h                              |    4 ++
 src/lib/exceptions/exceptions.h                    |   13 +++++
 src/lib/log/compiler/message.cc                    |    2 +-
 src/lib/log/logger_levels.h                        |    2 +
 src/lib/nsas/hash_deleter.h                        |    2 +
 src/lib/nsas/hash_key.cc                           |    2 +-
 src/lib/nsas/nameserver_entry.cc                   |    9 ++++
 src/lib/nsas/zone_entry.cc                         |    9 ++++
 src/lib/resolve/recursive_query.cc                 |   12 +++---
 src/lib/resolve/recursive_query.h                  |    2 +
 src/lib/resolve/resolve.cc                         |    4 ++
 src/lib/resolve/response_classifier.cc             |    8 ++--
 src/lib/resolve/tests/recursive_query_unittest.cc  |   11 ++++-
 .../resolve/tests/recursive_query_unittest_2.cc    |   13 +++++-
 .../resolve/tests/resolver_callback_unittest.cc    |    9 ++++
 src/lib/resolve/tests/run_unittests.cc             |   10 ++--
 src/lib/server_common/portconfig.cc                |    3 +
 src/lib/testutils/dnsmessage_test.h                |    5 ++
 src/lib/util/encode/base_n.cc                      |    9 ++++
 src/lib/util/random/random_number_generator.h      |    9 +++-
 src/lib/util/strutil.cc                            |    2 +-
 src/lib/util/tests/base32hex_unittest.cc           |    2 +-
 src/lib/util/tests/hex_unittest.cc                 |    2 +-
 .../util/tests/random_number_generator_unittest.cc |    4 ++
 src/lib/util/time_utilities.cc                     |    2 +-
 89 files changed, 425 insertions(+), 94 deletions(-)

-----------------------------------------------------------------------
diff --git a/WIN32-NOTES b/WIN32-NOTES
index fae3eff..bceef05 100644
--- a/WIN32-NOTES
+++ b/WIN32-NOTES
@@ -4,7 +4,9 @@ What is needed:
 
  - POSIX (aka Unix) environment for tar/git/etc (I use cygwin)
 
- - Visual Studio C++ (versions 2008 and 2010 were tested)
+ - Visual Studio C++ (versions 2008 and 2010 were tested,
+  note older versions could fail to correctly compile,
+  cf. C4373 warning)
 
  - python >= 3.1 (I got Cpython 3.2 MSI from python.org,
   note the pre-built python can give C++ runtime issue with
diff --git a/src/lib/asiodns/dns_lookup.h b/src/lib/asiodns/dns_lookup.h
index 40290e4..f79c507 100644
--- a/src/lib/asiodns/dns_lookup.h
+++ b/src/lib/asiodns/dns_lookup.h
@@ -51,7 +51,7 @@ protected:
     ///
     /// This is intentionally defined as \c protected as this base class
     /// should never be instantiated (except as part of a derived class).
-    DNSLookup() : self_(this) {}
+    DNSLookup() { self_ = this; }
 public:
     /// \brief The destructor
     virtual ~DNSLookup() {}
diff --git a/src/lib/asiodns/dns_server.h b/src/lib/asiodns/dns_server.h
index f235860..3361e3b 100644
--- a/src/lib/asiodns/dns_server.h
+++ b/src/lib/asiodns/dns_server.h
@@ -53,7 +53,7 @@ protected:
     /// This is intentionally defined as \c protected, as this base class
     /// should never be instantiated except as part of a derived class.
     //@{
-    DNSServer() : self_(this) {}
+    DNSServer() { self_ = this; }
 public:
     /// \brief The destructor
     virtual ~DNSServer() {}
diff --git a/src/lib/asiodns/dns_service.cc b/src/lib/asiodns/dns_service.cc
index c76df21..94f98e2 100644
--- a/src/lib/asiodns/dns_service.cc
+++ b/src/lib/asiodns/dns_service.cc
@@ -121,6 +121,9 @@ public:
         }
         addServer(portnum, address);
     }
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    DNSServiceImpl& operator=(DNSServiceImpl const&);
 };
 
 DNSServiceImpl::DNSServiceImpl(IOService& io_service,
diff --git a/src/lib/asiodns/io_fetch.cc b/src/lib/asiodns/io_fetch.cc
index d24233e..96adff9 100644
--- a/src/lib/asiodns/io_fetch.cc
+++ b/src/lib/asiodns/io_fetch.cc
@@ -52,6 +52,10 @@
 #include <util/buffer.h>
 #include <util/random/qid_gen.h>
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4351)
+#endif
 
 using namespace asio;
 using namespace isc::asiolink;
@@ -410,3 +414,6 @@ void IOFetch::logIOFailure(asio::error_code ec) {
 } // namespace asiodns
 } // namespace isc {
 
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/src/lib/asiodns/io_fetch.h b/src/lib/asiodns/io_fetch.h
index 98c917d..c34d8a6 100644
--- a/src/lib/asiodns/io_fetch.h
+++ b/src/lib/asiodns/io_fetch.h
@@ -34,7 +34,7 @@ namespace isc {
 namespace asiodns {
 
 // Forward declarations
-class IOFetchData;
+struct IOFetchData;
 
 /// \brief Upstream Fetch Processing
 ///
diff --git a/src/lib/asiodns/tcp_server.h b/src/lib/asiodns/tcp_server.h
index 22a2f69..f87a6bb 100644
--- a/src/lib/asiodns/tcp_server.h
+++ b/src/lib/asiodns/tcp_server.h
@@ -117,6 +117,8 @@ private:
 
     boost::shared_ptr<isc::asiolink::IOEndpoint> peer_;
     boost::shared_ptr<isc::asiolink::IOSocket> iosock_;
+    // silence MSVC warning C4512: assignment operator could not be generated
+    TCPServer& operator=(TCPServer const&);
 };
 
 } // namespace asiodns
diff --git a/src/lib/asiodns/tests/dns_server_unittest.cc b/src/lib/asiodns/tests/dns_server_unittest.cc
index c782ddb..445b0d1 100644
--- a/src/lib/asiodns/tests/dns_server_unittest.cc
+++ b/src/lib/asiodns/tests/dns_server_unittest.cc
@@ -452,7 +452,7 @@ TEST_F(DNSServerTest, stopUDPServerDuringPrepareAnswer) {
 }
 
 static void stopServerManyTimes(DNSServer *server, unsigned int times) {
-    for (int i = 0; i < times; ++i) {
+    for (unsigned int i = 0; i < times; ++i) {
         server->stop();
     }
 }
diff --git a/src/lib/asiodns/tests/io_fetch_unittest.cc b/src/lib/asiodns/tests/io_fetch_unittest.cc
index 42afe07..5b897f7 100644
--- a/src/lib/asiodns/tests/io_fetch_unittest.cc
+++ b/src/lib/asiodns/tests/io_fetch_unittest.cc
@@ -43,6 +43,11 @@
 #include <asiolink/io_service.h>
 #include <asiodns/io_fetch.h>
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4351)
+#endif
+
 using namespace asio;
 using namespace isc::dns;
 using namespace isc::util;
@@ -106,9 +111,9 @@ public:
         result_buff_(new OutputBuffer(512)),
         msgbuf_(new OutputBuffer(512)),
         udp_fetch_(IOFetch::UDP, service_, question_, IOAddress(TEST_HOST),
-            TEST_PORT, result_buff_, this, 100),
+            TEST_PORT, result_buff_, NULL, 100),
         tcp_fetch_(IOFetch::TCP, service_, question_, IOAddress(TEST_HOST),
-            TEST_PORT, result_buff_, this, (16 * SEND_INTERVAL)),
+            TEST_PORT, result_buff_, NULL, (16 * SEND_INTERVAL)),
                                         // Timeout interval chosen to ensure no timeout
         protocol_(IOFetch::TCP),        // for initialization - will be changed
         cumulative_(0),
@@ -125,6 +130,14 @@ public:
         qid_1(0),
         tcp_short_send_(false)
     {
+        // use 'this'
+        udp_fetch_ = IOFetch(IOFetch::UDP, service_,
+            question_, IOAddress(TEST_HOST),
+            TEST_PORT, result_buff_, this, 100);
+        tcp_fetch_ = IOFetch(IOFetch::TCP, service_,
+            question_, IOAddress(TEST_HOST),
+            TEST_PORT, result_buff_, this, (16 * SEND_INTERVAL));
+
         // Construct the data buffer for question we expect to receive.
         Message msg(Message::RENDER);
         msg.setQid(0);
@@ -220,7 +233,7 @@ public:
     ///
     /// \param socket Socket on which data will be received
     /// \param ec Boost error code, value should be zero.
-  void tcpAcceptHandler(tcp::socket* socket,
+    void tcpAcceptHandler(tcp::socket* socket,
                         asio::error_code ec = asio::error_code())
     {
         if (debug_) {
@@ -735,3 +748,7 @@ TEST_F(IOFetchTest, TcpSendReceive8192ShortSend) {
 
 } // namespace asiodns
 } // namespace isc
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/src/lib/asiodns/udp_server.cc b/src/lib/asiodns/udp_server.cc
index 29b7b31..8a37948 100644
--- a/src/lib/asiodns/udp_server.cc
+++ b/src/lib/asiodns/udp_server.cc
@@ -162,6 +162,9 @@ struct UDPServer::Data {
 
     std::auto_ptr<IOEndpoint> peer_;
     std::auto_ptr<IOSocket> iosock_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    Data& operator=(Data const&);
 };
 
 /// The following functions implement the \c UDPServer class.
diff --git a/src/lib/asiodns/udp_server.h b/src/lib/asiodns/udp_server.h
index 4c19544..5d32300 100644
--- a/src/lib/asiodns/udp_server.h
+++ b/src/lib/asiodns/udp_server.h
@@ -94,12 +94,12 @@ private:
      * \brief Internal state and data.
      *
      * We use the pimple design pattern, but not because we need to hide
-     * internal data. This class and whole header is for private use anyway.
+     * internal data. This struct and whole header is for private use anyway.
      * It turned out that UDPServer is copied a lot, because it is a coroutine.
      * This way the overhead of copying is lower, we copy only one shared
      * pointer instead of about 10 of them.
      */
-    class Data;
+    struct Data;
     boost::shared_ptr<Data> data_;
 };
 
diff --git a/src/lib/asiolink/interval_timer.cc b/src/lib/asiolink/interval_timer.cc
index 0af05b5..1cbe909 100644
--- a/src/lib/asiolink/interval_timer.cc
+++ b/src/lib/asiolink/interval_timer.cc
@@ -98,6 +98,9 @@ IntervalTimerImpl::update() {
         // Update expire time to (current time + interval_).
         timer_.expires_from_now(boost::posix_time::millisec(interval_));
     } catch (const asio::system_error& e) {
+#ifdef _MSC_VER
+        e;
+#endif
         isc_throw(isc::Unexpected, "Failed to update timer");
     }
     // Reset timer.
diff --git a/src/lib/asiolink/simple_callback.h b/src/lib/asiolink/simple_callback.h
index 92093ec..6cb07e2 100644
--- a/src/lib/asiolink/simple_callback.h
+++ b/src/lib/asiolink/simple_callback.h
@@ -49,7 +49,7 @@ protected:
     ///
     /// This is intentionally defined as \c protected as this base class
     /// should never be instantiated (except as part of a derived class).
-    SimpleCallback() : self_(this) {}
+    SimpleCallback() { self_ = this; }
 public:
     /// \brief The destructor
     virtual ~SimpleCallback() {}
diff --git a/src/lib/asiolink/tcp_socket.h b/src/lib/asiolink/tcp_socket.h
index 2f4a45b..85fc7e7 100644
--- a/src/lib/asiolink/tcp_socket.h
+++ b/src/lib/asiolink/tcp_socket.h
@@ -43,6 +43,10 @@
 #include <asiolink/io_service.h>
 #include <asiolink/tcp_endpoint.h>
 
+#if defined(_WIN32) && defined(min)
+#undef min
+#endif
+
 namespace isc {
 namespace asiolink {
 
@@ -279,6 +283,9 @@ TCPSocket<C>::asyncSend(const void* data, size_t length,
             socket_.async_send(asio::buffer(send_buffer_->getData(),
                                send_buffer_->getLength()), callback);
         } catch (boost::numeric::bad_numeric_cast& e) {
+#ifdef _MSC_VER
+            e;
+#endif
             isc_throw(BufferTooLarge,
                       "attempt to send buffer larger than 64kB");
         }
@@ -386,7 +393,7 @@ TCPSocket<C>::processReceivedData(const void* staging, size_t length,
 
         // Still need data in the output packet.  Copy what we can from the
         // staging buffer to the output buffer.
-        size_t copy_amount = min(expected - outbuff->getLength(), data_length);
+        size_t copy_amount = std::min(expected - outbuff->getLength(), data_length);
         outbuff->writeData(data, copy_amount);
     }
 
diff --git a/src/lib/asiolink/tests/interval_timer_unittest.cc b/src/lib/asiolink/tests/interval_timer_unittest.cc
index 059ec22..e89c129 100644
--- a/src/lib/asiolink/tests/interval_timer_unittest.cc
+++ b/src/lib/asiolink/tests/interval_timer_unittest.cc
@@ -96,6 +96,10 @@ protected:
         TimerCallBackCounter& counter_;
         int count_;
         int prev_counter_;
+        // silence MSVC warning C4512:
+        // assignment operator could not be generated
+        TimerCallBackCancelDeleter& operator=(TimerCallBackCancelDeleter const&);
+
     };
     class TimerCallBackCanceller {
     public:
@@ -109,6 +113,10 @@ protected:
     private:
         unsigned int& counter_;
         IntervalTimer& itimer_;
+        // silence MSVC warning C4512:
+        // assignment operator could not be generated
+        TimerCallBackCanceller& operator=(TimerCallBackCanceller const&);
+
     };
     class TimerCallBackOverwriter : public std::unary_function<void, void> {
     public:
@@ -135,6 +143,9 @@ protected:
         IntervalTimerTest* test_obj_;
         IntervalTimer& timer_;
         int count_;
+        // silence MSVC warning C4512:
+        // assignment operator could not be generated
+        TimerCallBackOverwriter& operator=(TimerCallBackOverwriter const&);
     };
 protected:
     IOService io_service_;
diff --git a/src/lib/asiolink/tests/udp_socket_unittest.cc b/src/lib/asiolink/tests/udp_socket_unittest.cc
index acf13de..d4669f6 100644
--- a/src/lib/asiolink/tests/udp_socket_unittest.cc
+++ b/src/lib/asiolink/tests/udp_socket_unittest.cc
@@ -331,7 +331,9 @@ TEST(UDPSocket, SequenceTest) {
 
     // ...and check that the data was copied to the output client buffer.
     const char* client_char_data = static_cast<const char*>(client_buffer->getData());
-    EXPECT_TRUE(equal(&data[0], &data[client_cb.getLength() - 1], client_char_data));
+    EXPECT_TRUE(equal(&data[0],
+                &data[client_cb.getLength() - 1],
+                client_char_data));
 
     // Close client and server.
     EXPECT_NO_THROW(client.close());
diff --git a/src/lib/cache/message_entry.cc b/src/lib/cache/message_entry.cc
index 850c7e5..f7703ee 100644
--- a/src/lib/cache/message_entry.cc
+++ b/src/lib/cache/message_entry.cc
@@ -22,7 +22,9 @@
 #include "message_utility.h"
 #include "rrset_cache.h"
 
+#if defined(_WIN32) && defined(max)
 #undef max
+#endif
 
 using namespace isc::dns;
 using namespace std;
@@ -156,7 +158,7 @@ MessageEntry::genMessage(const time_t& time_now,
         msg.setHeaderFlag(Message::HEADERFLAG_AA, false);
         msg.setHeaderFlag(Message::HEADERFLAG_TC, headerflag_tc_);
 
-        bool dnssec_need = msg.getEDNS().get();
+        bool dnssec_need = msg.getEDNS().get() != 0;
         addRRset(msg, rrset_entry_vec, Message::SECTION_ANSWER, dnssec_need);
         addRRset(msg, rrset_entry_vec, Message::SECTION_AUTHORITY, dnssec_need);
         addRRset(msg, rrset_entry_vec, Message::SECTION_ADDITIONAL, dnssec_need);
diff --git a/src/lib/cache/resolver_cache.cc b/src/lib/cache/resolver_cache.cc
index 261db3c..19acbbf 100644
--- a/src/lib/cache/resolver_cache.cc
+++ b/src/lib/cache/resolver_cache.cc
@@ -144,14 +144,14 @@ ResolverCache::ResolverCache()
 
 ResolverCache::ResolverCache(std::vector<CacheSizeInfo> caches_info)
 {
-    for (int i = 0; i < caches_info.size(); ++i) {
+    for (unsigned int i = 0; i < caches_info.size(); ++i) {
         class_caches_.push_back(new ResolverClassCache(caches_info[i]));
     }
 }
 
 ResolverCache::~ResolverCache()
 {
-    for (int i = 0; i < class_caches_.size(); ++i) {
+    for (unsigned int i = 0; i < class_caches_.size(); ++i) {
         delete class_caches_[i];
     }
 }
@@ -239,7 +239,7 @@ ResolverCache::load(const std::string&) {
 
 ResolverClassCache*
 ResolverCache::getClassCache(const isc::dns::RRClass& cache_class) const {
-    for (int i = 0; i < class_caches_.size(); ++i) {
+    for (unsigned int i = 0; i < class_caches_.size(); ++i) {
         if (class_caches_[i]->getClass() == cache_class) {
             return (class_caches_[i]);
         }
diff --git a/src/lib/cache/resolver_cache.h b/src/lib/cache/resolver_cache.h
index 49818b5..15fee24 100644
--- a/src/lib/cache/resolver_cache.h
+++ b/src/lib/cache/resolver_cache.h
@@ -194,6 +194,8 @@ private:
 
     /// \brief cache the SOA rrset parsed from the negative response message.
     RRsetCachePtr negative_soa_cache_;
+    // silence MSVC warning C4512: assignment operator could not be generated
+    ResolverClassCache& operator=(ResolverClassCache const&);
 };
 
 class ResolverCache {
diff --git a/src/lib/cache/tests/message_entry_unittest.cc b/src/lib/cache/tests/message_entry_unittest.cc
index 8bd315a..5f5e0b0 100644
--- a/src/lib/cache/tests/message_entry_unittest.cc
+++ b/src/lib/cache/tests/message_entry_unittest.cc
@@ -28,7 +28,9 @@ using namespace isc;
 using namespace isc::dns;
 using namespace std;
 
+#if defined(_WIN32) && defined(max)
 #undef max
+#endif
 
 static uint32_t MAX_UINT32 = numeric_limits<uint32_t>::max();
 
diff --git a/src/lib/cache/tests/negative_cache_unittest.cc b/src/lib/cache/tests/negative_cache_unittest.cc
index cd817aa..3059519 100644
--- a/src/lib/cache/tests/negative_cache_unittest.cc
+++ b/src/lib/cache/tests/negative_cache_unittest.cc
@@ -78,9 +78,9 @@ TEST_F(NegativeCacheTest, testNXDOMAIN){
     EXPECT_EQ(soa_ttl.getValue(), 172800);
 
 #ifdef _WIN32
-	Sleep(1000);
+    Sleep(1000);
 #else
-	sleep(1);
+    sleep(1);
 #endif
 
     // Query nonexist.example.com again
@@ -202,7 +202,7 @@ TEST_F(NegativeCacheTest, testNoerrorNodata){
     msg_nodata2.makeResponse();
 
 #ifdef _WIN32
-	Sleep(1000);
+    Sleep(1000);
 #else
     sleep(1);
 #endif
diff --git a/src/lib/cache/tests/rrset_entry_unittest.cc b/src/lib/cache/tests/rrset_entry_unittest.cc
index 6fc93d2..c2cc663 100644
--- a/src/lib/cache/tests/rrset_entry_unittest.cc
+++ b/src/lib/cache/tests/rrset_entry_unittest.cc
@@ -83,7 +83,7 @@ TEST_F(RRsetEntryTest, constructor) {
 TEST_F(RRsetEntryTest, updateTTL) {
     uint32_t ttl = rrset_entry.getTTL();
 #ifdef _WIN32
-	Sleep(1000);
+    Sleep(1000);
 #else
     sleep(1);
 #endif
@@ -95,14 +95,14 @@ TEST_F(RRsetEntryTest, TTLExpire) {
     RRset exp_rrset(name, RRClass::IN(), RRType::A(), RRTTL(1));
     RRsetEntry rrset_entry(exp_rrset, RRSET_TRUST_ANSWER_AA);
 #ifdef _WIN32
-	Sleep(1000);
+    Sleep(1000);
 #else
     sleep(1);
 #endif
     uint32_t ttl = rrset_entry.getTTL();
     EXPECT_LT(ttl, 1);
 #ifdef _WIN32
-	Sleep(1000);
+    Sleep(1000);
 #else
     sleep(1);
 #endif
diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc
index e62608d..0f52eee 100644
--- a/src/lib/cc/data.cc
+++ b/src/lib/cc/data.cc
@@ -28,6 +28,11 @@
 
 #include <cmath>
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4290)
+#endif
+
 using namespace std;
 
 namespace isc {
@@ -747,6 +752,9 @@ MapElement::find(const std::string& id, ConstElementPtr t) const {
         }
     } catch (const TypeError& e) {
         // ignore
+#ifdef _MSC_VER
+        e;
+#endif
     }
     return (false);
 }
@@ -783,11 +791,11 @@ StringElement::equals(const Element& other) const {
 bool
 ListElement::equals(const Element& other) const {
     if (other.getType() == Element::list) {
-        const int s = size();
+        const unsigned int s = size();
         if (s != other.size()) {
             return (false);
         }
-        for (int i = 0; i < s; ++i) {
+        for (unsigned int i = 0; i < s; ++i) {
             if (!get(i)->equals(*other.get(i))) {
                 return (false);
             }
@@ -853,8 +861,8 @@ removeIdentical(ElementPtr a, ConstElementPtr b) {
         if (b->contains((*it).first)) {
             if (a->get((*it).first)->equals(*b->get((*it).first))) {
                 a->remove((*it).first);
-		// temporary fix
-		goto again;
+                // temporary fix
+                goto again;
             }
         }
     }
@@ -904,3 +912,7 @@ merge(ElementPtr element, ConstElementPtr other) {
 
 }
 }
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/src/lib/cc/data.h b/src/lib/cc/data.h
index 0a363f4..f9d5840 100644
--- a/src/lib/cc/data.h
+++ b/src/lib/cc/data.h
@@ -22,6 +22,11 @@
 #include <stdexcept>
 #include <exceptions/exceptions.h>
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4290 4373)
+#endif
+
 namespace isc { namespace data {
 
 class Element;
@@ -567,6 +572,11 @@ std::ostream& operator<<(std::ostream& out, const Element& e);
 bool operator==(const Element& a, const Element& b);
 bool operator!=(const Element& a, const Element& b);
 } }
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
 #endif // _ISC_DATA_H
 
 // Local Variables: 
diff --git a/src/lib/config/ccsession.h b/src/lib/config/ccsession.h
index d8d1eeb..2580f1d 100644
--- a/src/lib/config/ccsession.h
+++ b/src/lib/config/ccsession.h
@@ -285,6 +285,8 @@ private:
     std::map<std::string, ConfigData> remote_module_configs_;
     void updateRemoteConfig(const std::string& module_name,
                             isc::data::ConstElementPtr new_config);
+    // silence MSVC warning C4512: assignment operator could not be generated
+    ModuleCCSession& operator=(ModuleCCSession const&);
 };
 
 }
diff --git a/src/lib/config/module_spec.cc b/src/lib/config/module_spec.cc
index 1621fe3..b4fb48f 100644
--- a/src/lib/config/module_spec.cc
+++ b/src/lib/config/module_spec.cc
@@ -22,6 +22,11 @@
 
 #include <boost/foreach.hpp>
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4290)
+#endif
+
 // todo: add more context to thrown ModuleSpecErrors?
 
 using namespace isc::data;
@@ -393,3 +398,7 @@ ModuleSpec::validateSpecList(ConstElementPtr spec, ConstElementPtr data,
 
 }
 }
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/src/lib/config/module_spec.h b/src/lib/config/module_spec.h
index ab6e273..a25668a 100644
--- a/src/lib/config/module_spec.h
+++ b/src/lib/config/module_spec.h
@@ -20,6 +20,11 @@
 
 #include <sstream>
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4290)
+#endif
+
 namespace isc { namespace config {
 
     ///
@@ -184,6 +189,10 @@ namespace isc { namespace config {
                        throw(isc::data::JSONError, ModuleSpecError);
 } }
 
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
 #endif // _DATA_DEF_H
 
 // Local Variables: 
diff --git a/src/lib/config/tests/fake_session.cc b/src/lib/config/tests/fake_session.cc
index b397d36..e26ae20 100644
--- a/src/lib/config/tests/fake_session.cc
+++ b/src/lib/config/tests/fake_session.cc
@@ -56,16 +56,13 @@ listContains(ConstElementPtr list, ConstElementPtr el) {
 
 void
 listRemove(ElementPtr list, ConstElementPtr el) {
-    int i = -1;
-    int j = 0;
+    int i = 0;
     BOOST_FOREACH(ConstElementPtr s_el, list->listValue()) {
         if (*el == *s_el) {
-            i = j;
+            list->remove(i);
+            return;
         }
-        j++;
-    }
-    if (i >= 0) {
-        list->remove(i);
+        i++;
     }
 }
 // endwant
diff --git a/src/lib/cryptolink/crypto_hmac.cc b/src/lib/cryptolink/crypto_hmac.cc
index 9c35f60..804d3b6 100644
--- a/src/lib/cryptolink/crypto_hmac.cc
+++ b/src/lib/cryptolink/crypto_hmac.cc
@@ -12,6 +12,11 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4290 4512)
+#endif
+
 #include <cryptolink.h>
 #include <cryptolink/crypto_hmac.h>
 
@@ -235,3 +240,7 @@ deleteHMAC(HMAC* hmac) {
 
 } // namespace cryptolink
 } // namespace isc
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/src/lib/cryptolink/cryptolink.cc b/src/lib/cryptolink/cryptolink.cc
index d1c375d..50453ee 100644
--- a/src/lib/cryptolink/cryptolink.cc
+++ b/src/lib/cryptolink/cryptolink.cc
@@ -12,6 +12,11 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4290 4512)
+#endif
+
 #include <cryptolink/cryptolink.h>
 #include <cryptolink/crypto_hmac.h>
 
@@ -67,3 +72,6 @@ CryptoLink::createHMAC(const void* secret, size_t secret_len,
 } // namespace cryptolink
 } // namespace isc
 
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/src/lib/datasrc/data_source.cc b/src/lib/datasrc/data_source.cc
index 548a811..1861be3 100644
--- a/src/lib/datasrc/data_source.cc
+++ b/src/lib/datasrc/data_source.cc
@@ -39,11 +39,22 @@
 
 #include <cc/data.h>
 
+#ifdef _MSC_VER
+#define RETERR(x) __pragma(warning(push)) \
+                  __pragma(warning(disable: 4127)) \
+                  do { \
+                      DataSrc::Result r = (x); \
+                      if (r != DataSrc::SUCCESS) \
+                          return (r); \
+                      } while (0) \
+                    __pragma(warning(pop))
+#else
 #define RETERR(x) do { \
                       DataSrc::Result r = (x); \
                       if (r != DataSrc::SUCCESS) \
                           return (r); \
                       } while (0)
+#endif
 
 using namespace std;
 using namespace isc::util;
@@ -60,6 +71,9 @@ struct MatchRRsetForType {
         return (rrset->getType() == rrtype_);
     }
     const RRType rrtype_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    MatchRRsetForType& operator=(MatchRRsetForType const&);
 };
 
 // This is a helper to retrieve a specified RR type of RRset from RRsetList.
diff --git a/src/lib/datasrc/data_source.h b/src/lib/datasrc/data_source.h
index 4337b1b..9422524 100644
--- a/src/lib/datasrc/data_source.h
+++ b/src/lib/datasrc/data_source.h
@@ -27,7 +27,9 @@
 #include <dns/rrclass.h>
 #include <cc/data.h>
 
+#if defined(_WIN32) && defined(ERROR)
 #undef ERROR
+#endif
 
 namespace isc {
 
@@ -408,6 +410,8 @@ private:
     const uint8_t flags_;
     const uint16_t iterations_;
     const std::vector<uint8_t> salt_;
+    // silence MSVC warning C4512: assignment operator could not be generated
+    Nsec3Param& operator=(Nsec3Param const&);
 };
 
 }
diff --git a/src/lib/datasrc/memory_datasrc.cc b/src/lib/datasrc/memory_datasrc.cc
index 5230ced..58a6a5f 100644
--- a/src/lib/datasrc/memory_datasrc.cc
+++ b/src/lib/datasrc/memory_datasrc.cc
@@ -295,6 +295,10 @@ struct MemoryZone::MemoryZoneImpl {
         const DomainNode* dname_node_;
         ConstRRsetPtr rrset_;
         const FindOptions options_;
+    private:
+        // silence MSVC warning C4512:
+        // assignment operator could not be generated
+        FindState& operator=(FindState const&);
     };
 
     // A callback called from possible zone cut nodes and nodes with DNAME.
diff --git a/src/lib/datasrc/memory_datasrc.h b/src/lib/datasrc/memory_datasrc.h
index 99bb4e8..ea4a35f 100644
--- a/src/lib/datasrc/memory_datasrc.h
+++ b/src/lib/datasrc/memory_datasrc.h
@@ -231,6 +231,10 @@ public:
         {}
         const result::Result code;
         const ZonePtr zone;
+    private:
+        // silence MSVC warning C4512:
+        // assignment operator could not be generated
+        FindResult& operator=(FindResult const&);
     };
 
     ///
diff --git a/src/lib/datasrc/rbtree.h b/src/lib/datasrc/rbtree.h
index 65d19a6..559898a 100644
--- a/src/lib/datasrc/rbtree.h
+++ b/src/lib/datasrc/rbtree.h
@@ -294,15 +294,15 @@ private:
 // This is only to support NULL nodes.
 template <typename T>
 RBNode<T>::RBNode() :
-    parent_(this),
-    left_(this),
-    right_(this),
     color_(BLACK),
     // dummy name, the value doesn't matter:
     name_(isc::dns::Name::ROOT_NAME()),
-    down_(this),
     flags_(0)
 {
+    parent_ = this;
+    left_ = this;
+    right_ = this;
+    down_ = this;
 }
 
 template <typename T>
diff --git a/src/lib/datasrc/sqlite3_datasrc.h b/src/lib/datasrc/sqlite3_datasrc.h
index d4abef7..617d4b0 100644
--- a/src/lib/datasrc/sqlite3_datasrc.h
+++ b/src/lib/datasrc/sqlite3_datasrc.h
@@ -21,6 +21,11 @@
 
 #include <datasrc/data_source.h>
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4373)
+#endif
+
 namespace isc {
 
 namespace dns {
@@ -117,6 +122,10 @@ private:
 }
 }
 
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
 #endif // __DATA_SOURCE_SQLITE3_H
 
 // Local Variables: 
diff --git a/src/lib/datasrc/static_datasrc.cc b/src/lib/datasrc/static_datasrc.cc
index 025078a..db5ae8e 100644
--- a/src/lib/datasrc/static_datasrc.cc
+++ b/src/lib/datasrc/static_datasrc.cc
@@ -61,6 +61,9 @@ public:
     RRsetPtr version;
     RRsetPtr version_ns;
     RRsetPtr version_soa;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    StaticDataSrcImpl& operator=(StaticDataSrcImpl const&);
 };
 
 StaticDataSrcImpl::StaticDataSrcImpl() :
diff --git a/src/lib/datasrc/tests/cache_unittest.cc b/src/lib/datasrc/tests/cache_unittest.cc
index ad4f69d..9f8c3a7 100644
--- a/src/lib/datasrc/tests/cache_unittest.cc
+++ b/src/lib/datasrc/tests/cache_unittest.cc
@@ -213,7 +213,7 @@ TEST_F(CacheTest, expire) {
     cache.addPositive(aaaa, 0, 2);
 
 #ifdef _WIN32
-	Sleep(3000);
+    Sleep(3000);
 #else
     sleep(3);
 #endif
diff --git a/src/lib/datasrc/tests/memory_datasrc_unittest.cc b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
index 89c03ab..1ca042f 100644
--- a/src/lib/datasrc/tests/memory_datasrc_unittest.cc
+++ b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
@@ -158,7 +158,11 @@ class MemoryZoneTest : public ::testing::Test {
     // A straightforward pair of textual RR(set) and a RRsetPtr variable
     // to store the RRset.  Used to build test data below.
     struct RRsetData {
+#ifdef _MSC_VER
+        char* text; // textual representation of an RRset
+#else
         const char* const text; // textual representation of an RRset
+#endif
         RRsetPtr* rrset;
     };
 public:
diff --git a/src/lib/datasrc/tests/rbtree_unittest.cc b/src/lib/datasrc/tests/rbtree_unittest.cc
index ef6d8db..5da22ca 100644
--- a/src/lib/datasrc/tests/rbtree_unittest.cc
+++ b/src/lib/datasrc/tests/rbtree_unittest.cc
@@ -35,7 +35,7 @@ using namespace isc::datasrc;
 // XXX: some compilers cannot find class static constants used in
 // EXPECT_xxx macros, for which we need an explicit empty definition.
 /// put the right #ifdef here
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__GNUC__)
 const size_t Name::MAX_LABELS;
 #endif
 
diff --git a/src/lib/datasrc/tests/test_datasrc.cc b/src/lib/datasrc/tests/test_datasrc.cc
index d78e7db..66ba3d2 100644
--- a/src/lib/datasrc/tests/test_datasrc.cc
+++ b/src/lib/datasrc/tests/test_datasrc.cc
@@ -80,23 +80,29 @@ namespace {
 // For simplicity we use the same single TTL for all test RRs.
 const uint32_t TEST_TTL = 3600;
 
+#ifdef _MSC_VER
+#define PODconst
+#else
+#define PODconst const
+#endif
+
 struct RRData {
-    const char* const name;
-    const char* const rrtype;
-    const char* const rdata;
+    PODconst char* PODconst name;
+    PODconst char* PODconst rrtype;
+    PODconst char* PODconst rdata;
 };
 
 struct ZoneData {
-    const char* const zone_name;
-    const char* const rrclass;
-    const struct RRData* records;
-    const struct RRData* glue_records;
+    PODconst char* PODconst zone_name;
+    PODconst char* PODconst rrclass;
+    PODconst struct RRData* records;
+    PODconst struct RRData* glue_records;
 };
 
 //
 // zone data for example.com
 //
-const struct RRData example_com_records[] = {
+PODconst struct RRData example_com_records[] = {
     // example.com
     {"example.com", "NS", "dns01.example.com"},
     {"example.com", "NS", "dns02.example.com"},
@@ -200,7 +206,7 @@ const struct RRData example_com_records[] = {
     {NULL, NULL, NULL}
 };
 
-const struct RRData example_com_glue_records[] = {
+PODconst struct RRData example_com_glue_records[] = {
     {"ns1.subzone.example.com", "A", "192.0.2.1"},
     {"ns2.subzone.example.com", "A", "192.0.2.2"},
     {NULL, NULL, NULL}
@@ -209,7 +215,7 @@ const struct RRData example_com_glue_records[] = {
 //
 // zone data for sql1.example.com
 //
-const struct RRData sql1_example_com_records[] = {
+PODconst struct RRData sql1_example_com_records[] = {
     {"sql1.example.com", "NS", "dns01.example.com"},
     {"sql1.example.com", "NS", "dns02.example.com"},
     {"sql1.example.com", "NS", "dns03.example.com"},
@@ -231,7 +237,7 @@ const struct RRData sql1_example_com_records[] = {
 //
 // zone data for loop.example
 //
-const struct RRData loop_example_records[] = {
+PODconst struct RRData loop_example_records[] = {
     {"loop.example", "SOA", "master.loop.example admin.loop.example. "
      "1234 3600 1800 2419200 7200"},
     {"loop.example", "NS", "ns.loop.example"},
@@ -243,7 +249,7 @@ const struct RRData loop_example_records[] = {
 //
 // zone data for nons.example
 //
-const struct RRData nons_example_records[] = {
+PODconst struct RRData nons_example_records[] = {
     {"nons.example", "SOA", "master.nons.example admin.nons.example. "
      "1234 3600 1800 2419200 7200"},
     {"www.nons.example", "A", "192.0.2.1"},
@@ -260,7 +266,7 @@ const struct RRData nons_example_records[] = {
     {NULL, NULL, NULL}
 };
 
-const struct RRData nons_example_glue_records[] = {
+PODconst struct RRData nons_example_glue_records[] = {
     {"ns.incompletechild.nons.example", "A", "192.0.2.1"},
     {NULL, NULL, NULL}
 };
@@ -268,7 +274,7 @@ const struct RRData nons_example_glue_records[] = {
 //
 // zone data for nons-dname.example
 //
-const struct RRData nonsdname_example_records[] = {
+PODconst struct RRData nonsdname_example_records[] = {
     {"nons-dname.example", "SOA", "master.nons-dname.example "
      "admin.nons-dname.example. 1234 3600 1800 2419200 7200"},
     {"nons-dname.example", "DNAME", "example.org"},
@@ -280,7 +286,7 @@ const struct RRData nonsdname_example_records[] = {
 //
 // zone data for nosoa.example
 //
-const struct RRData nosoa_example_records[] = {
+PODconst struct RRData nosoa_example_records[] = {
     {"nosoa.example", "NS", "ns.nosoa.example"},
     {"www.nosoa.example", "A", "192.0.2.1"},
     {"ns.nosoa.example", "A", "192.0.2.2"},
@@ -290,7 +296,7 @@ const struct RRData nosoa_example_records[] = {
 //
 // zone data for apexcname.example.
 //
-const struct RRData apexcname_example_records[] = {
+PODconst struct RRData apexcname_example_records[] = {
     {"apexcname.example", "CNAME", "canonical.apexcname.example"},
     {"canonical.apexcname.example", "SOA",
      "master.apexcname.example "
@@ -302,14 +308,14 @@ const struct RRData apexcname_example_records[] = {
 //
 // empty data set, for convenience.
 //
-const struct RRData empty_records[] = {
+PODconst struct RRData empty_records[] = {
     {NULL, NULL, NULL}
 };
 
 //
 // test zones
 //
-const struct ZoneData zone_data[] = {
+PODconst struct ZoneData zone_data[] = {
     { "example.com", "IN", example_com_records, example_com_glue_records },
     { "sql1.example.com", "IN", sql1_example_com_records, empty_records },
     { "loop.example", "IN", loop_example_records, empty_records },
@@ -425,6 +431,9 @@ struct ZoneNameMatch : public unary_function<Name, bool> {
         return (zone.zone_name == name_);
     }
     const Name& name_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    ZoneNameMatch& operator=(ZoneNameMatch const&);
 };
 
 // XXX: the main data source module can override the returned RRset.
@@ -510,6 +519,9 @@ public:
     uint32_t& flags_;
     bool name_found_;
     bool has_delegation_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    RRsetMatch& operator=(RRsetMatch const&);
 };
 
 void
diff --git a/src/lib/datasrc/zone.h b/src/lib/datasrc/zone.h
index 1252c94..61c87a3 100644
--- a/src/lib/datasrc/zone.h
+++ b/src/lib/datasrc/zone.h
@@ -98,6 +98,10 @@ public:
         {}
         const Result code;
         const isc::dns::ConstRRsetPtr rrset;
+    private:
+        // silence MSVC warning C4512:
+        // assignment operator could not be generated
+        FindResult& operator=(FindResult const&);
     };
 
     /// Find options.
diff --git a/src/lib/datasrc/zonetable.h b/src/lib/datasrc/zonetable.h
index 5b873d1..d777c74 100644
--- a/src/lib/datasrc/zonetable.h
+++ b/src/lib/datasrc/zonetable.h
@@ -46,6 +46,10 @@ public:
         {}
         const result::Result code;
         const ZonePtr zone;
+    private:
+        // silence MSVC warning C4512:
+        // assignment operator could not be generated
+        FindResult& operator=(FindResult const&);
     };
     ///
     /// \name Constructors and Destructor.
diff --git a/src/lib/dns/edns.h b/src/lib/dns/edns.h
index b0ab09f..01476b1 100644
--- a/src/lib/dns/edns.h
+++ b/src/lib/dns/edns.h
@@ -370,7 +370,7 @@ private:
     uint16_t udp_size_;
     bool dnssec_aware_;
     // silence MSVC warning C4512: assignment operator could not be generated
-    EDNS& operator= (EDNS const&);
+    EDNS& operator=(EDNS const&);
 };
 
 /// \brief Create a new \c EDNS object from a set of RR parameters, also
diff --git a/src/lib/dns/message.cc b/src/lib/dns/message.cc
index 279259c..3a2da24 100644
--- a/src/lib/dns/message.cc
+++ b/src/lib/dns/message.cc
@@ -393,6 +393,9 @@ struct RenderSection {
     MessageRenderer& renderer_;
     const bool partial_ok_;
     bool truncated_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    RenderSection& operator=(RenderSection const&);
 };
 }
 
@@ -576,6 +579,9 @@ struct MatchRR : public unary_function<RRsetPtr, bool> {
     const Name& name_;
     const RRType& rrtype_;
     const RRClass& rrclass_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    MatchRR& operator=(MatchRR const&);
 };
 }
 
@@ -679,6 +685,9 @@ struct SectionFormatter {
     }
     const Message::Section section_;
     string& output_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    SectionFormatter& operator=(SectionFormatter const&);
 };
 }
 
diff --git a/src/lib/dns/messagerenderer.cc b/src/lib/dns/messagerenderer.cc
index 767aca9..fc961a0 100644
--- a/src/lib/dns/messagerenderer.cc
+++ b/src/lib/dns/messagerenderer.cc
@@ -117,7 +117,7 @@ private:
                           uint16_t pos, uint16_t& llen) const
     {
         if (llen == 0) {
-            int i = 0;
+            unsigned int i = 0;
 
             while ((buffer[pos] & Name::COMPRESS_POINTER_MARK8) ==
                    Name::COMPRESS_POINTER_MARK8) {
diff --git a/src/lib/dns/messagerenderer.h b/src/lib/dns/messagerenderer.h
index 52d9245..a338209 100644
--- a/src/lib/dns/messagerenderer.h
+++ b/src/lib/dns/messagerenderer.h
@@ -297,6 +297,9 @@ public:
     /// \param compress A boolean indicating whether to enable name compression.
     virtual void writeName(const Name& name, bool compress = true) = 0;
     //@}
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    AbstractMessageRenderer& operator=(AbstractMessageRenderer const&);
 };
 
 /// The \c MessageRenderer is a concrete derived class of
@@ -333,6 +336,8 @@ public:
 private:
     struct MessageRendererImpl;
     MessageRendererImpl* impl_;
+    // silence MSVC warning C4512: assignment operator could not be generated
+    MessageRenderer& operator=(MessageRenderer const&);
 };
 }
 }
diff --git a/src/lib/dns/rcode.h b/src/lib/dns/rcode.h
index e58ee6b..9baca37 100644
--- a/src/lib/dns/rcode.h
+++ b/src/lib/dns/rcode.h
@@ -21,7 +21,9 @@
 #ifndef __RCODE_H
 #define __RCODE_H 1
 
+#if defined(_WIN32) && defined(NOERROR)
 #undef NOERROR
+#endif
 
 namespace isc {
 namespace dns {
diff --git a/src/lib/dns/rdata/any_255/tsig_250.cc b/src/lib/dns/rdata/any_255/tsig_250.cc
index f2bd7ad..a161046 100644
--- a/src/lib/dns/rdata/any_255/tsig_250.cc
+++ b/src/lib/dns/rdata/any_255/tsig_250.cc
@@ -63,6 +63,9 @@ struct TSIG::TSIGImpl {
     const uint16_t original_id_;
     const uint16_t error_;
     const vector<uint8_t> other_data_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    TSIGImpl& operator=(TSIGImpl const&);
 };
 
 namespace {
@@ -93,6 +96,9 @@ tokenToNum(const string& num_token) {
     try {
         num = lexical_cast<NumType>(num_token);
     } catch (const boost::bad_lexical_cast& ex) {
+#ifdef _MSC_VER
+        ex;
+#endif
         isc_throw(InvalidRdataText, "Invalid TSIG numeric parameter: " <<
                   num_token);
     }
diff --git a/src/lib/dns/rdata/generic/dnskey_48.cc b/src/lib/dns/rdata/generic/dnskey_48.cc
index e0f5461..696b454 100644
--- a/src/lib/dns/rdata/generic/dnskey_48.cc
+++ b/src/lib/dns/rdata/generic/dnskey_48.cc
@@ -49,6 +49,9 @@ struct DNSKEYImpl {
     uint8_t protocol_;
     uint8_t algorithm_;
     const vector<uint8_t> keydata_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    DNSKEYImpl& operator=(DNSKEYImpl const&);
 };
 
 DNSKEY::DNSKEY(const string& dnskey_str) :
@@ -181,7 +184,7 @@ DNSKEY::getTag() const {
     ac += impl_->algorithm_;
     
     size_t size = impl_->keydata_.size();
-    for (int i = 0; i < size; i ++) {
+    for (unsigned int i = 0; i < size; i ++) {
         ac += (i & 1) ? impl_->keydata_[i] : (impl_->keydata_[i] << 8);
     }
     ac += (ac >> 16) & 0xffff;
diff --git a/src/lib/dns/rdata/generic/ds_43.cc b/src/lib/dns/rdata/generic/ds_43.cc
index 1b48456..000f48f 100644
--- a/src/lib/dns/rdata/generic/ds_43.cc
+++ b/src/lib/dns/rdata/generic/ds_43.cc
@@ -49,6 +49,9 @@ struct DSImpl {
     uint8_t algorithm_;
     uint8_t digest_type_;
     const vector<uint8_t> digest_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    DSImpl& operator=(DSImpl const&);
 };
 
 DS::DS(const string& ds_str) :
diff --git a/src/lib/dns/rdata/generic/nsec3_50.cc b/src/lib/dns/rdata/generic/nsec3_50.cc
index 3bd0bb2..2479371 100644
--- a/src/lib/dns/rdata/generic/nsec3_50.cc
+++ b/src/lib/dns/rdata/generic/nsec3_50.cc
@@ -221,7 +221,7 @@ string
 NSEC3::toText() const {
     ostringstream s;
     int len = 0;
-    for (int i = 0; i < impl_->typebits_.size(); i += len) {
+    for (unsigned int i = 0; i < impl_->typebits_.size(); i += len) {
         assert(i + 2 <= impl_->typebits_.size());
         int window = impl_->typebits_[i];
         len = impl_->typebits_[i + 1];
diff --git a/src/lib/dns/rdata/generic/nsec3param_51.cc b/src/lib/dns/rdata/generic/nsec3param_51.cc
index 49f666b..6ebe6d7 100644
--- a/src/lib/dns/rdata/generic/nsec3param_51.cc
+++ b/src/lib/dns/rdata/generic/nsec3param_51.cc
@@ -47,6 +47,9 @@ struct NSEC3PARAMImpl {
     uint8_t flags_;
     uint16_t iterations_;
     const vector<uint8_t> salt_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    NSEC3PARAMImpl& operator=(NSEC3PARAMImpl const&);
 };
 
 NSEC3PARAM::NSEC3PARAM(const string& nsec3param_str) :
diff --git a/src/lib/dns/rdata/generic/nsec_47.cc b/src/lib/dns/rdata/generic/nsec_47.cc
index 93b8b5f..9091ada 100644
--- a/src/lib/dns/rdata/generic/nsec_47.cc
+++ b/src/lib/dns/rdata/generic/nsec_47.cc
@@ -143,7 +143,7 @@ NSEC::toText() const {
     // and easier to find a bug (if any).  Note that this conversion method
     // is generally not expected to be very efficient, so the slight overhead
     // of at() should be acceptable.
-    for (int i = 0; i < impl_->typebits_.size(); i += len) {
+    for (unsigned int i = 0; i < impl_->typebits_.size(); i += len) {
         assert(i + 2 <= impl_->typebits_.size());
         const int block = impl_->typebits_.at(i);
         len = impl_->typebits_.at(i + 1);
diff --git a/src/lib/dns/rdata/generic/rrsig_46.cc b/src/lib/dns/rdata/generic/rrsig_46.cc
index 0c82406..96df8d9 100644
--- a/src/lib/dns/rdata/generic/rrsig_46.cc
+++ b/src/lib/dns/rdata/generic/rrsig_46.cc
@@ -70,6 +70,9 @@ struct RRSIGImpl {
     uint16_t tag_;
     const Name signer_;
     const vector<uint8_t> signature_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    RRSIGImpl& operator=(RRSIGImpl const&);
 };
 
 RRSIG::RRSIG(const string& rrsig_str) :
diff --git a/src/lib/dns/rdatafields.cc b/src/lib/dns/rdatafields.cc
index d3f282b..4975295 100644
--- a/src/lib/dns/rdatafields.cc
+++ b/src/lib/dns/rdatafields.cc
@@ -50,6 +50,9 @@ struct RdataFields::RdataFieldsDetail {
     {}
     const vector<FieldSpec> allocated_fields_;
     const vector<uint8_t> allocated_data_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    RdataFieldsDetail& operator=(RdataFieldsDetail const&);
 };
 
 namespace {
@@ -171,7 +174,7 @@ RdataFields::RdataFields(const void* fields, const unsigned int fields_length,
     }
 
     size_t total_length = 0;
-    for (int i = 0; i < nfields_; ++i) {
+    for (unsigned int i = 0; i < nfields_; ++i) {
         total_length += fields_[i].len;
     }
     if (total_length != data_length_) {
@@ -198,7 +201,7 @@ void
 RdataFields::toWire(AbstractMessageRenderer& renderer) const {
     size_t offset = 0;
 
-    for (int i = 0; i < nfields_; ++i) {
+    for (unsigned int i = 0; i < nfields_; ++i) {
         if (fields_[i].type == DATA) {
             renderer.writeData(data_ + offset, fields_[i].len);
         } else {
diff --git a/src/lib/dns/rrclass-placeholder.h b/src/lib/dns/rrclass-placeholder.h
index 8be3faf..0b13921 100644
--- a/src/lib/dns/rrclass-placeholder.h
+++ b/src/lib/dns/rrclass-placeholder.h
@@ -22,7 +22,9 @@
 
 #include <exceptions/exceptions.h>
 
+#if defined(_WIN32) && defined(IN)
 #undef IN
+#endif
 
 namespace isc {
 namespace util {
diff --git a/src/lib/dns/tests/edns_unittest.cc b/src/lib/dns/tests/edns_unittest.cc
index 055027e..46a6ca8 100644
--- a/src/lib/dns/tests/edns_unittest.cc
+++ b/src/lib/dns/tests/edns_unittest.cc
@@ -39,7 +39,7 @@ using namespace isc::util;
 using namespace isc::dns::rdata;
 
 /// put the right #ifdef here
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__GNUC__)
 const uint8_t EDNS::SUPPORTED_VERSION;
 #endif
 
diff --git a/src/lib/dns/tests/masterload_unittest.cc b/src/lib/dns/tests/masterload_unittest.cc
index c47debd..b8005a8 100644
--- a/src/lib/dns/tests/masterload_unittest.cc
+++ b/src/lib/dns/tests/masterload_unittest.cc
@@ -41,6 +41,8 @@ public:
     }
 private:
     vector<ConstRRsetPtr>& rrsets_;
+    // silence MSVC warning C4512: assignment operator could not be generated
+    TestCallback& operator=(TestCallback const&);
 };
 
 // A function version of TestCallback.
@@ -241,6 +243,8 @@ public:
     }
 private:
     stringstream& ss_;
+    // silence MSVC warning C4512: assignment operator could not be generated
+    StreamInvalidator& operator=(StreamInvalidator const&);
 };
 
 TEST_F(MasterLoadTest, loadBadStream) {
diff --git a/src/lib/dns/tests/message_unittest.cc b/src/lib/dns/tests/message_unittest.cc
index 5aad474..cdac9e3 100644
--- a/src/lib/dns/tests/message_unittest.cc
+++ b/src/lib/dns/tests/message_unittest.cc
@@ -51,7 +51,7 @@ using namespace isc::dns::rdata;
 //
 
 /// put the right #ifdef here
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__GNUC__)
 const uint16_t Message::DEFAULT_MAX_UDPSIZE;
 #endif
 
diff --git a/src/lib/dns/tests/name_unittest.cc b/src/lib/dns/tests/name_unittest.cc
index 78d9daa..1b47332 100644
--- a/src/lib/dns/tests/name_unittest.cc
+++ b/src/lib/dns/tests/name_unittest.cc
@@ -38,7 +38,7 @@ using namespace isc::util;
 // seemingly cannot find the symbols when used in the EXPECT_xxx macros.
 //
 /// put the right #ifdef here
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__GNUC__)
 const size_t Name::MAX_WIRE;
 const size_t Name::MAX_LABELS;
 #endif
diff --git a/src/lib/dns/tests/unittest_util.cc b/src/lib/dns/tests/unittest_util.cc
index c9c0982..4de8929 100644
--- a/src/lib/dns/tests/unittest_util.cc
+++ b/src/lib/dns/tests/unittest_util.cc
@@ -116,7 +116,7 @@ UnitTestUtil::readWireData(const string& datastr,
             throw runtime_error(err_oss.str());
         }
 
-        for (int pos = 0; pos < bytes.size(); pos += 2) {
+        for (unsigned int pos = 0; pos < bytes.size(); pos += 2) {
             istringstream iss_byte(bytes.substr(pos, 2));
             unsigned int ch;
 
@@ -139,7 +139,7 @@ UnitTestUtil::matchWireData(const char*, const char*, const char*, const char*,
     ::testing::Message msg;
     size_t cmplen = min(len1, len2);
 
-    for (int i = 0; i < cmplen; i++) {
+    for (unsigned int i = 0; i < cmplen; i++) {
         int ch1 = static_cast<const uint8_t*>(data1)[i];
         int ch2 = static_cast<const uint8_t*>(data2)[i];
         if (ch1 != ch2) {
diff --git a/src/lib/dns/tsig.h b/src/lib/dns/tsig.h
index 93c5da5..dcfe4ee 100644
--- a/src/lib/dns/tsig.h
+++ b/src/lib/dns/tsig.h
@@ -85,6 +85,8 @@ public:
 
 private:
     const rdata::any::TSIG rdata_;
+    // silence MSVC warning C4512: assignment operator could not be generated
+    TSIGRecord& operator=(TSIGRecord const&);
 };
 
 /// A pointer-like type pointing to a \c TSIGRecord object.
diff --git a/src/lib/dns/tsigkey.cc b/src/lib/dns/tsigkey.cc
index c899423..fd95a61 100644
--- a/src/lib/dns/tsigkey.cc
+++ b/src/lib/dns/tsigkey.cc
@@ -65,6 +65,9 @@ TSIGKey::TSIGKeyImpl {
     Name algorithm_name_;
     const isc::cryptolink::HashAlgorithm algorithm_;
     const vector<uint8_t> secret_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    TSIGKeyImpl& operator=(TSIGKeyImpl const&);
 };
 
 TSIGKey::TSIGKey(const Name& key_name, const Name& algorithm_name,
diff --git a/src/lib/dns/tsigkey.h b/src/lib/dns/tsigkey.h
index 02dd423..d5d1e39 100644
--- a/src/lib/dns/tsigkey.h
+++ b/src/lib/dns/tsigkey.h
@@ -241,6 +241,10 @@ public:
         {}
         const Result code;
         const TSIGKey* const key;
+    private:
+        // silence MSVC warning C4512:
+        // assignment operator could not be generated
+        FindResult& operator=(FindResult const&);
     };
 
     ///
diff --git a/src/lib/exceptions/exceptions.h b/src/lib/exceptions/exceptions.h
index a42037b..61d5397 100644
--- a/src/lib/exceptions/exceptions.h
+++ b/src/lib/exceptions/exceptions.h
@@ -157,12 +157,25 @@ public:
 /// this is defined as a macro.  The convenience for the ostream is a secondary
 /// purpose (if that were the only possible reason we should rather avoid
 /// using a macro).
+/// Avoid C4127 warning: conditional expression is constant
+#ifdef _MSC_VER
+#define isc_throw(type, stream) \
+    __pragma(warning(push)) \
+    __pragma(warning(disable: 4127)) \
+    do { \
+        std::ostringstream oss__; \
+        oss__ << stream; \
+        throw type(__FILE__, __LINE__, oss__.str().c_str()); \
+    } while (1) \
+    __pragma(warning(pop))
+#else
 #define isc_throw(type, stream) \
     do { \
         std::ostringstream oss__; \
         oss__ << stream; \
         throw type(__FILE__, __LINE__, oss__.str().c_str()); \
     } while (1)
+#endif
 }
 #endif // __EXCEPTIONS_H
 
diff --git a/src/lib/log/compiler/message.cc b/src/lib/log/compiler/message.cc
index 992ecbf..2e4996a 100644
--- a/src/lib/log/compiler/message.cc
+++ b/src/lib/log/compiler/message.cc
@@ -222,7 +222,7 @@ writeOpeningNamespace(ostream& output, const vector<string>& ns) {
     if (!ns.empty()) {
 
         // Output namespaces in correct order
-        for (int i = 0; i < ns.size(); ++i) {
+        for (unsigned int i = 0; i < ns.size(); ++i) {
             output << "namespace " << ns[i] << " {\n";
         }
         output << "\n";
diff --git a/src/lib/log/logger_levels.h b/src/lib/log/logger_levels.h
index 907e25b..48fa372 100644
--- a/src/lib/log/logger_levels.h
+++ b/src/lib/log/logger_levels.h
@@ -26,7 +26,9 @@ namespace log {
 /// N.B. The order of the levels - DEBUG less than INFO less that WARN etc. is
 /// implicitly assumed in several implementations.  They must not be changed.
 
+#if defined(_WIN32) && defined(ERROR)
 #undef ERROR
+#endif
 
 typedef enum {
     DEFAULT = 0,    // Default to logging level of the parent
diff --git a/src/lib/nsas/hash_deleter.h b/src/lib/nsas/hash_deleter.h
index 27f066e..b77ad6e 100644
--- a/src/lib/nsas/hash_deleter.h
+++ b/src/lib/nsas/hash_deleter.h
@@ -61,6 +61,8 @@ public:
 
 private:
     HashTable<T>& hashtable_;         ///< Hash table to access element
+    // silence MSVC warning C4512: assignment operator could not be generated
+    HashDeleter& operator=(HashDeleter const&);
 };
 
 // delete the object from the relevant hash table
diff --git a/src/lib/nsas/hash_key.cc b/src/lib/nsas/hash_key.cc
index bf4676b..5f49004 100644
--- a/src/lib/nsas/hash_key.cc
+++ b/src/lib/nsas/hash_key.cc
@@ -35,7 +35,7 @@ bool HashKey::operator==(const isc::nsas::HashKey& other) {
             // variation (stops on the first null byte).
             //
             // TODO: Use a lookup table to map upper to lower case (for speed)
-            for (int i = 0; i < other.keylen; ++i) {
+            for (unsigned int i = 0; i < other.keylen; ++i) {
                 if (tolower(static_cast<unsigned char>(other.key[i])) !=
                     tolower(static_cast<unsigned char>(key[i]))) {
                     return false;   // Mismatch
diff --git a/src/lib/nsas/nameserver_entry.cc b/src/lib/nsas/nameserver_entry.cc
index 5ae4625..5157f91 100644
--- a/src/lib/nsas/nameserver_entry.cc
+++ b/src/lib/nsas/nameserver_entry.cc
@@ -44,6 +44,11 @@
 #include "nameserver_address.h"
 #include "nameserver_entry.h"
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4373)
+#endif
+
 using namespace isc::asiolink;
 using namespace isc::nsas;
 using namespace isc::dns;
@@ -445,3 +450,7 @@ NameserverEntry::askIP(isc::resolve::ResolverInterface* resolver,
 
 } // namespace dns
 } // namespace isc
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/src/lib/nsas/zone_entry.cc b/src/lib/nsas/zone_entry.cc
index 8d2c3b4..e011ec7 100644
--- a/src/lib/nsas/zone_entry.cc
+++ b/src/lib/nsas/zone_entry.cc
@@ -33,6 +33,11 @@
 #include <dns/rcode.h>
 #include <dns/rdataclass.h>
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4373)
+#endif
+
 using namespace std;
 
 namespace isc {
@@ -574,3 +579,7 @@ ZoneEntry::insertCallback(NameserverPtr ns, AddressFamily family) {
 
 }; // namespace nsas
 }; // namespace isc
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/src/lib/resolve/recursive_query.cc b/src/lib/resolve/recursive_query.cc
index 0ae7bd3..bfdf5e0 100644
--- a/src/lib/resolve/recursive_query.cc
+++ b/src/lib/resolve/recursive_query.cc
@@ -153,9 +153,9 @@ win32_gettimeofday(struct timeval *tv)
     n.LowPart = now.dwLowDateTime;
     n.HighPart = now.dwHighDateTime;
     n.QuadPart -= t.QuadPart;
-    tv->tv_sec = n.QuadPart / 10000000;
+    tv->tv_sec = (long) (n.QuadPart / 10000000);
     n.QuadPart -= tv->tv_sec * 10000000;
-    tv->tv_usec = n.QuadPart / 10;
+    tv->tv_usec = (long) (n.QuadPart / 10);
 }
 #endif
 
@@ -355,7 +355,7 @@ private:
         // the RTT
         current_ns_address = address;
 #ifdef _WIN32
-	win32_gettimeofday(&current_ns_qsent_time);
+        win32_gettimeofday(&current_ns_qsent_time);
 #else
         gettimeofday(&current_ns_qsent_time, NULL);
 #endif
@@ -387,7 +387,7 @@ private:
             dlog("Sending upstream query (" + question_.toText() +
                  ") to test server at " + test_server_.first);
 #ifdef _WIN32
-	    win32_gettimeofday(&current_ns_qsent_time);
+            win32_gettimeofday(&current_ns_qsent_time);
 #else
             gettimeofday(&current_ns_qsent_time, NULL);
 #endif
@@ -404,7 +404,7 @@ private:
                 ") to " + upstream_->at(serverIndex).first);
             ++outstanding_events_;
 #ifdef _WIN32
-	    win32_gettimeofday(&current_ns_qsent_time);
+            win32_gettimeofday(&current_ns_qsent_time);
 #else
             gettimeofday(&current_ns_qsent_time, NULL);
 #endif
@@ -726,7 +726,7 @@ public:
             // Update the NSAS with the time it took
             struct timeval cur_time;
 #ifdef _WIN32
-	    win32_gettimeofday(&cur_time);
+            win32_gettimeofday(&cur_time);
 #else
             gettimeofday(&cur_time, NULL);
 #endif
diff --git a/src/lib/resolve/recursive_query.h b/src/lib/resolve/recursive_query.h
index c082426..d86d829 100644
--- a/src/lib/resolve/recursive_query.h
+++ b/src/lib/resolve/recursive_query.h
@@ -167,6 +167,8 @@ private:
     int lookup_timeout_;
     unsigned retries_;
     boost::shared_ptr<RttRecorder>  rtt_recorder_;  ///< Round-trip time recorder
+    // silence MSVC warning C4512: assignment operator could not be generated
+    RecursiveQuery& operator=(RecursiveQuery const&);
 };
 
 }      // namespace asiodns
diff --git a/src/lib/resolve/resolve.cc b/src/lib/resolve/resolve.cc
index 4e5614a..d10d25a 100644
--- a/src/lib/resolve/resolve.cc
+++ b/src/lib/resolve/resolve.cc
@@ -37,6 +37,10 @@ namespace {
         }
         MessagePtr message_;
         const Message::Section section_;
+    private:
+        // silence MSVC warning C4512:
+        // assignment operator could not be generated
+        SectionInserter& operator=(SectionInserter const&);
     };
 }
 
diff --git a/src/lib/resolve/response_classifier.cc b/src/lib/resolve/response_classifier.cc
index 02808e4..3cf37f8 100644
--- a/src/lib/resolve/response_classifier.cc
+++ b/src/lib/resolve/response_classifier.cc
@@ -119,7 +119,7 @@ ResponseClassifier::Category ResponseClassifier::classify(
         if (authority.empty()) {
             return (EMPTY);
         }
-        for (int i = 0; i < authority.size(); ++i) {
+        for (unsigned int i = 0; i < authority.size(); ++i) {
             if (authority[i]->getType() == RRType::NS()) {
                 return (REFERRAL);
             }
@@ -161,7 +161,7 @@ ResponseClassifier::Category ResponseClassifier::classify(
 
     // There are multiple RRsets in the answer. They should all have the same
     // QCLASS, else there is some error in the response.
-    for (int i = 1; i < answer.size(); ++i) {
+    for (unsigned int i = 1; i < answer.size(); ++i) {
         if (answer[0]->getClass() != answer[i]->getClass()) {
             return (MULTICLASS);
         }
@@ -173,7 +173,7 @@ ResponseClassifier::Category ResponseClassifier::classify(
     // CNAME - in which case there should no other record types at that QNAME.
     if (question.getType() == RRType::ANY()) {
         bool all_same = true;
-        for (int i = 1; (i < answer.size()) && all_same; ++i) {
+        for (unsigned int i = 1; (i < answer.size()) && all_same; ++i) {
             all_same = (answer[0]->getName() == answer[i]->getName());
         }
         if (all_same) {
@@ -211,7 +211,7 @@ ResponseClassifier::Category ResponseClassifier::cnameChase(
 {
     // Search through the vector of RRset pointers until we find one with the
     // right QNAME.
-    for (int i = 0; i < ansrrset.size(); ++i) {
+    for (unsigned int i = 0; i < ansrrset.size(); ++i) {
         if (present[i]) {
 
             // This entry has not been logically removed, so look at it.
diff --git a/src/lib/resolve/tests/recursive_query_unittest.cc b/src/lib/resolve/tests/recursive_query_unittest.cc
index fcfe293..69163c1 100644
--- a/src/lib/resolve/tests/recursive_query_unittest.cc
+++ b/src/lib/resolve/tests/recursive_query_unittest.cc
@@ -366,7 +366,7 @@ protected:
 
         void operator()(asio::error_code ec = asio::error_code(),
                         size_t length = 0)
-        {}
+        { ec; }
 
         void resume(const bool) {
           // should never be called in our tests
@@ -400,6 +400,9 @@ protected:
         const SimpleCallback* checkin_;
         const DNSLookup* lookup_;
         const DNSAnswer* answer_;
+        // silence MSVC warning C4512:
+        // assignment operator could not be generated
+        MockServer& operator=(MockServer const&);
     };
 
     // This version of mock server just stops the io_service when it is resumed
@@ -420,6 +423,9 @@ protected:
             }
         private:
             bool* done_;
+            // silence MSVC warning C4512:
+            // assignment operator could not be generated
+           MockServerStop& operator=(MockServerStop const&);
     };
 
     // This version of mock server just stops the io_service when it is resumed
@@ -453,6 +459,9 @@ protected:
             bool* done1_;
             bool* done2_;
             bool stopped_once_;
+            // silence MSVC warning C4512:
+            // assignment operator could not be generated
+            MockServerStop2& operator=(MockServerStop2 const&);
     };
 
 private:
diff --git a/src/lib/resolve/tests/recursive_query_unittest_2.cc b/src/lib/resolve/tests/recursive_query_unittest_2.cc
index bdbaac5..3fbd537 100644
--- a/src/lib/resolve/tests/recursive_query_unittest_2.cc
+++ b/src/lib/resolve/tests/recursive_query_unittest_2.cc
@@ -49,6 +49,11 @@
 #include <resolve/recursive_query.h>
 #include <resolve/resolver_interface.h>
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4351)
+#endif
+
 using namespace asio;
 using namespace asio::ip;
 using namespace isc::asiolink;
@@ -638,6 +643,8 @@ private:
     bool            run_;           ///< Set true when completion handler run
     bool            status_;        ///< Set true for success, false on error
     bool            debug_;         ///< Debug flag
+    // silence MSVC warning C4512: assignment operator could not be generated
+    ResolverCallback& operator=(ResolverCallback const&);
 };
 
 // Sets up the UDP and TCP "servers", then tries a resolution.
@@ -696,10 +703,14 @@ TEST_F(RecursiveQueryTest2, Resolve) {
     // weren't, we would expect some absurdly high answers.
     vector<uint32_t> rtt = recorder->getRtt();
     EXPECT_GT(rtt.size(), 0);
-    for (int i = 0; i < rtt.size(); ++i) {
+    for (unsigned int i = 0; i < rtt.size(); ++i) {
         EXPECT_LT(rtt[i], 2000);
     }
 }
 
 } // namespace asiodns
 } // namespace isc
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/src/lib/resolve/tests/resolver_callback_unittest.cc b/src/lib/resolve/tests/resolver_callback_unittest.cc
index 6eac1d6..6d6be45 100644
--- a/src/lib/resolve/tests/resolver_callback_unittest.cc
+++ b/src/lib/resolve/tests/resolver_callback_unittest.cc
@@ -23,6 +23,11 @@
 #include <asiodns/dns_server.h>
 #include <resolve/resolver_callback.h>
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4373)
+#endif
+
 using namespace isc::resolve;
 
 // Dummy subclass for DNSServer*
@@ -95,3 +100,7 @@ TEST_F(ResolverCallbackServerTest, testFailure) {
     EXPECT_TRUE(getResumeCalled());
     EXPECT_FALSE(getResumeValue());
 }
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/src/lib/resolve/tests/run_unittests.cc b/src/lib/resolve/tests/run_unittests.cc
index 771d546..f20a706 100644
--- a/src/lib/resolve/tests/run_unittests.cc
+++ b/src/lib/resolve/tests/run_unittests.cc
@@ -27,11 +27,11 @@ main(int argc, char* argv[]) {
     ::testing::InitGoogleTest(&argc, argv);
 
 #ifdef _WIN32
-	WSADATA wsaData;
-	WSAStartup(MAKEWORD(2,2), &wsaData);
-	int ret = RUN_ALL_TESTS();
-	WSACleanup();
-	return (ret);
+    WSADATA wsaData;
+    WSAStartup(MAKEWORD(2,2), &wsaData);
+    int ret = RUN_ALL_TESTS();
+    WSACleanup();
+    return (ret);
 #else
     return (RUN_ALL_TESTS());
 #endif
diff --git a/src/lib/server_common/portconfig.cc b/src/lib/server_common/portconfig.cc
index ac41f83..e3aa74b 100644
--- a/src/lib/server_common/portconfig.cc
+++ b/src/lib/server_common/portconfig.cc
@@ -59,6 +59,9 @@ parseAddresses(isc::data::ConstElementPtr addresses,
                         port->intValue()));
                 }
                 catch (const TypeError &e) { // Better error message
+#ifdef _MSC_VER
+                    e;
+#endif
                     isc_throw(TypeError,
                         "Address must be a string and port an integer");
                 }
diff --git a/src/lib/testutils/dnsmessage_test.h b/src/lib/testutils/dnsmessage_test.h
index a8b7284..eda6a6b 100644
--- a/src/lib/testutils/dnsmessage_test.h
+++ b/src/lib/testutils/dnsmessage_test.h
@@ -122,6 +122,9 @@ struct RRsetMatch : public std::unary_function<isc::dns::ConstRRsetPtr, bool> {
                 rrset->getName() == target_->getName());
     }
     const isc::dns::ConstRRsetPtr target_;
+private:
+    // silence MSVC warning C4512: assignment operator could not be generated
+    RRsetMatch& operator=(RRsetMatch const&);
 };
 
 // Helper callback functor for masterLoad() used in rrsetsCheck (stream
@@ -136,6 +139,8 @@ public:
     }
 private:
     std::vector<isc::dns::ConstRRsetPtr>& rrsets_;
+    // silence MSVC warning C4512: assignment operator could not be generated
+    RRsetInserter& operator=(RRsetInserter const&);
 };
 }
 
diff --git a/src/lib/util/encode/base_n.cc b/src/lib/util/encode/base_n.cc
index c86e4af..0d26f16 100644
--- a/src/lib/util/encode/base_n.cc
+++ b/src/lib/util/encode/base_n.cc
@@ -18,6 +18,11 @@
 #include <string>
 #include <vector>
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4512)
+#endif
+
 #include <boost/archive/iterators/base64_from_binary.hpp>
 #include <boost/archive/iterators/binary_from_base64.hpp>
 #include <boost/archive/iterators/transform_width.hpp>
@@ -398,3 +403,7 @@ decodeHex(const string& input, vector<uint8_t>& result) {
 } // namespace encode
 } // namespace util
 } // namespace isc
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/src/lib/util/random/random_number_generator.h b/src/lib/util/random/random_number_generator.h
index 43f4179..03360c5 100644
--- a/src/lib/util/random/random_number_generator.h
+++ b/src/lib/util/random/random_number_generator.h
@@ -26,6 +26,13 @@
 #include <boost/random/uniform_real.hpp>
 #include <boost/random/variate_generator.hpp>
 
+#if defined(_WIN32) && defined(min)
+#undef min
+#endif
+#if defined(_WIN32) && defined(max)
+#undef max
+#endif
+
 namespace isc {
 namespace util {
 namespace random {
@@ -60,7 +67,7 @@ public:
     /// \param min The minimum number in the range
     /// \param max The maximum number in the range
     UniformRandomIntegerGenerator(int min, int max):
-        min_(min(min, max)), max_(max(min, max)),
+        min_(std::min(min, max)), max_(std::max(min, max)),
         dist_(min_, max_), generator_(rng_, dist_)
     {
         // To preserve the restriction of the underlying uniform_int class (and
diff --git a/src/lib/util/strutil.cc b/src/lib/util/strutil.cc
index 161f9ac..53ec236 100644
--- a/src/lib/util/strutil.cc
+++ b/src/lib/util/strutil.cc
@@ -120,7 +120,7 @@ format(const std::string& format, const std::vector<std::string>& args) {
     // Iterate through replacing all tokens
     result = format;
     size_t tokenpos = 0;    // Position of last token replaced
-    int i = 0;              // Index into argument array
+    unsigned int i = 0;     // Index into argument array
 
     while ((i < args.size()) && (tokenpos != string::npos)) {
         tokenpos = result.find(flag, tokenpos);
diff --git a/src/lib/util/tests/base32hex_unittest.cc b/src/lib/util/tests/base32hex_unittest.cc
index ea04a63..74063d5 100644
--- a/src/lib/util/tests/base32hex_unittest.cc
+++ b/src/lib/util/tests/base32hex_unittest.cc
@@ -149,7 +149,7 @@ TEST_F(Base32HexTest, decodeMap) {
 }
 
 TEST_F(Base32HexTest, encodeMap) {
-    for (int i = 0; i < 32; ++i) {
+    for (uint8_t i = 0; i < 32; ++i) {
         decoded_data.assign(4, 0);
         decoded_data.push_back(i);
         EXPECT_EQ(encoding_chars[i], encodeBase32Hex(decoded_data)[7]);
diff --git a/src/lib/util/tests/hex_unittest.cc b/src/lib/util/tests/hex_unittest.cc
index 52bccea..efb842f 100644
--- a/src/lib/util/tests/hex_unittest.cc
+++ b/src/lib/util/tests/hex_unittest.cc
@@ -110,7 +110,7 @@ TEST_F(HexTest, decodeMap) {
 }
 
 TEST_F(HexTest, encodeMap) {
-    for (int i = 0; i < 16; ++i) {
+    for (uint8_t i = 0; i < 16; ++i) {
         decoded_data.clear();
         decoded_data.push_back(i);
         EXPECT_EQ(encoding_chars[i], encodeHex(decoded_data)[1]);
diff --git a/src/lib/util/tests/random_number_generator_unittest.cc b/src/lib/util/tests/random_number_generator_unittest.cc
index f63e688..fa0a6fc 100644
--- a/src/lib/util/tests/random_number_generator_unittest.cc
+++ b/src/lib/util/tests/random_number_generator_unittest.cc
@@ -25,8 +25,12 @@
 
 #include <util/random/random_number_generator.h>
 
+#if defined(_WIN32) && defined(min)
 #undef min
+#endif
+#if defined(_WIN32) && defined(max)
 #undef max
+#endif
 
 namespace isc {
 namespace util {
diff --git a/src/lib/util/time_utilities.cc b/src/lib/util/time_utilities.cc
index 646caf0..d4298e9 100644
--- a/src/lib/util/time_utilities.cc
+++ b/src/lib/util/time_utilities.cc
@@ -180,7 +180,7 @@ uint64_t
 timeFromText64(const string& time_txt) {
     // Confirm the source only consists digits.  sscanf() allows some
     // minor exceptions.
-    for (int i = 0; i < time_txt.length(); ++i) {
+    for (unsigned int i = 0; i < time_txt.length(); ++i) {
         if (!isdigit(time_txt.at(i))) {
             isc_throw(InvalidTime, "Couldn't convert non-numeric time value: "
                       << time_txt);




More information about the bind10-changes mailing list