Module: Mesa
Branch: master
Commit: 52d831ff83036773978aabf52dde3bb73bb211c7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=52d831ff83036773978aabf52dde3bb73bb211c7

Author: Caio Marcelo de Oliveira Filho <[email protected]>
Date:   Fri Jul 20 13:21:33 2018 -0700

glsl: remove delegating constructors to allow build with C++98

Delegating constructors is a C++11 feature, so this was breaking when
compiling with C++98. Change the copy_propagation_state() calls that
used the convenience constructor to use a static member function
instead.

Since copy_propagation_state is expected to be heap allocated, this
change is a good fit.

Tested-by: Vinson Lee <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107305

---

 src/compiler/glsl/opt_copy_propagation_elements.cpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp 
b/src/compiler/glsl/opt_copy_propagation_elements.cpp
index b5c90fff88..4c6ca79039 100644
--- a/src/compiler/glsl/opt_copy_propagation_elements.cpp
+++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp
@@ -68,9 +68,11 @@ class copy_propagation_state {
 public:
    DECLARE_RZALLOC_CXX_OPERATORS(copy_propagation_state);
 
-   copy_propagation_state()
-      : copy_propagation_state(NULL)
-   {}
+   static
+   copy_propagation_state* create(void *mem_ctx)
+   {
+      return new (mem_ctx) copy_propagation_state(NULL);
+   }
 
    copy_propagation_state* clone()
    {
@@ -238,7 +240,7 @@ public:
       this->lin_ctx = linear_alloc_parent(this->mem_ctx, 0);
       this->shader_mem_ctx = NULL;
       this->kills = new(mem_ctx) exec_list;
-      this->state = new(mem_ctx) copy_propagation_state();
+      this->state = copy_propagation_state::create(mem_ctx);
    }
    ~ir_copy_propagation_elements_visitor()
    {
@@ -294,7 +296,7 @@ 
ir_copy_propagation_elements_visitor::visit_enter(ir_function_signature *ir)
    this->killed_all = false;
 
    copy_propagation_state *orig_state = state;
-   this->state = new(mem_ctx) copy_propagation_state();
+   this->state = copy_propagation_state::create(mem_ctx);
 
    visit_list_elements(this, &ir->body);
 
@@ -531,7 +533,7 @@ ir_copy_propagation_elements_visitor::handle_loop(ir_loop 
*ir, bool keep_acp)
       /* Populate the initial acp with a copy of the original */
       this->state = orig_state->clone();
    } else {
-      this->state = new(mem_ctx) copy_propagation_state();
+      this->state = copy_propagation_state::create(mem_ctx);
    }
 
    visit_list_elements(this, &ir->body_instructions);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to