[Mesa-dev] [PATCH 1/4] glsl: fix visit/visit_enter overloaded virtual function warnings
Rob Herring
robh at kernel.org
Tue May 30 20:47:06 UTC 2017
clang gives warnings about overloaded virtual functions:
src/compiler/glsl/linker.cpp:244:30: warning: '(anonymous namespace)::array_resize_visitor::visit' hides overloaded virtual function [-Woverloaded-virtual]
virtual ir_visitor_status visit(ir_variable *var)
^
src/compiler/glsl/linker.cpp:195:30: note: hidden overloaded virtual function '(anonymous namespace)::deref_type_updater::visit' declared here: type mismatch at 1st parameter ('ir_dereference_variable *' vs 'ir_variable *')
virtual ir_visitor_status visit(ir_dereference_variable *ir)
^
src/compiler/glsl/linker.cpp:1414:30: warning: 'array_sizing_visitor::visit' hides overloaded virtual function [-Woverloaded-virtual]
virtual ir_visitor_status visit(ir_variable *var)
^
src/compiler/glsl/linker.cpp:195:30: note: hidden overloaded virtual function '(anonymous namespace)::deref_type_updater::visit' declared here: type mismatch at 1st parameter ('ir_dereference_variable *' vs 'ir_variable *')
virtual ir_visitor_status visit(ir_dereference_variable *ir)
^
src/compiler/glsl/lower_jumps.cpp:395:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
virtual void visit(class ir_loop_jump * ir)
^
src/compiler/glsl/lower_jumps.cpp:417:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
virtual void visit(class ir_return * ir)
^
src/compiler/glsl/lower_jumps.cpp:439:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
virtual void visit(class ir_discard * ir)
^
src/compiler/glsl/lower_jumps.cpp:519:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
virtual void visit(ir_if *ir)
^
src/compiler/glsl/lower_jumps.cpp:835:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
virtual void visit(ir_loop *ir)
^
src/compiler/glsl/lower_jumps.cpp:963:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
virtual void visit(ir_function_signature *ir)
^
src/compiler/glsl/lower_jumps.cpp:1009:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
virtual void visit(class ir_function * ir)
^
src/compiler/glsl/opt_constant_variable.cpp:52:30: warning: '(anonymous namespace)::ir_constant_variable_visitor::visit_enter' hides overloaded virtual functions [-Woverloaded-virtual]
virtual ir_visitor_status visit_enter(ir_dereference_variable *);
^
src/compiler/glsl/opt_dead_code_local.cpp:101:30: warning: '(anonymous namespace)::kill_for_derefs_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
virtual ir_visitor_status visit(ir_swizzle *ir)
^
Fix these with the "using" directive.
Signed-off-by: Rob Herring <robh at kernel.org>
---
src/compiler/glsl/linker.cpp | 2 ++
src/compiler/glsl/lower_jumps.cpp | 1 +
src/compiler/glsl/opt_constant_variable.cpp | 2 ++
src/compiler/glsl/opt_dead_code_local.cpp | 1 +
4 files changed, 6 insertions(+)
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 2e7dd2b87356..3aa95b734321 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -241,6 +241,7 @@ public:
/* empty */
}
+ using ir_hierarchical_visitor::visit;
virtual ir_visitor_status visit(ir_variable *var)
{
if (!var->type->is_array() || var->data.mode != ir_var_shader_in ||
@@ -1411,6 +1412,7 @@ public:
ralloc_free(this->mem_ctx);
}
+ using ir_hierarchical_visitor::visit;
virtual ir_visitor_status visit(ir_variable *var)
{
const glsl_type *type_without_array;
diff --git a/src/compiler/glsl/lower_jumps.cpp b/src/compiler/glsl/lower_jumps.cpp
index 7dc34056a1b1..0cb55127a6e6 100644
--- a/src/compiler/glsl/lower_jumps.cpp
+++ b/src/compiler/glsl/lower_jumps.cpp
@@ -392,6 +392,7 @@ struct ir_lower_jumps_visitor : public ir_control_flow_visitor {
}
}
+ using ir_visitor::visit;
virtual void visit(class ir_loop_jump * ir)
{
/* Eliminate all instructions after each one, since they are
diff --git a/src/compiler/glsl/opt_constant_variable.cpp b/src/compiler/glsl/opt_constant_variable.cpp
index 1c06ffe6750a..db91cac1589d 100644
--- a/src/compiler/glsl/opt_constant_variable.cpp
+++ b/src/compiler/glsl/opt_constant_variable.cpp
@@ -50,7 +50,9 @@ struct assignment_entry {
class ir_constant_variable_visitor : public ir_hierarchical_visitor {
public:
virtual ir_visitor_status visit_enter(ir_dereference_variable *);
+ using ir_hierarchical_visitor::visit;
virtual ir_visitor_status visit(ir_variable *);
+ using ir_hierarchical_visitor::visit_enter;
virtual ir_visitor_status visit_enter(ir_assignment *);
virtual ir_visitor_status visit_enter(ir_call *);
diff --git a/src/compiler/glsl/opt_dead_code_local.cpp b/src/compiler/glsl/opt_dead_code_local.cpp
index a4038794c6bf..f5ea4ae3d537 100644
--- a/src/compiler/glsl/opt_dead_code_local.cpp
+++ b/src/compiler/glsl/opt_dead_code_local.cpp
@@ -91,6 +91,7 @@ public:
}
}
+ using ir_hierarchical_visitor::visit;
virtual ir_visitor_status visit(ir_dereference_variable *ir)
{
use_channels(ir->var, ~0);
--
2.11.0
More information about the mesa-dev
mailing list