st/nine: Enable debug info if NDEBUG is not set

We want to have debug info as well if using
meson's debugoptimized when ndebug is off.

v2: use u_debug functions that do something
even if DEBUG is not set.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
This commit is contained in:
Axel Davy 2018-12-20 22:46:48 +01:00
parent d7433c22e6
commit 6380fedb60
11 changed files with 26 additions and 26 deletions

View file

@ -28,7 +28,7 @@
#include "cubetexture9.h" #include "cubetexture9.h"
#include "volumetexture9.h" #include "volumetexture9.h"
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
#include "nine_pipe.h" #include "nine_pipe.h"
#include "nine_dump.h" #include "nine_dump.h"
#endif #endif
@ -605,7 +605,7 @@ NineBaseTexture9_UnLoad( struct NineBaseTexture9 *This )
BASETEX_REGISTER_UPDATE(This); BASETEX_REGISTER_UPDATE(This);
} }
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
void void
NineBaseTexture9_Dump( struct NineBaseTexture9 *This ) NineBaseTexture9_Dump( struct NineBaseTexture9 *This )
{ {
@ -620,4 +620,4 @@ NineBaseTexture9_Dump( struct NineBaseTexture9 *This )
This->base.info.array_size, This->base.info.last_level, This->base.info.array_size, This->base.info.last_level,
This->managed.lod, This->managed.lod_resident); This->managed.lod, This->managed.lod_resident);
} }
#endif /* DEBUG */ #endif /* DEBUG || !NDEBUG */

View file

@ -150,7 +150,7 @@ NineBindTextureToDevice( struct NineDevice9 *device,
nine_bind(slot, tex); nine_bind(slot, tex);
} }
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
void void
NineBaseTexture9_Dump( struct NineBaseTexture9 *This ); NineBaseTexture9_Dump( struct NineBaseTexture9 *This );
#else #else

View file

@ -93,18 +93,18 @@ _nine_debug_printf( unsigned long flag,
for (func += 4; func != f; ++func) { *ptr++ = tolower(*func); } for (func += 4; func != f; ++func) { *ptr++ = tolower(*func); }
*ptr = '\0'; *ptr = '\0';
if (tid) if (tid)
debug_printf("nine:0x%08lx:%s:%s: ", tid, klass, ++f); _debug_printf("nine:0x%08lx:%s:%s: ", tid, klass, ++f);
else else
debug_printf("nine:%s:%s: ", klass, ++f); _debug_printf("nine:%s:%s: ", klass, ++f);
} else if (func) { } else if (func) {
if (tid) if (tid)
debug_printf("nine:0x%08lx:%s ", tid, func); _debug_printf("nine:0x%08lx:%s ", tid, func);
else else
debug_printf("nine:%s ", func); _debug_printf("nine:%s ", func);
} }
va_start(ap, fmt); va_start(ap, fmt);
debug_vprintf(fmt, ap); _debug_vprintf(fmt, ap);
va_end(ap); va_end(ap);
} }
} }
@ -116,5 +116,5 @@ _nine_stub( const char *file,
{ {
const char *r = strrchr(file, '/'); const char *r = strrchr(file, '/');
if (r == NULL) { r = strrchr(file, '\\'); } if (r == NULL) { r = strrchr(file, '\\'); }
debug_printf("nine:%s:%d: %s STUB!\n", r ? ++r : file, line, func); _debug_printf("nine:%s:%d: %s STUB!\n", r ? ++r : file, line, func);
} }

View file

@ -33,7 +33,7 @@ _nine_debug_printf( unsigned long flag,
#define ERR(fmt, ...) _nine_debug_printf(DBG_ERROR, __FUNCTION__, fmt, ## __VA_ARGS__) #define ERR(fmt, ...) _nine_debug_printf(DBG_ERROR, __FUNCTION__, fmt, ## __VA_ARGS__)
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
#define WARN(fmt, ...) _nine_debug_printf(DBG_WARN, __FUNCTION__, fmt, ## __VA_ARGS__) #define WARN(fmt, ...) _nine_debug_printf(DBG_WARN, __FUNCTION__, fmt, ## __VA_ARGS__)
#define WARN_ONCE(fmt, ...) \ #define WARN_ONCE(fmt, ...) \
do { \ do { \
@ -48,7 +48,7 @@ _nine_debug_printf( unsigned long flag,
#define WARN_ONCE(fmt, ...) #define WARN_ONCE(fmt, ...)
#endif #endif
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
#define DBG_FLAG(flag, fmt, ...) \ #define DBG_FLAG(flag, fmt, ...) \
_nine_debug_printf(flag, __FUNCTION__, fmt, ## __VA_ARGS__) _nine_debug_printf(flag, __FUNCTION__, fmt, ## __VA_ARGS__)
#else #else
@ -90,7 +90,7 @@ _nine_stub( const char *file,
const char *func, const char *func,
unsigned line ); unsigned line );
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
#define STUB(ret) \ #define STUB(ret) \
do { \ do { \
_nine_stub(__FILE__, __FUNCTION__, __LINE__); \ _nine_stub(__FILE__, __FUNCTION__, __LINE__); \
@ -104,7 +104,7 @@ _nine_stub( const char *file,
* macro is designed to be used in conditionals ala * macro is designed to be used in conditionals ala
* if (user_error(required condition)) { assertion failed } * if (user_error(required condition)) { assertion failed }
* It also prints debug message if the assertion fails. */ * It also prints debug message if the assertion fails. */
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
#define user_error(x) \ #define user_error(x) \
(!(x) ? (DBG_FLAG(DBG_USER, "User assertion failed: `%s'\n", #x), TRUE) \ (!(x) ? (DBG_FLAG(DBG_USER, "User assertion failed: `%s'\n", #x), TRUE) \
: FALSE) : FALSE)
@ -112,7 +112,7 @@ _nine_stub( const char *file,
#define user_error(x) (!(x) ? TRUE : FALSE) #define user_error(x) (!(x) ? TRUE : FALSE)
#endif #endif
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
#define user_warn(x) \ #define user_warn(x) \
if ((x)) { DBG_FLAG(DBG_USER, "User warning: `%s'\n", #x); } if ((x)) { DBG_FLAG(DBG_USER, "User warning: `%s'\n", #x); }
#else #else

View file

@ -8,7 +8,7 @@
#include "nine_dump.h" #include "nine_dump.h"
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
static char __thread tls[128]; static char __thread tls[128];
@ -810,4 +810,4 @@ nine_dump_D3DCAPS9(unsigned ch, const D3DCAPS9 *caps)
FREE(s); FREE(s);
} }
#endif /* DEBUG */ #endif /* DEBUG || !NDEBUG */

View file

@ -16,7 +16,7 @@ const char *nine_D3DPRESENTFLAG_to_str(DWORD);
const char *nine_D3DLOCK_to_str(DWORD); const char *nine_D3DLOCK_to_str(DWORD);
const char *nine_D3DSAMP_to_str(DWORD); const char *nine_D3DSAMP_to_str(DWORD);
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
void void
nine_dump_D3DADAPTER_IDENTIFIER9(unsigned, const D3DADAPTER_IDENTIFIER9 *); nine_dump_D3DADAPTER_IDENTIFIER9(unsigned, const D3DADAPTER_IDENTIFIER9 *);
@ -29,7 +29,7 @@ nine_dump_D3DMATERIAL9(unsigned, const D3DMATERIAL9 *);
void void
nine_dump_D3DTSS_value(unsigned, D3DTEXTURESTAGESTATETYPE, DWORD); nine_dump_D3DTSS_value(unsigned, D3DTEXTURESTAGESTATETYPE, DWORD);
#else /* !DEBUG */ #else /* !DEBUG && NDEBUG */
static inline void static inline void
nine_dump_D3DADAPTER_IDENTIFIER9(unsigned ch, const D3DADAPTER_IDENTIFIER9 *id) nine_dump_D3DADAPTER_IDENTIFIER9(unsigned ch, const D3DADAPTER_IDENTIFIER9 *id)
@ -47,6 +47,6 @@ static inline void
nine_dump_D3DTSS_value(unsigned ch, D3DTEXTURESTAGESTATETYPE tss, DWORD value) nine_dump_D3DTSS_value(unsigned ch, D3DTEXTURESTAGESTATETYPE tss, DWORD value)
{ } { }
#endif /* DEBUG */ #endif /* DEBUG || !NDEBUG */
#endif /* _NINE_DUMP_H_H_ */ #endif /* _NINE_DUMP_H_H_ */

View file

@ -2491,7 +2491,7 @@ nine_d3d_matrix_inverse(D3DMATRIX *D, const D3DMATRIX *M)
for (k = 0; k < 4; k++) for (k = 0; k < 4; k++)
D->m[i][k] *= det; D->m[i][k] *= det;
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
{ {
D3DMATRIX I; D3DMATRIX I;

View file

@ -157,7 +157,7 @@ nine_csmt_create( struct NineDevice9 *This )
(void) mtx_init(&ctx->thread_running, mtx_plain); (void) mtx_init(&ctx->thread_running, mtx_plain);
(void) mtx_init(&ctx->thread_resume, mtx_plain); (void) mtx_init(&ctx->thread_resume, mtx_plain);
#if DEBUG #if defined(DEBUG) || !defined(NDEBUG)
u_thread_setname("Main thread"); u_thread_setname("Main thread");
#endif #endif

View file

@ -272,7 +272,7 @@ NineSurface9_CreatePipeSurfaces( struct NineSurface9 *This )
assert(This->surface[1]); assert(This->surface[1]);
} }
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
void void
NineSurface9_Dump( struct NineSurface9 *This ) NineSurface9_Dump( struct NineSurface9 *This )
{ {
@ -300,7 +300,7 @@ NineSurface9_Dump( struct NineSurface9 *This )
NineUnknown_Release(NineUnknown(tex)); NineUnknown_Release(NineUnknown(tex));
} }
} }
#endif /* DEBUG */ #endif /* DEBUG || !NDEBUG */
HRESULT NINE_WINAPI HRESULT NINE_WINAPI
NineSurface9_GetContainer( struct NineSurface9 *This, NineSurface9_GetContainer( struct NineSurface9 *This,

View file

@ -139,7 +139,7 @@ NineSurface9_IsOffscreenPlain (struct NineSurface9 *This )
return This->base.usage == 0 && !This->texture; return This->base.usage == 0 && !This->texture;
} }
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
void void
NineSurface9_Dump( struct NineSurface9 *This ); NineSurface9_Dump( struct NineSurface9 *This );
#else #else

View file

@ -186,7 +186,7 @@ static inline void
NineVolume9_MarkContainerDirty( struct NineVolume9 *This ) NineVolume9_MarkContainerDirty( struct NineVolume9 *This )
{ {
struct NineBaseTexture9 *tex; struct NineBaseTexture9 *tex;
#ifdef DEBUG #if defined(DEBUG) || !defined(NDEBUG)
/* This is always contained by a NineVolumeTexture9. */ /* This is always contained by a NineVolumeTexture9. */
GUID id = IID_IDirect3DVolumeTexture9; GUID id = IID_IDirect3DVolumeTexture9;
REFIID ref = &id; REFIID ref = &id;