[tor-commits] [tor/master] Remove checks for visual C 6.

nickm at torproject.org nickm at torproject.org
Mon Jun 29 16:55:09 UTC 2015


commit d9052c629b94343aef63f4e8c891c9c0a9c097b5
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Jun 29 12:55:03 2015 -0400

    Remove checks for visual C 6.
---
 changes/win-macros      |    4 ++--
 configure.ac            |   13 ++++++-------
 src/common/address.c    |    5 ++---
 src/common/aes.c        |   12 ++----------
 src/common/compat.h     |   25 +------------------------
 src/common/crypto.c     |    4 ----
 src/common/torlog.h     |   11 -----------
 src/common/tortls.c     |   12 ++----------
 src/or/or.h             |    7 -------
 src/test/test_address.c |    4 ++--
 src/tools/tor-resolve.c |    4 ----
 11 files changed, 17 insertions(+), 84 deletions(-)

diff --git a/changes/win-macros b/changes/win-macros
index a3519c3..a46a474 100644
--- a/changes/win-macros
+++ b/changes/win-macros
@@ -2,6 +2,6 @@
     - Define WINVER and _WIN32_WINNT centrally, in orconfig.h, in order
       to ensure they remain consistent and visible everywhere.
 
-    - Remove vestigial workarounds for some ancient versions of the MSVC
-      compiler.
+    - Remove some vestigial workarounds for the MSVC6 compiler.  We haven't
+      supported that in ages.
 
diff --git a/configure.ac b/configure.ac
index 23d4c98..0f93e46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -335,6 +335,12 @@ bwin32=true; AC_MSG_RESULT([yes]),
 bwin32=false; AC_MSG_RESULT([no]))
 fi
 
+if test "$bwin32" = yes; then
+  AC_DEFINE(WIN32_LEAN_AND_MEAN, 1, [Defined to avoid including some windows headers])
+  AC_DEFINE(WINVER, 0x0501, [Defined to access windows functions and definitions for >=WinXP])
+  AC_DEFINE(_WIN32_WINNT, 0x0501, [Defined to access windows functions and definitions for >=WinXP])
+fi
+
 AM_CONDITIONAL(BUILD_NT_SERVICES, test x$bwin32 = xtrue)
 
 dnl Enable C99 when compiling with MIPSpro
@@ -1122,13 +1128,9 @@ AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t], , ,
 #ifdef _WIN32
 #define _WIN32_WINNT 0x0501
 #define WIN32_LEAN_AND_MEAN
-#if defined(_MSC_VER) && (_MSC_VER < 1300)
-#include <winsock.h>
-#else
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #endif
-#endif
 ])
 AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16, struct sockaddr_in.sin_len, struct sockaddr_in6.sin6_len], , ,
 [#ifdef HAVE_SYS_TYPES_H
@@ -1146,9 +1148,6 @@ AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16, struct s
 #ifdef _WIN32
 #define _WIN32_WINNT 0x0501
 #define WIN32_LEAN_AND_MEAN
-#if defined(_MSC_VER) && (_MSC_VER < 1300)
-#include <winsock.h>
-#else
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #endif
diff --git a/src/common/address.c b/src/common/address.c
index 6bd1078..d7d815e 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -10,17 +10,16 @@
 
 #define ADDRESS_PRIVATE
 
+#include "orconfig.h"
+
 #ifdef _WIN32
 /* For access to structs needed by GetAdaptersAddresses */
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
 #include <process.h>
 #include <winsock2.h>
 #include <windows.h>
 #include <iphlpapi.h>
 #endif
 
-#include "orconfig.h"
 #include "compat.h"
 #include "util.h"
 #include "address.h"
diff --git a/src/common/aes.c b/src/common/aes.c
index 8b9d81f..5f2c3f2 100644
--- a/src/common/aes.c
+++ b/src/common/aes.c
@@ -12,16 +12,8 @@
 #include "orconfig.h"
 
 #ifdef _WIN32 /*wrkard for dtls1.h >= 0.9.8m of "#include <winsock.h>"*/
- #ifndef _WIN32_WINNT
- #define _WIN32_WINNT 0x0501
- #endif
- #define WIN32_LEAN_AND_MEAN
- #if defined(_MSC_VER) && (_MSC_VER < 1300)
-    #include <winsock.h>
- #else
-    #include <winsock2.h>
-    #include <ws2tcpip.h>
- #endif
+  #include <winsock2.h>
+  #include <ws2tcpip.h>
 #endif
 
 #include <openssl/opensslv.h>
diff --git a/src/common/compat.h b/src/common/compat.h
index e1b860f..fbaeb6f 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -10,17 +10,9 @@
 #include "torint.h"
 #include "testsupport.h"
 #ifdef _WIN32
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
-#endif
-#define WIN32_LEAN_AND_MEAN
-#if defined(_MSC_VER) && (_MSC_VER < 1300)
-#include <winsock.h>
-#else
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #endif
-#endif
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #endif
@@ -90,13 +82,8 @@
 
 /* Try to get a reasonable __func__ substitute in place. */
 #if defined(_MSC_VER)
-/* MSVC compilers before VC7 don't have __func__ at all; later ones call it
- * __FUNCTION__. */
-#if _MSC_VER < 1300
-#define __func__ "???"
-#else
+
 #define __func__ __FUNCTION__
-#endif
 
 #else
 /* For platforms where autoconf works, make sure __func__ is defined
@@ -112,18 +99,8 @@
 #endif /* ifndef MAVE_MACRO__func__ */
 #endif /* if not windows */
 
-#if defined(_MSC_VER) && (_MSC_VER < 1300)
-/* MSVC versions before 7 apparently don't believe that you can cast uint64_t
- * to double and really mean it. */
-extern INLINE double U64_TO_DBL(uint64_t x) {
-  int64_t i = (int64_t) x;
-  return (i < 0) ? ((double) INT64_MAX) : (double) i;
-}
-#define DBL_TO_U64(x) ((uint64_t)(int64_t) (x))
-#else
 #define U64_TO_DBL(x) ((double) (x))
 #define DBL_TO_U64(x) ((uint64_t) (x))
-#endif
 
 #ifdef ENUM_VALS_ARE_SIGNED
 #define ENUM_BF(t) unsigned
diff --git a/src/common/crypto.c b/src/common/crypto.c
index afaf93a..984fe95 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -13,10 +13,6 @@
 #include "orconfig.h"
 
 #ifdef _WIN32
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
-#endif
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <wincrypt.h>
 /* Windows defines this; so does OpenSSL 0.9.8h and later. We don't actually
diff --git a/src/common/torlog.h b/src/common/torlog.h
index 8923a9e..710313a 100644
--- a/src/common/torlog.h
+++ b/src/common/torlog.h
@@ -210,16 +210,6 @@ void log_notice_(log_domain_mask_t domain, const char *format, ...);
 void log_warn_(log_domain_mask_t domain, const char *format, ...);
 void log_err_(log_domain_mask_t domain, const char *format, ...);
 
-#if defined(_MSC_VER) && _MSC_VER < 1300
-/* MSVC 6 and earlier don't have __func__, or even __LINE__. */
-#define log_fn log_fn_
-#define log_fn_ratelim log_fn_ratelim_
-#define log_debug log_debug_
-#define log_info log_info_
-#define log_notice log_notice_
-#define log_warn log_warn_
-#define log_err log_err_
-#else
 /* We don't have GCC's varargs macros, so use a global variable to pass the
  * function name to log_fn */
 extern const char *log_fn_function_name_;
@@ -233,7 +223,6 @@ extern const char *log_fn_function_name_;
 #define log_notice (log_fn_function_name_=__func__),log_notice_
 #define log_warn (log_fn_function_name_=__func__),log_warn_
 #define log_err (log_fn_function_name_=__func__),log_err_
-#endif
 
 #endif /* !GNUC */
 
diff --git a/src/common/tortls.c b/src/common/tortls.c
index bd0eaff..7447822 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -18,16 +18,8 @@
 
 #include <assert.h>
 #ifdef _WIN32 /*wrkard for dtls1.h >= 0.9.8m of "#include <winsock.h>"*/
- #ifndef _WIN32_WINNT
- #define _WIN32_WINNT 0x0501
- #endif
- #define WIN32_LEAN_AND_MEAN
- #if defined(_MSC_VER) && (_MSC_VER < 1300)
-    #include <winsock.h>
- #else
-    #include <winsock2.h>
-    #include <ws2tcpip.h>
- #endif
+  #include <winsock2.h>
+  #include <ws2tcpip.h>
 #endif
 
 #ifdef __GNUC__
diff --git a/src/or/or.h b/src/or/or.h
index d3a476e..0950277 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -22,13 +22,6 @@
 #endif
 #endif
 
-#ifdef _WIN32
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
-#endif
-#define WIN32_LEAN_AND_MEAN
-#endif
-
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
diff --git a/src/test/test_address.c b/src/test/test_address.c
index d13d678..9d64563 100644
--- a/src/test/test_address.c
+++ b/src/test/test_address.c
@@ -3,11 +3,11 @@
 
 #define ADDRESS_PRIVATE
 
+#include "orconfig.h"
+
 #ifdef _WIN32
 #include <winsock2.h>
 /* For access to structs needed by GetAdaptersAddresses */
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
 #include <iphlpapi.h>
 #endif
 
diff --git a/src/tools/tor-resolve.c b/src/tools/tor-resolve.c
index 19e3a55..08bce15 100644
--- a/src/tools/tor-resolve.c
+++ b/src/tools/tor-resolve.c
@@ -33,13 +33,9 @@
 #endif
 
 #ifdef _WIN32
-#if defined(_MSC_VER) && (_MSC_VER <= 1300)
-#include <winsock.h>
-#else
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #endif
-#endif
 
 #define RESPONSE_LEN_4 8
 #define log_sock_error(act, _s)                                         \



More information about the tor-commits mailing list