diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-01-16 22:32:12 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-01-16 22:32:12 -0500 |
commit | b998431a33db2be0246f176ea0077b98d5258866 (patch) | |
tree | d03935b5fbc9e8f6327af93b2897fc1f34d931fe /src/common/compat.h | |
parent | 8b62a738b3add64dcd26a82dff44a7e9e11ff5a9 (diff) | |
parent | b7cf7bd9ae31aeddd03ad2094dd480d2b1d34d4f (diff) | |
download | tor-b998431a33db2be0246f176ea0077b98d5258866.tar.gz tor-b998431a33db2be0246f176ea0077b98d5258866.zip |
Merge branch '024_msvc_squashed'
Conflicts:
src/or/or.h
srcwin32/orconfig.h
Diffstat (limited to 'src/common/compat.h')
-rw-r--r-- | src/common/compat.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/common/compat.h b/src/common/compat.h index 5fbfd59cd1..25293a4ed6 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -60,7 +60,6 @@ #include <io.h> #include <math.h> #include <projects.h> -#define snprintf _snprintf /* this is not exported as W .... */ #define SHGetPathFromIDListW SHGetPathFromIDList /* wcecompat has vasprintf */ @@ -133,6 +132,17 @@ extern INLINE double U64_TO_DBL(uint64_t x) { #define DBL_TO_U64(x) ((uint64_t) (x)) #endif +#if defined(_MSC_VER) +/* XXXX024 we should instead have a more general check for "Is enum signed?"*/ +#define ENUM_BF(t) unsigned +#else +/** Wrapper for having a bitfield of an enumerated type. Where possible, we + * just use the enumerated type (so the compiler can help us and notice + * problems), but if enumerated types are unsigned, we must use unsigned, + * so that the loss of precision doesn't make large values negative. */ +#define ENUM_BF(t) t +#endif + /* GCC has several useful attributes. */ #if defined(__GNUC__) && __GNUC__ >= 3 #define ATTR_NORETURN __attribute__((noreturn)) |