inc/xrt: Some MSVC and Windows support

This commit is contained in:
Ryan Pavlik 2020-05-28 13:48:37 -07:00 committed by Jakob Bornecrantz
parent 3ff56f4a3c
commit 54f6aa2166
2 changed files with 16 additions and 0 deletions

View file

@ -58,6 +58,8 @@
*/
#if defined(__GNUC__)
#define XRT_MAYBE_UNUSED __attribute__((unused))
#elif defined(_MSC_VER) && defined(__cplusplus)
#define XRT_MAYBE_UNUSED [[maybe_unused]]
#else
#define XRT_MAYBE_UNUSED
#endif
@ -68,6 +70,8 @@
*/
#if defined(__GNUC__)
#define XRT_NO_INLINE __attribute__((noinline))
#elif defined(_MSC_VER)
#define XRT_NO_INLINE __declspec(noinline)
#else
#define XRT_NO_INLINE
#endif
@ -126,6 +130,14 @@ xrt_atomic_s32_cmpxchg(xrt_atomic_s32_t *p, int32_t old_, int32_t new_)
#endif
}
#ifdef _MSC_VER
#ifdef XRT_64_BIT
typedef int64_t ssize_t;
#else
typedef int32_t ssize_t;
#endif
#endif
/*!
* Get the holder from a pointer to a field.
*

View file

@ -29,6 +29,10 @@
#define XRT_OS_WAS_AUTODETECTED
#endif
#if defined(_WIN32)
#define XRT_OS_WINDOWS
#define XRT_OS_WAS_AUTODETECTED
#endif
#ifndef XRT_OS_WAS_AUTODETECTED