Start assuming MSVC 2015.

BUG=43

Change-Id: I46ad1ca62b8921a03fae51f5d7bbe1c68fc0b170
Reviewed-on: https://boringssl-review.googlesource.com/7821
Reviewed-by: Steven Valdez <svaldez@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index adf2021..f36cd38 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,6 +51,7 @@
       "C4365" # '=' : conversion from 'size_t' to 'int',
               # signed/unsigned mismatch
       "C4389" # '!=' : signed/unsigned mismatch
+      "C4464" # relative include path contains '..'
       "C4510" # 'argument' : default constructor could not be generated
       "C4512" # 'argument' : assignment operator could not be generated
       "C4514" # 'function': unreferenced inline function has been removed
@@ -58,6 +59,7 @@
               # side-effect" caused by FD_* macros.
       "C4610" # struct 'argument' can never be instantiated - user defined
               # constructor required.
+      "C4623" # default constructor was implicitly defined as deleted
       "C4625" # copy constructor could not be generated because a base class
               # copy constructor is inaccessible or deleted
       "C4626" # assignment operator could not be generated because a base class
@@ -70,24 +72,16 @@
       "C4820" # 'bytes' bytes padding added after construct 'member_name'
       "C4996" # 'read': The POSIX name for this item is deprecated. Instead,
               # use the ISO C++ conformant name: _read.
-     )
-  if(NOT(CMAKE_C_COMPILER_VERSION VERSION_LESS "19.0.23506"))
-    # MSVC 2015 Update 1.
-    set(MSVC_DISABLED_WARNINGS_LIST
-        ${MSVC_DISABLED_WARNINGS_LIST}
-        "C4464" # relative include path contains '..'
-        "C4623" # default constructor was implicitly defined as deleted
-        "C5027" # move assignment operator was implicitly defined as deleted
-       )
-    set(MSVC_LEVEL4_WARNINGS_LIST
-        # See https://connect.microsoft.com/VisualStudio/feedback/details/1217660/warning-c4265-when-using-functional-header
-        "C4265" # class has virtual functions, but destructor is not virtual
-        )
-    string(REPLACE "C" " -w4" MSVC_LEVEL4_WARNINGS_STR
-                              ${MSVC_LEVEL4_WARNINGS_LIST})
-  endif()
+      "C5027" # move assignment operator was implicitly defined as deleted
+      )
+  set(MSVC_LEVEL4_WARNINGS_LIST
+      # See https://connect.microsoft.com/VisualStudio/feedback/details/1217660/warning-c4265-when-using-functional-header
+      "C4265" # class has virtual functions, but destructor is not virtual
+      )
   string(REPLACE "C" " -wd" MSVC_DISABLED_WARNINGS_STR
                             ${MSVC_DISABLED_WARNINGS_LIST})
+  string(REPLACE "C" " -w4" MSVC_LEVEL4_WARNINGS_STR
+                            ${MSVC_LEVEL4_WARNINGS_LIST})
   set(CMAKE_C_FLAGS   "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}")
   set(CMAKE_CXX_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}")
   add_definitions(-D_HAS_EXCEPTIONS=0)
diff --git a/crypto/hkdf/hkdf_test.c b/crypto/hkdf/hkdf_test.c
index b11061a..53c0c5b 100644
--- a/crypto/hkdf/hkdf_test.c
+++ b/crypto/hkdf/hkdf_test.c
@@ -228,9 +228,8 @@
       return 1;
     }
     if (memcmp(buf, test->out, test->out_len) != 0) {
-      fprintf(stderr, "%" OPENSSL_PR_SIZE_T
-                      ": Resulting key material does not match test vector\n",
-              i);
+      fprintf(stderr,
+              "%zu: Resulting key material does not match test vector\n", i);
       return 1;
     }
   }
diff --git a/crypto/modes/gcm_test.c b/crypto/modes/gcm_test.c
index 56639e6..19c295b 100644
--- a/crypto/modes/gcm_test.c
+++ b/crypto/modes/gcm_test.c
@@ -282,9 +282,7 @@
     uint8_t v, v2;
     if (!from_hex(&v, in[i]) ||
         !from_hex(&v2, in[i+1])) {
-      fprintf(stderr,
-              "%u: invalid hex digit in %s around offset %" OPENSSL_PR_SIZE_T
-              ".\n",
+      fprintf(stderr, "%u: invalid hex digit in %s around offset %zu.\n",
               test_num, description, i);
       goto err;
     }
diff --git a/crypto/test/test_util.h b/crypto/test/test_util.h
index 89e70c6..972e206 100644
--- a/crypto/test/test_util.h
+++ b/crypto/test/test_util.h
@@ -28,14 +28,6 @@
 void hexdump(FILE *fp, const char *msg, const void *in, size_t len);
 
 
-#if defined(_MSC_VER) && _MSC_VER < 1900
-/* https://msdn.microsoft.com/en-us/library/tcxf1dw6(v=vs.120).aspx */
-#define OPENSSL_PR_SIZE_T "Iu"
-#else
-#define OPENSSL_PR_SIZE_T "zu"
-#endif
-
-
 #if defined(__cplusplus)
 }
 #endif
diff --git a/crypto/x509/pkcs7_test.c b/crypto/x509/pkcs7_test.c
index 2dfeb5e..bebcbd9 100644
--- a/crypto/x509/pkcs7_test.c
+++ b/crypto/x509/pkcs7_test.c
@@ -506,7 +506,7 @@
     X509 *b = sk_X509_value(certs2, i);
 
     if (X509_cmp(a, b) != 0) {
-      fprintf(stderr, "Certificate %" OPENSSL_PR_SIZE_T " differs.\n", i);
+      fprintf(stderr, "Certificate %zu differs.\n", i);
       return 0;
     }
   }
@@ -570,7 +570,7 @@
     X509_CRL *b = sk_X509_CRL_value(crls2, i);
 
     if (X509_CRL_cmp(a, b) != 0) {
-      fprintf(stderr, "CRL %" OPENSSL_PR_SIZE_T " differs.\n", i);
+      fprintf(stderr, "CRL %zu differs.\n", i);
       return 0;
     }
   }
@@ -608,8 +608,7 @@
 
   if (sk_X509_num(certs) != 1) {
     fprintf(stderr,
-            "Bad number of certificates from PKCS7_get_PEM_certificates: "
-            "%" OPENSSL_PR_SIZE_T "\n",
+            "Bad number of certificates from PKCS7_get_PEM_certificates: %zu\n",
             sk_X509_num(certs));
     return 0;
   }
@@ -630,9 +629,7 @@
   }
 
   if (sk_X509_CRL_num(crls) != 1) {
-    fprintf(stderr,
-            "Bad number of CRLs from PKCS7_get_PEM_CRLs: %" OPENSSL_PR_SIZE_T
-            "\n",
+    fprintf(stderr, "Bad number of CRLs from PKCS7_get_PEM_CRLs: %zu\n",
             sk_X509_CRL_num(crls));
     return 0;
   }