Commit 98f4bfaf authored by Elizabeth Smith's avatar Elizabeth Smith Committed by Dave Watson

Adding some msvc specific defines

Summary:
msvc puts ssize_t in a stupidly odd place and names it weirdly too
this also takes care of snprintf missing (the semantics are slightly off in the msvc version regarding the return value, but usage in folly is limited and does NOT do the double snprintf call madness so this is safe)
funcsig and pretty function give you roughtly the same thing in compiler specific implementations
strerror_s is msvc's thread save strerror

@override-unit-failures

Test Plan: fbmake runtests

Reviewed By: delong.j@fb.com

FB internal diff: D1291542
parent aff1262d
...@@ -188,4 +188,24 @@ struct MaxAlign { char c; } __attribute__((aligned)); ...@@ -188,4 +188,24 @@ struct MaxAlign { char c; } __attribute__((aligned));
#endif #endif
#endif // __cplusplus #endif // __cplusplus
// MSVC specific defines
// mainly for posix compat
#ifdef _MSC_VER
// this definition is in a really silly place with a silly name
// and ifdefing it every time we want it is painful
#include <basetsd.h>
typedef SSIZE_T ssize_t;
// sprintf semantics are not exactly identical
// but current usage is not a problem
# define snprintf _snprintf
// semantics here are identical
# define strerror_r(errno,buf,len) strerror_s(buf,len,errno)
// compiler specific to compiler specific
# define __PRETTY_FUNCTION__ __FUNCSIG__
#endif
#endif // FOLLY_PORTABILITY_H_ #endif // FOLLY_PORTABILITY_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment