[Mesa-dev] [PATCH 13/17] glsl: Silence unused parameter warnings

Ilia Mirkin imirkin at alum.mit.edu
Wed Aug 26 10:29:34 PDT 2015


On Wed, Aug 26, 2015 at 1:20 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> builtin_variables.cpp:1062:53: warning: unused parameter 'name_as_gs_input' [-Wunused-parameter]
>                                          const char *name_as_gs_input)
>                                                      ^
> builtin_functions.cpp:4774:47: warning: unused parameter 'intrinsic_name' [-Wunused-parameter]
>                                    const char *intrinsic_name,
>                                                ^
> builtin_functions.cpp:4907:66: warning: unused parameter 'state' [-Wunused-parameter]
>  _mesa_glsl_find_builtin_function_by_name(_mesa_glsl_parse_state *state,
>                                                                   ^
> ir_print_visitor.cpp:589:37: warning: unused parameter 'ir' [-Wunused-parameter]
>  ir_print_visitor::visit(ir_barrier *ir)
>                                      ^
> linker.cpp:3212:48: warning: unused parameter 'ctx' [-Wunused-parameter]
>  build_program_resource_list(struct gl_context *ctx,
>                                                 ^
> standalone_scaffolding.cpp:65:57: warning: unused parameter ‘id’ [-Wunused-parameter]
>  _mesa_shader_debug(struct gl_context *, GLenum, GLuint *id,
>                                                          ^
>
> Now src/glsl is _almost_ free of warnings!
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  src/glsl/ast_to_hir.cpp             | 2 +-
>  src/glsl/builtin_functions.cpp      | 7 ++-----
>  src/glsl/builtin_variables.cpp      | 8 +++-----
>  src/glsl/ir.h                       | 3 +--
>  src/glsl/ir_print_visitor.cpp       | 2 +-
>  src/glsl/linker.cpp                 | 3 +--
>  src/glsl/program.h                  | 3 +--
>  src/glsl/standalone_scaffolding.cpp | 2 +-
>  src/mesa/program/ir_to_mesa.cpp     | 2 +-
>  9 files changed, 12 insertions(+), 20 deletions(-)
>
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index 06cd6a5..d8d0d58 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -4544,7 +4544,7 @@ ast_function::hir(exec_list *instructions,
>     if (state->es_shader && state->language_version >= 300) {
>        /* Local shader has no exact candidates; check the built-ins. */
>        _mesa_glsl_initialize_builtin_functions();
> -      if (_mesa_glsl_find_builtin_function_by_name(state, name)) {
> +      if (_mesa_glsl_find_builtin_function_by_name(name)) {
>           YYLTYPE loc = this->get_location();
>           _mesa_glsl_error(& loc, state,
>                            "A shader cannot redefine or overload built-in "
> diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
> index 2175c66..4c813fd 100644
> --- a/src/glsl/builtin_functions.cpp
> +++ b/src/glsl/builtin_functions.cpp
> @@ -705,7 +705,6 @@ private:
>     B1(mid3)
>
>     ir_function_signature *_image_prototype(const glsl_type *image_type,
> -                                           const char *intrinsic_name,
>                                             unsigned num_arguments,
>                                             unsigned flags);
>     ir_function_signature *_image(const glsl_type *image_type,
> @@ -4771,7 +4770,6 @@ builtin_builder::_mid3(const glsl_type *type)
>
>  ir_function_signature *
>  builtin_builder::_image_prototype(const glsl_type *image_type,
> -                                  const char *intrinsic_name,
>                                    unsigned num_arguments,
>                                    unsigned flags)
>  {
> @@ -4823,7 +4821,7 @@ builtin_builder::_image(const glsl_type *image_type,
>                          unsigned num_arguments,
>                          unsigned flags)
>  {
> -   ir_function_signature *sig = _image_prototype(image_type, intrinsic_name,
> +   ir_function_signature *sig = _image_prototype(image_type,
>                                                   num_arguments, flags);

I think this is old code... mine reads like

   ir_function_signature *sig = (this->*prototype)(image_type, intrinsic_name,
                                                   num_arguments, flags);

So you'll have more updating to do if you want to remove
intrinsic_name there. Should be straightforward though.

>
>     if (flags & IMAGE_FUNCTION_EMIT_STUB) {
> @@ -4904,8 +4902,7 @@ _mesa_glsl_find_builtin_function(_mesa_glsl_parse_state *state,
>  }
>
>  ir_function *
> -_mesa_glsl_find_builtin_function_by_name(_mesa_glsl_parse_state *state,
> -                                         const char *name)
> +_mesa_glsl_find_builtin_function_by_name(const char *name)
>  {
>     ir_function *f;
>     mtx_lock(&builtins_lock);
> diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
> index 53d3500..30faaa4 100644
> --- a/src/glsl/builtin_variables.cpp
> +++ b/src/glsl/builtin_variables.cpp
> @@ -383,8 +383,7 @@ private:
>     ir_variable *add_uniform(const glsl_type *type, const char *name);
>     ir_variable *add_const(const char *name, int value);
>     ir_variable *add_const_ivec3(const char *name, int x, int y, int z);
> -   void add_varying(int slot, const glsl_type *type, const char *name,
> -                    const char *name_as_gs_input);
> +   void add_varying(int slot, const glsl_type *type, const char *name);
>
>     exec_list * const instructions;
>     struct _mesa_glsl_parse_state * const state;
> @@ -1058,8 +1057,7 @@ builtin_variable_generator::generate_cs_special_vars()
>   */
>  void
>  builtin_variable_generator::add_varying(int slot, const glsl_type *type,
> -                                        const char *name,
> -                                        const char *name_as_gs_input)
> +                                        const char *name)
>  {
>     switch (state->stage) {
>     case MESA_SHADER_TESS_CTRL:
> @@ -1088,7 +1086,7 @@ void
>  builtin_variable_generator::generate_varyings()
>  {
>  #define ADD_VARYING(loc, type, name) \
> -   add_varying(loc, type, name, name "In")
> +   add_varying(loc, type, name)
>
>     /* gl_Position and gl_PointSize are not visible from fragment shaders. */
>     if (state->stage != MESA_SHADER_FRAGMENT) {
> diff --git a/src/glsl/ir.h b/src/glsl/ir.h
> index ede8caa..7cdea01 100644
> --- a/src/glsl/ir.h
> +++ b/src/glsl/ir.h
> @@ -2523,8 +2523,7 @@ _mesa_glsl_find_builtin_function(_mesa_glsl_parse_state *state,
>                                   const char *name, exec_list *actual_parameters);
>
>  extern ir_function *
> -_mesa_glsl_find_builtin_function_by_name(_mesa_glsl_parse_state *state,
> -                                         const char *name);
> +_mesa_glsl_find_builtin_function_by_name(const char *name);
>
>  extern gl_shader *
>  _mesa_glsl_get_builtin_function_shader(void);
> diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
> index 8dbd938..b683269 100644
> --- a/src/glsl/ir_print_visitor.cpp
> +++ b/src/glsl/ir_print_visitor.cpp
> @@ -586,7 +586,7 @@ ir_print_visitor::visit(ir_end_primitive *ir)
>  }
>
>  void
> -ir_print_visitor::visit(ir_barrier *ir)
> +ir_print_visitor::visit(ir_barrier *)
>  {
>     fprintf(f, "(barrier)\n");
>  }
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index 72154bf..43d766b 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -3209,8 +3209,7 @@ add_interface_variables(struct gl_shader_program *shProg,
>   * resource data.
>   */
>  void
> -build_program_resource_list(struct gl_context *ctx,
> -                            struct gl_shader_program *shProg)
> +build_program_resource_list(struct gl_shader_program *shProg)
>  {
>     /* Rebuild resource list. */
>     if (shProg->ProgramResourceList) {
> diff --git a/src/glsl/program.h b/src/glsl/program.h
> index c06541a..64f5463 100644
> --- a/src/glsl/program.h
> +++ b/src/glsl/program.h
> @@ -40,8 +40,7 @@ extern void
>  link_shaders(struct gl_context *ctx, struct gl_shader_program *prog);
>
>  extern void
> -build_program_resource_list(struct gl_context *ctx,
> -                            struct gl_shader_program *shProg);
> +build_program_resource_list(struct gl_shader_program *shProg);
>
>  extern void
>  linker_error(struct gl_shader_program *prog, const char *fmt, ...)
> diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp
> index 6033364..e52869f 100644
> --- a/src/glsl/standalone_scaffolding.cpp
> +++ b/src/glsl/standalone_scaffolding.cpp
> @@ -62,7 +62,7 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
>  }
>
>  void
> -_mesa_shader_debug(struct gl_context *, GLenum, GLuint *id,
> +_mesa_shader_debug(struct gl_context *, GLenum, GLuint *,
>                     const char *, int)
>  {
>  }
> diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
> index 8f58f3e..0defed8 100644
> --- a/src/mesa/program/ir_to_mesa.cpp
> +++ b/src/mesa/program/ir_to_mesa.cpp
> @@ -2979,7 +2979,7 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
>        if (!ctx->Driver.LinkShader(ctx, prog)) {
>          prog->LinkStatus = GL_FALSE;
>        } else {
> -         build_program_resource_list(ctx, prog);
> +         build_program_resource_list(prog);
>        }
>     }
>


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>


More information about the mesa-dev mailing list