[tor-dev] [Patch] or/config.c for MSVC

Gisle Vanem gvanem at yahoo.no
Fri Jul 17 10:32:33 UTC 2015


Nick Mathewson wrote:

 > I made the changes conditional on not having GCC, since the GCC syntax
> will work with older versions of GCC.  (Somebody should check whether
> we care about those versions.)

I saw that; from the Changelog:

   o Minor features (portability):
     - Use C99 variadic macros when the compiler is not GCC. This avoids
       failing compilations on MSVC, and fixes a log-file-based race
       condition in our old workarounds. Original patch from Gisle Vanem.

I don't know what the "race conditions" is about, but this (?) change
broke MSVC again by a '__PRETTY_FUNCTION__' which MSVC doesn't have. I
suggest you add a:
   #define __PRETTY_FUNCTION__ __FUNCTION__

to win32/orconfig.h.

Trying to find the change under https://trac.torproject.org/projects/tor/browse
proved impossible. That site is so slow so I add some more MSVC-porting issues
here:

1) Base-types like 'uint8_t' have been part of MSVC's <stdint.h>
   since ver. 1600. So this patch was needed here:

--- a/src/ext/trunnel/trunnel-impl.h        2015-06-04 19:32:02 +0000
+++ b/ext/trunnel/trunnel-impl.h  2015-06-04 19:49:06 +0000
@@ -18,7 +18,7 @@
  #include "trunnel-local.h"
  #endif

-#ifdef _MSC_VER
+#if defined(_MSC_VER) && (_MSC_VER < 1600)
  #define uint8_t unsigned char
  #define uint16_t unsigned short
  #define uint32_t unsigned int

2) MSVC have never had <dirent.h>:

--- a/src/test/test_checkdir.c      2015-03-03 20:36:19 +0000
+++ b/src/test/test_checkdir.c        2015-03-04 15:29:02 +0000
@@ -3,7 +3,11 @@

  #include "orconfig.h"
  #include "or.h"
+
+#ifndef _MSC_VER
  #include <dirent.h>
+#endif
+
  #include "config.h"
  #include "test.h"
  #include "util.h"

-- 
--gv


More information about the tor-dev mailing list