[Mesa-dev] [PATCH mesa] glsl: compile unused function out

Nicolai Hähnle nhaehnle at gmail.com
Wed Sep 13 15:24:57 UTC 2017


On 12.09.2017 17:01, Eric Engestrom wrote:
> The function is only called from one place, which is hidden behind
> the same `#ifdef DEBUG`.
> 
> Fixes: ca73c3358c91434e68ab "glsl: Mark functions static"
> Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>

Is there an alternative way to do that, perhaps using the MAYBE_UNUSED 
macro? I'd prefer that to the #ifdef, because the #ifdef means that some 
people won't automatically build-check the code in there.

Cheers,
Nicolai


> ---
>   src/compiler/glsl/ir_validate.cpp | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp
> index becce771be..50d611500c 100644
> --- a/src/compiler/glsl/ir_validate.cpp
> +++ b/src/compiler/glsl/ir_validate.cpp
> @@ -1043,6 +1043,7 @@ ir_validate::validate_ir(ir_instruction *ir, void *data)
>      _mesa_set_add(ir_set, ir);
>   }
>   
> +#ifdef DEBUG
>   static void
>   check_node_type(ir_instruction *ir, void *data)
>   {
> @@ -1056,6 +1057,7 @@ check_node_type(ir_instruction *ir, void *data)
>      if (value != NULL)
>         assert(value->type != glsl_type::error_type);
>   }
> +#endif
>   
>   void
>   validate_ir_tree(exec_list *instructions)
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list