[Mesa-dev] [PATCH] glsl: Clean up warnings about deleting classes without virtual destructors.

Kenneth Graunke kenneth at whitecape.org
Wed Jun 6 19:24:11 CEST 2012


On 06/06/2012 10:13 AM, Eric Anholt wrote:
> ---
>  src/glsl/ir.h |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/glsl/ir.h b/src/glsl/ir.h
> index 9c7961a..9f8698c 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;

Hm.  I'm pretty sure gcc 4.6 also complained about that.  But I could be
mistaken.  Either way,

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




More information about the mesa-dev mailing list