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

Nick Mathewson nickm at alum.mit.edu
Thu Jul 23 16:09:42 UTC 2015


On Fri, Jul 17, 2015 at 6:32 AM, Gisle Vanem <gvanem at yahoo.no> wrote:
> 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.)
>
>

Thanks for the info!


> 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.


I've changed the non-__GNUC__ case to use __FUNCTION__
unconditionally, since __PRETTY_FUNCTION__ is a GCC extension.

> 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:

Instead I'd recommend https://gitweb.torproject.org/tor.git/

>
> 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

I've applied this to trunnel!

> 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"
>
>

Thanks, fixed.  Is it working better now?

-- 
Nick


More information about the tor-dev mailing list