mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
libs/vkd3d: Make vkd3d debug compatible with MinGW headers.
This commit is contained in:
parent
821d978950
commit
ef80cdedc3
@ -139,7 +139,6 @@ typedef struct SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES;
|
||||
|
||||
# ifdef __GNUC__
|
||||
# define DECLSPEC_SELECTANY __attribute__((weak))
|
||||
# define DECLSPEC_HIDDEN __attribute__((visibility("hidden")))
|
||||
# endif
|
||||
|
||||
/* Macros for COM interfaces */
|
||||
@ -190,6 +189,17 @@ typedef struct SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES;
|
||||
# endif /* NONAMELESSUNION */
|
||||
#endif /* __C89_NAMELESS */
|
||||
|
||||
/* Define DECLSPEC_HIDDEN */
|
||||
#ifndef DECLSPEC_HIDDEN
|
||||
# if defined(__MINGW32__)
|
||||
# define DECLSPEC_HIDDEN
|
||||
# elif defined(__GNUC__)
|
||||
# define DECLSPEC_HIDDEN __attribute__((visibility("hidden")))
|
||||
# else
|
||||
# define DECLSPEC_HIDDEN
|
||||
# endif
|
||||
#endif /* DECLSPEC_HIDDEN */
|
||||
|
||||
/* Define min() & max() macros */
|
||||
#ifndef min
|
||||
# define min(a, b) (((a) <= (b)) ? (a) : (b))
|
||||
|
@ -84,8 +84,8 @@ void vkd3d_dbg_printf(enum vkd3d_dbg_level level, const char *function, const ch
|
||||
static char *get_buffer(void)
|
||||
{
|
||||
static char buffers[64][VKD3D_DEBUG_BUFFER_SIZE];
|
||||
static unsigned int buffer_index;
|
||||
unsigned int current_index;
|
||||
static ULONG buffer_index;
|
||||
ULONG current_index;
|
||||
|
||||
current_index = InterlockedIncrement(&buffer_index) % ARRAY_SIZE(buffers);
|
||||
return buffers[current_index];
|
||||
|
@ -28,22 +28,24 @@
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
|
||||
|
||||
#if HAVE_SYNC_ADD_AND_FETCH
|
||||
#ifndef _WIN32
|
||||
# if HAVE_SYNC_ADD_AND_FETCH
|
||||
static inline ULONG InterlockedIncrement(ULONG volatile *x)
|
||||
{
|
||||
return __sync_add_and_fetch(x, 1);
|
||||
}
|
||||
#else
|
||||
# else
|
||||
# error "InterlockedIncrement not implemented for this platform"
|
||||
#endif /* HAVE_SYNC_ADD_AND_FETCH */
|
||||
# endif /* HAVE_SYNC_ADD_AND_FETCH */
|
||||
|
||||
#if HAVE_SYNC_SUB_AND_FETCH
|
||||
# if HAVE_SYNC_SUB_AND_FETCH
|
||||
static inline ULONG InterlockedDecrement(ULONG volatile *x)
|
||||
{
|
||||
return __sync_sub_and_fetch(x, 1);
|
||||
}
|
||||
#else
|
||||
# else
|
||||
# error "InterlockedDecrement not implemented for this platform"
|
||||
#endif
|
||||
# endif
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#endif /* __VKD3D_COMMON_H */
|
||||
|
@ -72,10 +72,10 @@ static inline const char *debugstr_guid(const GUID *guid)
|
||||
if (!guid)
|
||||
return "(null)";
|
||||
|
||||
return vkd3d_dbg_sprintf("{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||
guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1],
|
||||
guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5],
|
||||
guid->Data4[6], guid->Data4[7]);
|
||||
return vkd3d_dbg_sprintf("{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||
(unsigned long)guid->Data1, guid->Data2, guid->Data3, guid->Data4[0],
|
||||
guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4],
|
||||
guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
||||
}
|
||||
|
||||
#endif /* __VKD3D_DEBUG_H */
|
||||
|
Loading…
Reference in New Issue
Block a user