[Mesa-dev] [PATCH 05/13] mesa: remove redundant running of check_symbol_table()

Matt Turner mattst88 at gmail.com
Wed Mar 12 14:48:25 PDT 2014


On Wed, Mar 12, 2014 at 2:11 PM, Juha-Pekka Heikkila
<juhapekka.heikkila at gmail.com> wrote:
> Nested for loops running through tables against which they
> finally do an assert were ran also with optimized builds.
>
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>  src/mesa/program/symbol_table.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/program/symbol_table.c b/src/mesa/program/symbol_table.c
> index 2f41322..9462978 100644
> --- a/src/mesa/program/symbol_table.c
> +++ b/src/mesa/program/symbol_table.c
> @@ -115,7 +115,7 @@ struct _mesa_symbol_table {
>  static void
>  check_symbol_table(struct _mesa_symbol_table *table)
>  {
> -#if 1
> +#if !defined(NDEBUG)

Probably use #ifndef?

>      struct scope_level *scope;
>
>      for (scope = table->current_scope; scope != NULL; scope = scope->next) {
> @@ -134,7 +134,9 @@ check_symbol_table(struct _mesa_symbol_table *table)
>              }
>          }
>      }
> -#endif
> +#else
> +    (void) table;
> +#endif /* !defined(NDEBUG) */
>  }
>
>  void
> --
> 1.8.1.2

I would think the compiler would be able to recognize this function
does nothing in optimized builds and throw it out, since the assert()
is a no-op.

I guess it doesn't hurt to do this though.


More information about the mesa-dev mailing list