Mesa (master): glsl: Clean up warnings about deleting classes without virtual destructors.

Eric Anholt anholt at kemper.freedesktop.org
Fri Jun 8 19:43:01 UTC 2012


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

Author: Eric Anholt <eric at anholt.net>
Date:   Mon May 14 16:48:47 2012 -0700

glsl: Clean up warnings about deleting classes without virtual destructors.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/ir.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 2c47236..a3f9f05 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -89,6 +89,16 @@ class ir_instruction : public exec_node {
 public:
    enum ir_node_type ir_type;
 
+   /**
+    * GCC 4.7+ and clang warn when deleting an ir_instruction unless
+    * there's a virtual destructor present.  Because we almost
+    * universally use ralloc for our memory management of
+    * ir_instructions, the destructor doesn't need to do any work.
+    */
+   virtual ~ir_instruction()
+   {
+   }
+
    /** ir_print_visitor helper for debugging. */
    void print(void) const;
 




More information about the mesa-commit mailing list