[Mesa-dev] [PATCH mesa] mesa: suppress -Wundef warning for DEBUG_{FP, VP}

Ian Romanick idr at freedesktop.org
Tue Nov 28 19:33:41 UTC 2017


On 11/28/2017 07:49 AM, Eric Engestrom wrote:
> DEBUG_FP & DEBUG_VP were removed in 8c41a14c5ef0b8d2b0f1.
> 
> Changing #if to #ifdef silences the warnings, but I think one of these
> options would be better:
> - the code has been disabled to 12 years, we could just remove it.
> - if the point is to have it in debug builds, we could s/DEBUG_.P/DEBUG/

There are a few files in Mesa that have per-file debugging defines.
These are intended to be used to enable debug output that's really only
interesting if you're doing work in that one file.  That said, I doubt
anyone is going to do any major work in arbprogparse.c, and we have a
lot of other ways to dump shaders at various stages of compilation.

I think it's safe to just remove these altogether, but others may have
different opinions.

> The third option, which this patch does, is keep it as dead code, but it
> can be enabled by adding a `#define DEBUG_{FP,VP}` locally.
> 
> Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
> ---
>  src/mesa/program/arbprogparse.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c
> index 83a501eea69884beffa4..5a6c8dbb1396a4113ebe 100644
> --- a/src/mesa/program/arbprogparse.c
> +++ b/src/mesa/program/arbprogparse.c
> @@ -145,7 +145,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
>        _mesa_append_fog_code(ctx, program, fog_modes[state.option.Fog], GL_TRUE);
>     }
>  
> -#if DEBUG_FP
> +#ifdef DEBUG_FP
>     printf("____________Fragment program %u ________\n", program->Id);
>     _mesa_print_program(&program->Base);
>  #endif
> @@ -212,7 +212,7 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
>        _mesa_free_parameter_list(program->Parameters);
>     program->Parameters = prog.Parameters;
>  
> -#if DEBUG_VP
> +#ifdef DEBUG_VP
>     printf("____________Vertex program %u __________\n", program->Id);
>     _mesa_print_program(program);
>  #endif
> 



More information about the mesa-dev mailing list