[Mesa-dev] [PATCH] glsl: remove trailing comma in enum lists to silence warning

Ilia Mirkin imirkin at alum.mit.edu
Tue May 3 00:15:40 UTC 2016


I know I've been sticking commas at the end of enums left and right
for the past several years, and haven't heard any complaints. The nice
thing about the trailing comma is that you avoid having to change
unrelated lines when adding entries. This leads to cleaner per-line
histories, which can be useful to see when something was added.

Why is this becoming an issue just now?

  -ilia

On Mon, May 2, 2016 at 8:05 PM, Brian Paul <brianp at vmware.com> wrote:
> Silences warnings from -Wpedantic:
> In file included from ../../src/compiler/glsl/glsl_symbol_table.h:34:0,
>                  from ../../src/compiler/glsl/glsl_parser_extras.h:35,
>                  from nir/glsl_to_nir.h:29,
>                  from nir/glsl_to_nir.cpp:51:
> ../../src/compiler/glsl/ir.h:372:17: warning: comma at end of enumerator list [-Wpedantic]
>     ir_var_hidden,
>                  ^
> ../../src/compiler/glsl/ir.h:1962:24: warning: comma at end of enumerator list [-Wpedantic]
>     ir_samples_identical, /**< Query whether all samples are definitely identical. */
>                         ^
> ---
>  src/compiler/glsl/ir.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
> index 0c319ea..cfe318c 100644
> --- a/src/compiler/glsl/ir.h
> +++ b/src/compiler/glsl/ir.h
> @@ -368,7 +368,7 @@ enum ir_var_declaration_type {
>      * Variable is implicitly generated by the compiler and should not be
>      * visible via the API.
>      */
> -   ir_var_hidden,
> +   ir_var_hidden
>  };
>
>  /**
> @@ -1958,7 +1958,7 @@ enum ir_texture_opcode {
>     ir_tg4,             /**< Texture gather */
>     ir_query_levels,     /**< Texture levels query */
>     ir_texture_samples,  /**< Texture samples query */
> -   ir_samples_identical, /**< Query whether all samples are definitely identical. */
> +   ir_samples_identical /**< Query whether all samples are definitely identical. */
>  };
>
>
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list