Mesa (master): nir: Fix the Mesa build without -DDEBUG.

Kenneth Graunke kwg at kemper.freedesktop.org
Fri Feb 20 21:52:11 UTC 2015


Module: Mesa
Branch: master
Commit: b6393d70402a60c124c1884d8d0cc1dc6a9b4ca5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6393d70402a60c124c1884d8d0cc1dc6a9b4ca5

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Feb 20 12:31:31 2015 -0800

nir: Fix the Mesa build without -DDEBUG.

With -DDEBUG -UNDEBUG, this assert uses reg_state::stack_size, which
doesn't exist, breaking the build:

assert(state->states[index].index < state->states[index].stack_size);

Switch it to ifndef NDEBUG, so the field will exist if the assertion
actually generates code.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/glsl/nir/nir_to_ssa.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glsl/nir/nir_to_ssa.c b/src/glsl/nir/nir_to_ssa.c
index dbe1699..47cf453 100644
--- a/src/glsl/nir/nir_to_ssa.c
+++ b/src/glsl/nir/nir_to_ssa.c
@@ -134,7 +134,7 @@ typedef struct {
    nir_ssa_def **stack;
    int index;
    unsigned num_defs; /** < used to add indices to debug names */
-#ifdef DEBUG
+#ifndef NDEBUG
    unsigned stack_size;
 #endif
 } reg_state;
@@ -489,7 +489,7 @@ init_rewrite_state(nir_function_impl *impl, rewrite_state *state)
          state->states[reg->index].stack = ralloc_array(state->states,
                                                         nir_ssa_def *,
                                                         stack_size);
-#ifdef DEBUG
+#ifndef NDEBUG
          state->states[reg->index].stack_size = stack_size;
 #endif
          state->states[reg->index].index = -1;




More information about the mesa-commit mailing list