aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-05-09 21:04:23 -0400
committerMarek Olšák <[email protected]>2019-05-29 21:13:35 -0400
commitb5697c311b6f29dee40b96c48bad3279e3667c1e (patch)
treed0708cd5249ec8d3535bda8134f91ea79af2ffde /src/mesa
parent0f1b68ebeeee196ced42d8ac66d231338b507bad (diff)
Change a few frequented uses of DEBUG to !NDEBUG
debugoptimized builds don't define NDEBUG, but they also don't define DEBUG. We want to enable cheap debug code for these builds. I only chose those occurences that I care about. Reviewed-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/context.c2
-rw-r--r--src/mesa/main/debug.c4
-rw-r--r--src/mesa/main/errors.c6
-rw-r--r--src/mesa/main/feedback.c2
-rw-r--r--src/mesa/main/formats.c2
-rw-r--r--src/mesa/main/imports.c4
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/main/shaderapi.c2
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c2
-rw-r--r--src/mesa/state_tracker/st_format.c2
-rw-r--r--src/mesa/vbo/vbo_exec.h2
-rw-r--r--src/mesa/vbo/vbo_exec_api.c6
12 files changed, 17 insertions, 19 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 34da16b88f4..03d81f1d559 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -939,7 +939,7 @@ nop_handler(const char *name)
if (ctx) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid call)", name);
}
-#if defined(DEBUG)
+#ifndef NDEBUG
else if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) {
fprintf(stderr,
"GL User Error: gl%s called without a rendering context\n",
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index db11ae35a25..6ff1abbe24f 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -140,7 +140,7 @@ void _mesa_print_info( struct gl_context *ctx )
static void
set_verbose_flags(const char *str)
{
-#ifdef DEBUG
+#ifndef NDEBUG
struct option {
const char *name;
GLbitfield flag;
@@ -181,7 +181,7 @@ set_verbose_flags(const char *str)
static void
set_debug_flags(const char *str)
{
-#ifdef DEBUG
+#ifndef NDEBUG
struct option {
const char *name;
GLbitfield flag;
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 995b0510575..071b75c4727 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -59,7 +59,7 @@ output_if_debug(const char *prefixString, const char *outputString,
LogFile = fopen(logFile, "w");
if (!LogFile)
LogFile = stderr;
-#ifdef DEBUG
+#ifndef NDEBUG
/* in debug builds, print messages unless MESA_DEBUG="silent" */
if (MESA_DEBUG_FLAGS & DEBUG_SILENT)
debug = 0;
@@ -189,7 +189,7 @@ should_output(struct gl_context *ctx, GLenum error, const char *fmtString)
if (debug == -1) {
const char *debugEnv = getenv("MESA_DEBUG");
-#ifdef DEBUG
+#ifndef NDEBUG
if (debugEnv && strstr(debugEnv, "silent"))
debug = GL_FALSE;
else
@@ -378,7 +378,7 @@ _mesa_error_no_memory(const char *caller)
void
_mesa_debug( const struct gl_context *ctx, const char *fmtString, ... )
{
-#ifdef DEBUG
+#ifndef NDEBUG
char s[MAX_DEBUG_MESSAGE_LENGTH];
va_list args;
va_start(args, fmtString);
diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
index 65f4c35d94e..8b3410f39c5 100644
--- a/src/mesa/main/feedback.c
+++ b/src/mesa/main/feedback.c
@@ -428,7 +428,7 @@ _mesa_RenderMode( GLenum mode )
}
if (ctx->Select.BufferCount > ctx->Select.BufferSize) {
/* overflow */
-#ifdef DEBUG
+#ifndef NDEBUG
_mesa_warning(ctx, "Feedback buffer overflow");
#endif
result = -1;
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index b47bed97d20..8d6c76a3419 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -734,9 +734,7 @@ _mesa_get_uncompressed_format(mesa_format format)
case MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT:
return MESA_FORMAT_RGB_FLOAT32;
default:
-#ifdef DEBUG
assert(!_mesa_is_format_compressed(format));
-#endif
return format;
}
}
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 566aac1d385..f1bcd2fa1f7 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -102,7 +102,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1);
*(uintptr_t *)(buf - sizeof(void *)) = ptr;
-#ifdef DEBUG
+#ifndef NDEBUG
/* mark the non-aligned area */
while ( ptr < buf - sizeof(void *) ) {
*(unsigned long *)ptr = 0xcdcdcdcd;
@@ -151,7 +151,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment)
buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1);
*(uintptr_t *)(buf - sizeof(void *)) = ptr;
-#ifdef DEBUG
+#ifndef NDEBUG
/* mark the non-aligned area */
while ( ptr < buf - sizeof(void *) ) {
*(unsigned long *)ptr = 0xcdcdcdcd;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index bdb04e085f4..13e18e6e8ab 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -5172,7 +5172,7 @@ struct gl_memory_info
unsigned nr_device_memory_evictions; /**< # of evictions (monotonic counter) */
};
-#ifdef DEBUG
+#ifndef NDEBUG
extern int MESA_VERBOSE;
extern int MESA_DEBUG_FLAGS;
#else
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 2cc5fe5d8f8..584af9b8cef 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -474,7 +474,7 @@ detach_shader(struct gl_context *ctx, GLuint program, GLuint shader,
shProg->Shaders = newList;
shProg->NumShaders = n - 1;
-#ifdef DEBUG
+#ifndef NDEBUG
/* sanity check - make sure the new list's entries are sensible */
for (j = 0; j < shProg->NumShaders; j++) {
assert(shProg->Shaders[j]->Stage == MESA_SHADER_VERTEX ||
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index f18c40dbe7b..15727fa9d80 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -188,7 +188,7 @@ st_update_framebuffer_state( struct st_context *st )
else
framebuffer.zsbuf = NULL;
-#ifdef DEBUG
+#ifndef NDEBUG
/* Make sure the resource binding flags were set properly */
for (i = 0; i < framebuffer.nr_cbufs; i++) {
assert(!framebuffer.cbufs[i] ||
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 18d03cc4ada..7f2f1984e65 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -2196,7 +2196,7 @@ st_choose_format(struct st_context *st, GLenum internalFormat,
int j;
enum pipe_format pf;
-#ifdef DEBUG
+#ifndef NDEBUG
{
static boolean firstCall = TRUE;
if (firstCall) {
diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
index 1170883f871..2624dcec0f2 100644
--- a/src/mesa/vbo/vbo_exec.h
+++ b/src/mesa/vbo/vbo_exec.h
@@ -111,7 +111,7 @@ struct vbo_exec_context
/* Which flags to set in vbo_exec_begin_vertices() */
GLbitfield begin_vertices_flags;
-#ifdef DEBUG
+#ifndef NDEBUG
GLint flush_call_depth;
#endif
};
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 5b1549d96de..bcab3f05342 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -1251,7 +1251,7 @@ vbo_exec_FlushVertices(struct gl_context *ctx, GLuint flags)
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
-#ifdef DEBUG
+#ifndef NDEBUG
/* debug check: make sure we don't get called recursively */
exec->flush_call_depth++;
assert(exec->flush_call_depth == 1);
@@ -1259,7 +1259,7 @@ vbo_exec_FlushVertices(struct gl_context *ctx, GLuint flags)
if (_mesa_inside_begin_end(ctx)) {
/* We've had glBegin but not glEnd! */
-#ifdef DEBUG
+#ifndef NDEBUG
exec->flush_call_depth--;
assert(exec->flush_call_depth == 0);
#endif
@@ -1273,7 +1273,7 @@ vbo_exec_FlushVertices(struct gl_context *ctx, GLuint flags)
*/
ctx->Driver.NeedFlush &= ~(FLUSH_UPDATE_CURRENT | flags);
-#ifdef DEBUG
+#ifndef NDEBUG
exec->flush_call_depth--;
assert(exec->flush_call_depth == 0);
#endif