[Mesa-dev] [PATCH 1/2] glsl: Add a method to print error messages for illegal qualifiers.

Matt Turner mattst88 at gmail.com
Tue Apr 12 02:35:01 UTC 2016


On Mon, Apr 11, 2016 at 6:39 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> Suggested by Timothy Arceri a while back on mesa-dev:
> https://lists.freedesktop.org/archives/mesa-dev/2016-February/107735.html
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/compiler/glsl/ast.h        |  5 +++
>  src/compiler/glsl/ast_type.cpp | 85 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 90 insertions(+)
>
> diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
> index 7436edc..2aee118 100644
> --- a/src/compiler/glsl/ast.h
> +++ b/src/compiler/glsl/ast.h
> @@ -736,6 +736,11 @@ struct ast_type_qualifier {
>                             const ast_type_qualifier &q,
>                             ast_node* &node, bool create_node);
>
> +   bool validate_flags(YYLTYPE *loc,
> +                           _mesa_glsl_parse_state *state,
> +                           const char *message,
> +                           const ast_type_qualifier &allowed_flags);

Bad indentation.

> +
>     ast_subroutine_list *subroutine_list;
>  };
>
> diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
> index c3d38cb..8b79b1f 100644
> --- a/src/compiler/glsl/ast_type.cpp
> +++ b/src/compiler/glsl/ast_type.cpp
> @@ -581,6 +581,91 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
>     return true;
>  }
>
> +/**
> + * Check if the current type qualifier has any illegal flags.
> + *
> + * If so, print an error message, followed by a list of illegal flags.
> + *
> + * \param message        The error message to print.
> + * \param allowed_flags  A list of valid flags.
> + */
> +bool
> +ast_type_qualifier::validate_flags(YYLTYPE *loc,
> +                                  _mesa_glsl_parse_state *state,

Tabs.

Acked-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list