public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][pushed] VR: add more virtual dtors
@ 2022-08-16  9:31 Martin Liška
  0 siblings, 0 replies; only message in thread
From: Martin Liška @ 2022-08-16  9:31 UTC (permalink / raw)
  To: gcc-patches

Likewise pushed as obvious.

Martin

Add 2 virtual destructors in order to address:

gcc/alloc-pool.h:522:5: warning: destructor called on non-final 'value_range_equiv' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
gcc/ggc.h:166:3: warning: destructor called on non-final 'int_range<1>' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]

gcc/ChangeLog:

	* value-range-equiv.h (class value_range_equiv): Add virtual
	  destructor.
	* value-range.h: Likewise.
---
 gcc/value-range-equiv.h | 3 +++
 gcc/value-range.h       | 1 +
 2 files changed, 4 insertions(+)

diff --git a/gcc/value-range-equiv.h b/gcc/value-range-equiv.h
index ad8c640b15b..1a8014df834 100644
--- a/gcc/value-range-equiv.h
+++ b/gcc/value-range-equiv.h
@@ -37,6 +37,9 @@ class GTY((user)) value_range_equiv : public value_range
   /* Shallow-copies equiv bitmap.  */
   value_range_equiv& operator=(const value_range_equiv &) /* = delete */;
 
+  /* Virtual destructor.  */
+  virtual ~value_range_equiv () = default;
+
   /* Move equiv bitmap from source range.  */
   void move (value_range_equiv *);
 
diff --git a/gcc/value-range.h b/gcc/value-range.h
index 856947d23dd..f0075d0fb1a 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -228,6 +228,7 @@ public:
   int_range (tree type);
   int_range (const int_range &);
   int_range (const irange &);
+  virtual ~int_range () = default;
   int_range& operator= (const int_range &);
 private:
   template <unsigned X> friend void gt_ggc_mx (int_range<X> *);
-- 
2.37.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-16  9:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-16  9:31 [PATCH][pushed] VR: add more virtual dtors Martin Liška

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).