public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Use DISABLE_COPY_AND_ASSIGN
@ 2019-12-05 20:08 David Malcolm
  2019-12-05 20:09 ` [PATCH 3/6] Use DISABLE_COPY_AND_ASSIGN in analyzer-logging.h David Malcolm
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: David Malcolm @ 2019-12-05 20:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

I added DISABLE_COPY_AND_ASSIGN to various places that had a dtor
but which didn't implement a copy-ctor and assign-operator.

Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.

Pushed to branch "dmalcolm/analyzer" on the GCC git mirror.

David Malcolm (6):
  Use DISABLE_COPY_AND_ASSIGN in auto_timevar
  Use DISABLE_COPY_AND_ASSIGN in auto_client_timevar
  Use DISABLE_COPY_AND_ASSIGN in analyzer-logging.h
  Use DISABLE_COPY_AND_ASSIGN in jit-logging.h
  [analyzer] Use DISABLE_COPY_AND_ASSIGN in various places
  Use DISABLE_COPY_AND_ASSIGN in auto_delete_vec

 gcc/analyzer/analysis-plan.h      | 2 ++
 gcc/analyzer/analyzer-logging.h   | 6 ++++++
 gcc/analyzer/diagnostic-manager.h | 3 +++
 gcc/analyzer/exploded-graph.h     | 7 +++++++
 gcc/analyzer/sm.h                 | 2 ++
 gcc/analyzer/state-purge.h        | 2 ++
 gcc/jit/jit-logging.h             | 6 ++++++
 gcc/timevar.h                     | 7 ++-----
 gcc/vec.h                         | 3 +++
 9 files changed, 33 insertions(+), 5 deletions(-)

-- 
2.21.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/6] Use DISABLE_COPY_AND_ASSIGN in analyzer-logging.h
  2019-12-05 20:08 [PATCH 0/6] Use DISABLE_COPY_AND_ASSIGN David Malcolm
@ 2019-12-05 20:09 ` David Malcolm
  2019-12-05 20:09 ` [PATCH 1/6] Use DISABLE_COPY_AND_ASSIGN in auto_timevar David Malcolm
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Malcolm @ 2019-12-05 20:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

gcc/ChangeLog:
	* analyzer/analyzer-logging.h (logger): Use
	DISABLE_COPY_AND_ASSIGN.
	(log_scope): Likewise.
	(log_user): Likewise.
---
 gcc/analyzer/analyzer-logging.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/analyzer/analyzer-logging.h b/gcc/analyzer/analyzer-logging.h
index 3e000b60495f..fac5e37f94a8 100644
--- a/gcc/analyzer/analyzer-logging.h
+++ b/gcc/analyzer/analyzer-logging.h
@@ -57,6 +57,8 @@ class logger
   FILE *get_file () const { return m_f_out; }
 
 private:
+  DISABLE_COPY_AND_ASSIGN (logger);
+
   int m_refcount;
   FILE *m_f_out;
   int m_indent_level;
@@ -77,6 +79,8 @@ public:
   ~log_scope ();
 
  private:
+  DISABLE_COPY_AND_ASSIGN (log_scope);
+
   logger *m_logger;
   const char *m_name;
 };
@@ -167,6 +171,8 @@ class log_user
   }
 
  private:
+  DISABLE_COPY_AND_ASSIGN (log_user);
+
   logger *m_logger;
 };
 
-- 
2.21.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/6] Use DISABLE_COPY_AND_ASSIGN in auto_timevar
  2019-12-05 20:08 [PATCH 0/6] Use DISABLE_COPY_AND_ASSIGN David Malcolm
  2019-12-05 20:09 ` [PATCH 3/6] Use DISABLE_COPY_AND_ASSIGN in analyzer-logging.h David Malcolm
@ 2019-12-05 20:09 ` David Malcolm
  2019-12-05 20:09 ` [PATCH 5/6] [analyzer] Use DISABLE_COPY_AND_ASSIGN in various places David Malcolm
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Malcolm @ 2019-12-05 20:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

gcc/ChangeLog:
	* timevar.h (auto_timevar): Use DISABLE_COPY_AND_ASSIGN.
---
 gcc/timevar.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/timevar.h b/gcc/timevar.h
index d053ab795acf..c3b6233c35dd 100644
--- a/gcc/timevar.h
+++ b/gcc/timevar.h
@@ -248,9 +248,7 @@ class auto_timevar
   }
 
  private:
-
-  // Private to disallow copies.
-  auto_timevar (const auto_timevar &);
+  DISABLE_COPY_AND_ASSIGN (auto_timevar);
 
   timer *m_timer;
   timevar_id_t m_tv;
-- 
2.21.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/6] [analyzer] Use DISABLE_COPY_AND_ASSIGN in various places
  2019-12-05 20:08 [PATCH 0/6] Use DISABLE_COPY_AND_ASSIGN David Malcolm
  2019-12-05 20:09 ` [PATCH 3/6] Use DISABLE_COPY_AND_ASSIGN in analyzer-logging.h David Malcolm
  2019-12-05 20:09 ` [PATCH 1/6] Use DISABLE_COPY_AND_ASSIGN in auto_timevar David Malcolm
@ 2019-12-05 20:09 ` David Malcolm
  2019-12-05 20:09 ` [PATCH 4/6] Use DISABLE_COPY_AND_ASSIGN in jit-logging.h David Malcolm
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Malcolm @ 2019-12-05 20:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

This patch adds DISABLE_COPY_AND_ASSIGN to various classes that had
a dtor but for which I hadn't bothered implementing the copy ctor
and assignment operator.

gcc/ChangeLog:
	* analyzer/analysis-plan.h (analysis_plan): Add
	DISABLE_COPY_AND_ASSIGN.
	* analyzer/diagnostic-manager.h (saved_diagnostic): Likewise.
	* analyzer/exploded-graph.h (exploded_node): Likewise.
	(exploded_edge): Likewise.
	(exploded_graph): Likewise.
	* analyzer/sm.h (state_machine): Likewise.
	* analyzer/state-purge.h (state_purge_map): Likewise.
---
 gcc/analyzer/analysis-plan.h      | 2 ++
 gcc/analyzer/diagnostic-manager.h | 3 +++
 gcc/analyzer/exploded-graph.h     | 7 +++++++
 gcc/analyzer/sm.h                 | 2 ++
 gcc/analyzer/state-purge.h        | 2 ++
 5 files changed, 16 insertions(+)

diff --git a/gcc/analyzer/analysis-plan.h b/gcc/analyzer/analysis-plan.h
index c9396ec83854..f22e7338b1e7 100644
--- a/gcc/analyzer/analysis-plan.h
+++ b/gcc/analyzer/analysis-plan.h
@@ -42,6 +42,8 @@ public:
   bool use_summary_p (const cgraph_edge *edge) const;
 
 private:
+  DISABLE_COPY_AND_ASSIGN (analysis_plan);
+
   const supergraph &m_sg;
 
   /* Result of ipa_reverse_postorder.  */
diff --git a/gcc/analyzer/diagnostic-manager.h b/gcc/analyzer/diagnostic-manager.h
index 8591d2ec7cd6..ac4e74a9090c 100644
--- a/gcc/analyzer/diagnostic-manager.h
+++ b/gcc/analyzer/diagnostic-manager.h
@@ -59,6 +59,9 @@ public:
   state_machine::state_t m_state;
   pending_diagnostic *m_d;
   exploded_edge *m_trailing_eedge;
+
+private:
+  DISABLE_COPY_AND_ASSIGN (saved_diagnostic);
 };
 
 /* A class with responsibility for saving pending diagnostics, so that
diff --git a/gcc/analyzer/exploded-graph.h b/gcc/analyzer/exploded-graph.h
index 26ae109628f4..c8784acd8d91 100644
--- a/gcc/analyzer/exploded-graph.h
+++ b/gcc/analyzer/exploded-graph.h
@@ -241,6 +241,8 @@ class exploded_node : public dnode<eg_traits>
   void dump_succs_and_preds (FILE *outf) const;
 
 private:
+  DISABLE_COPY_AND_ASSIGN (exploded_node);
+
   const char * get_dot_fillcolor () const;
 
   /* The <program_point, program_state> pair.  This is const, as it
@@ -296,6 +298,9 @@ class exploded_edge : public dedge<eg_traits>
 
      Owned by this class.  */
   custom_info_t *m_custom_info;
+
+private:
+  DISABLE_COPY_AND_ASSIGN (exploded_edge);
 };
 
 /* Extra data for an exploded_edge that represents a rewind from a
@@ -733,6 +738,8 @@ public:
   { return &m_per_call_string_data; }
 
 private:
+  DISABLE_COPY_AND_ASSIGN (exploded_graph);
+
   const supergraph &m_sg;
 
   /* Map from point/state to exploded node.
diff --git a/gcc/analyzer/sm.h b/gcc/analyzer/sm.h
index 905e64407df6..65205f8fd47f 100644
--- a/gcc/analyzer/sm.h
+++ b/gcc/analyzer/sm.h
@@ -90,6 +90,8 @@ protected:
   state_t add_state (const char *name);
 
 private:
+  DISABLE_COPY_AND_ASSIGN (state_machine);
+
   const char *m_name;
   auto_vec<const char *> m_state_names;
 };
diff --git a/gcc/analyzer/state-purge.h b/gcc/analyzer/state-purge.h
index f50c239503ea..46be95bcb9a1 100644
--- a/gcc/analyzer/state-purge.h
+++ b/gcc/analyzer/state-purge.h
@@ -105,6 +105,8 @@ public:
   iterator end () const { return m_map.end (); }
 
 private:
+  DISABLE_COPY_AND_ASSIGN (state_purge_map);
+
   const supergraph &m_sg;
   map_t m_map;
 };
-- 
2.21.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/6] Use DISABLE_COPY_AND_ASSIGN in auto_client_timevar
  2019-12-05 20:08 [PATCH 0/6] Use DISABLE_COPY_AND_ASSIGN David Malcolm
                   ` (4 preceding siblings ...)
  2019-12-05 20:09 ` [PATCH 6/6] Use DISABLE_COPY_AND_ASSIGN in auto_delete_vec David Malcolm
@ 2019-12-05 20:09 ` David Malcolm
  5 siblings, 0 replies; 7+ messages in thread
From: David Malcolm @ 2019-12-05 20:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

gcc/ChangeLog:
	* timevar.h (auto_client_timevar): Use DISABLE_COPY_AND_ASSIGN.
---
 gcc/timevar.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/timevar.h b/gcc/timevar.h
index c3b6233c35dd..47586f7b5847 100644
--- a/gcc/timevar.h
+++ b/gcc/timevar.h
@@ -281,8 +281,7 @@ class auto_client_timevar
   }
 
  private:
-  // Private to disallow copies.
-  auto_client_timevar (const auto_client_timevar &);
+  DISABLE_COPY_AND_ASSIGN (auto_client_timevar);
 
   timer *m_timer;
 };
-- 
2.21.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/6] Use DISABLE_COPY_AND_ASSIGN in jit-logging.h
  2019-12-05 20:08 [PATCH 0/6] Use DISABLE_COPY_AND_ASSIGN David Malcolm
                   ` (2 preceding siblings ...)
  2019-12-05 20:09 ` [PATCH 5/6] [analyzer] Use DISABLE_COPY_AND_ASSIGN in various places David Malcolm
@ 2019-12-05 20:09 ` David Malcolm
  2019-12-05 20:09 ` [PATCH 6/6] Use DISABLE_COPY_AND_ASSIGN in auto_delete_vec David Malcolm
  2019-12-05 20:09 ` [PATCH 2/6] Use DISABLE_COPY_AND_ASSIGN in auto_client_timevar David Malcolm
  5 siblings, 0 replies; 7+ messages in thread
From: David Malcolm @ 2019-12-05 20:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

gcc/jit/ChangeLog:
	* jit-logging.h (gcc::jit::logger): Use DISABLE_COPY_AND_ASSIGN.
	(gcc::jit::log_scope): Likewise.
	(gcc::jit::log_user): Likewise.
---
 gcc/jit/jit-logging.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/jit/jit-logging.h b/gcc/jit/jit-logging.h
index db0b6a531043..cc0036a10880 100644
--- a/gcc/jit/jit-logging.h
+++ b/gcc/jit/jit-logging.h
@@ -48,6 +48,8 @@ class logger
   void exit_scope (const char *scope_name);
 
 private:
+  DISABLE_COPY_AND_ASSIGN (logger);
+
   int m_refcount;
   FILE *m_f_out;
   int m_indent_level;
@@ -65,6 +67,8 @@ public:
   ~log_scope ();
 
  private:
+  DISABLE_COPY_AND_ASSIGN (log_scope);
+
   logger *m_logger;
   const char *m_name;
 };
@@ -134,6 +138,8 @@ class log_user
   void exit_scope (const char *scope_name);
 
  private:
+  DISABLE_COPY_AND_ASSIGN (log_user);
+
   logger *m_logger;
 };
 
-- 
2.21.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 6/6] Use DISABLE_COPY_AND_ASSIGN in auto_delete_vec
  2019-12-05 20:08 [PATCH 0/6] Use DISABLE_COPY_AND_ASSIGN David Malcolm
                   ` (3 preceding siblings ...)
  2019-12-05 20:09 ` [PATCH 4/6] Use DISABLE_COPY_AND_ASSIGN in jit-logging.h David Malcolm
@ 2019-12-05 20:09 ` David Malcolm
  2019-12-05 20:09 ` [PATCH 2/6] Use DISABLE_COPY_AND_ASSIGN in auto_client_timevar David Malcolm
  5 siblings, 0 replies; 7+ messages in thread
From: David Malcolm @ 2019-12-05 20:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

gcc/ChangeLog:
	* vec.h (auto_delete_vec): Use DISABLE_COPY_AND_ASSIGN.
---
 gcc/vec.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/vec.h b/gcc/vec.h
index 1957739ecb56..706a6103b744 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1559,6 +1559,9 @@ class auto_delete_vec : public auto_vec <T *>
   auto_delete_vec (size_t s) : auto_vec <T *> (s) {}
 
   ~auto_delete_vec ();
+
+private:
+  DISABLE_COPY_AND_ASSIGN(auto_delete_vec<T>);
 };
 
 /* Conditionally allocate heap memory for VEC and its internal vector.  */
-- 
2.21.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-05 20:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05 20:08 [PATCH 0/6] Use DISABLE_COPY_AND_ASSIGN David Malcolm
2019-12-05 20:09 ` [PATCH 3/6] Use DISABLE_COPY_AND_ASSIGN in analyzer-logging.h David Malcolm
2019-12-05 20:09 ` [PATCH 1/6] Use DISABLE_COPY_AND_ASSIGN in auto_timevar David Malcolm
2019-12-05 20:09 ` [PATCH 5/6] [analyzer] Use DISABLE_COPY_AND_ASSIGN in various places David Malcolm
2019-12-05 20:09 ` [PATCH 4/6] Use DISABLE_COPY_AND_ASSIGN in jit-logging.h David Malcolm
2019-12-05 20:09 ` [PATCH 6/6] Use DISABLE_COPY_AND_ASSIGN in auto_delete_vec David Malcolm
2019-12-05 20:09 ` [PATCH 2/6] Use DISABLE_COPY_AND_ASSIGN in auto_client_timevar David Malcolm

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).