public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] use DISABLE_COPY_AND_ASSIGN in switch_thru_all_uis
@ 2021-01-15 19:49 Lancelot SIX
  2021-01-15 20:09 ` Simon Marchi
  2021-01-15 21:28 ` [PATCH v2] " Lancelot SIX
  0 siblings, 2 replies; 4+ messages in thread
From: Lancelot SIX @ 2021-01-15 19:49 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

In switch_thru_all_uis,  a pre-c++11 way of removing copy constructor
and assignment operator is used.

This patch uses the DISABLE_COPY_AND_ASSIGN macro which does the right
thing for pre and post c++11.

gdb/Changelog:

	* top.h (switch_thru_all_uis): Use DISABLE_COPY_AND_ASSIGN.
---
 gdb/top.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/gdb/top.h b/gdb/top.h
index a31b19ae954..d912ea97190 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -190,10 +190,7 @@ class switch_thru_all_uis
 
  private:
 
-  /* No need for these.  They are intentionally not defined
-     anywhere.  */
-  switch_thru_all_uis &operator= (const switch_thru_all_uis &);
-  switch_thru_all_uis (const switch_thru_all_uis &);
+  DISABLE_COPY_AND_ASSIGN (switch_thru_all_uis);
 
   /* Used to iterate through the UIs.  */
   struct ui *m_iter;
-- 
2.29.2


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

* Re: [PATCH] use DISABLE_COPY_AND_ASSIGN in switch_thru_all_uis
  2021-01-15 19:49 [PATCH] use DISABLE_COPY_AND_ASSIGN in switch_thru_all_uis Lancelot SIX
@ 2021-01-15 20:09 ` Simon Marchi
  2021-01-15 21:28 ` [PATCH v2] " Lancelot SIX
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Marchi @ 2021-01-15 20:09 UTC (permalink / raw)
  To: Lancelot SIX, gdb-patches



On 2021-01-15 2:49 p.m., Lancelot SIX via Gdb-patches wrote:
> In switch_thru_all_uis,  a pre-c++11 way of removing copy constructor
> and assignment operator is used.
> 
> This patch uses the DISABLE_COPY_AND_ASSIGN macro which does the right
> thing for pre and post c++11.
> 
> gdb/Changelog:
> 
> 	* top.h (switch_thru_all_uis): Use DISABLE_COPY_AND_ASSIGN.
> ---
>  gdb/top.h | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/gdb/top.h b/gdb/top.h
> index a31b19ae954..d912ea97190 100644
> --- a/gdb/top.h
> +++ b/gdb/top.h
> @@ -190,10 +190,7 @@ class switch_thru_all_uis
>  
>   private:
>  
> -  /* No need for these.  They are intentionally not defined
> -     anywhere.  */
> -  switch_thru_all_uis &operator= (const switch_thru_all_uis &);
> -  switch_thru_all_uis (const switch_thru_all_uis &);
> +  DISABLE_COPY_AND_ASSIGN (switch_thru_all_uis);
>  
>    /* Used to iterate through the UIs.  */
>    struct ui *m_iter;
> 

Thanks, this LGTM.  Maybe just move the DISABLE_COPY_AND_ASSIGN so it's
right below the constructor (it no longer needs to be in the private
section, given we know we are using C++ >= 11).

Simon

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

* [PATCH v2] use DISABLE_COPY_AND_ASSIGN in switch_thru_all_uis
  2021-01-15 19:49 [PATCH] use DISABLE_COPY_AND_ASSIGN in switch_thru_all_uis Lancelot SIX
  2021-01-15 20:09 ` Simon Marchi
@ 2021-01-15 21:28 ` Lancelot SIX
  2021-01-15 21:38   ` Simon Marchi
  1 sibling, 1 reply; 4+ messages in thread
From: Lancelot SIX @ 2021-01-15 21:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

In switch_thru_all_uis,  a pre-c++11 way of removing copy constructor
and assignment operator is used.

This patch uses the DISABLE_COPY_AND_ASSIGN macro which does the right
thing for pre and post c++11.

gdb/Changelog:

	* top.h (switch_thru_all_uis): Use DISABLE_COPY_AND_ASSIGN.
---
 gdb/top.h | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/gdb/top.h b/gdb/top.h
index a31b19ae954..f58bebbb385 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -173,6 +173,8 @@ class switch_thru_all_uis
     current_ui = ui_list;
   }
 
+  DISABLE_COPY_AND_ASSIGN (switch_thru_all_uis);
+
   /* If done iterating, return true; otherwise return false.  */
   bool done () const
   {
@@ -190,11 +192,6 @@ class switch_thru_all_uis
 
  private:
 
-  /* No need for these.  They are intentionally not defined
-     anywhere.  */
-  switch_thru_all_uis &operator= (const switch_thru_all_uis &);
-  switch_thru_all_uis (const switch_thru_all_uis &);
-
   /* Used to iterate through the UIs.  */
   struct ui *m_iter;
 
-- 
2.29.2


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

* Re: [PATCH v2] use DISABLE_COPY_AND_ASSIGN in switch_thru_all_uis
  2021-01-15 21:28 ` [PATCH v2] " Lancelot SIX
@ 2021-01-15 21:38   ` Simon Marchi
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Marchi @ 2021-01-15 21:38 UTC (permalink / raw)
  To: Lancelot SIX, gdb-patches



On 2021-01-15 4:28 p.m., Lancelot SIX via Gdb-patches wrote:
> In switch_thru_all_uis,  a pre-c++11 way of removing copy constructor
> and assignment operator is used.
> 
> This patch uses the DISABLE_COPY_AND_ASSIGN macro which does the right
> thing for pre and post c++11.
> 
> gdb/Changelog:
> 
> 	* top.h (switch_thru_all_uis): Use DISABLE_COPY_AND_ASSIGN.
> ---
>  gdb/top.h | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/top.h b/gdb/top.h
> index a31b19ae954..f58bebbb385 100644
> --- a/gdb/top.h
> +++ b/gdb/top.h
> @@ -173,6 +173,8 @@ class switch_thru_all_uis
>      current_ui = ui_list;
>    }
>  
> +  DISABLE_COPY_AND_ASSIGN (switch_thru_all_uis);
> +
>    /* If done iterating, return true; otherwise return false.  */
>    bool done () const
>    {
> @@ -190,11 +192,6 @@ class switch_thru_all_uis
>  
>   private:
>  
> -  /* No need for these.  They are intentionally not defined
> -     anywhere.  */
> -  switch_thru_all_uis &operator= (const switch_thru_all_uis &);
> -  switch_thru_all_uis (const switch_thru_all_uis &);
> -
>    /* Used to iterate through the UIs.  */
>    struct ui *m_iter;
>  
> 

Thanks, this is ok.

Simon

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

end of thread, other threads:[~2021-01-15 21:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15 19:49 [PATCH] use DISABLE_COPY_AND_ASSIGN in switch_thru_all_uis Lancelot SIX
2021-01-15 20:09 ` Simon Marchi
2021-01-15 21:28 ` [PATCH v2] " Lancelot SIX
2021-01-15 21:38   ` Simon Marchi

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