mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
vkd3d: Emit an ERR() when reaching unreachable code.
This way the ERR() configuration is reused for unreachable code.
This commit is contained in:
parent
4ada72a397
commit
fb55c2b227
Notes:
Henri Verbeet
2024-07-29 13:23:46 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Conor McCarthy (@cmccarthy) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/867
@ -108,17 +108,11 @@ static inline uint64_t align(uint64_t addr, size_t alignment)
|
||||
# define VKD3D_UNREACHABLE (void)0
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
VKD3D_NORETURN static inline void vkd3d_unreachable_(const char *filename, unsigned int line)
|
||||
{
|
||||
fprintf(stderr, "%s:%u: Aborting, reached unreachable code.\n", filename, line);
|
||||
abort();
|
||||
}
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define vkd3d_unreachable() VKD3D_UNREACHABLE
|
||||
#else
|
||||
#define vkd3d_unreachable() vkd3d_unreachable_(__FILE__, __LINE__)
|
||||
#endif
|
||||
#define vkd3d_unreachable() \
|
||||
do { \
|
||||
ERR("%s:%u: Unreachable code reached.\n", __FILE__, __LINE__); \
|
||||
VKD3D_UNREACHABLE; \
|
||||
} while (0)
|
||||
|
||||
#ifdef VKD3D_NO_TRACE_MESSAGES
|
||||
#define TRACE(args...) do { } while (0)
|
||||
@ -188,6 +182,12 @@ const char *debugstr_w(const WCHAR *wstr, size_t wchar_size);
|
||||
#define VKD3D_DBG_PRINTF_ERR(...) VKD3D_DBG_PRINTF(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
/* Used by vkd3d_unreachable(). */
|
||||
#ifdef VKD3D_CROSSTEST
|
||||
#undef ERR
|
||||
#define ERR(...) do { fprintf(stderr, __VA_ARGS__); abort(); } while (0)
|
||||
#endif
|
||||
|
||||
#ifndef TRACE
|
||||
#define TRACE VKD3D_DBG_LOG(TRACE)
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user