* [PATCH] Add a missing munmap_list move constructor
@ 2020-09-24 5:22 Saagar Jha
2020-09-24 15:27 ` Simon Marchi
0 siblings, 1 reply; 7+ messages in thread
From: Saagar Jha @ 2020-09-24 5:22 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 339 bytes --]
Clang warns if the default implementation of a function is requested but it is implicitly deleted. This was happening to compile_module because it didn’t have a move constructor for its munmap_list member, so I went ahead and added one since it already had a move assignment operator defined for it and this seemed like an oversight.
[-- Attachment #2: Add-a-missing-munmap_list-move-constructor.patch --]
[-- Type: application/octet-stream, Size: 1486 bytes --]
From 3ed7e54dfc5b3ab0a6033a239f8d6a457cb91f92 Mon Sep 17 00:00:00 2001
From: Saagar Jha <saagar@saagarjha.com>
Date: Wed, 23 Sep 2020 22:16:17 -0700
Subject: [PATCH] Add a missing munmap_list move constructor
compile_module attempts to request a move constructor, but because
munmap_list doesn't have one it gets implicitly deleted. This is an
warning on clang under -Wdefaulted-function-deleted (which is enabled by
default).
gdb/ChangeLog:
* compile/compile-object-load.h: Give munmap_list a move
constructor.
---
gdb/ChangeLog | 5 +++++
gdb/compile/compile-object-load.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 241f3e7027..3aa3255b37 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-09-23 Saagar Jha <saagar@saagarjha.com>
+
+ * compile/compile-object-load.h: Give munmap_list a move
+ constructor.
+
2020-09-23 Tom Tromey <tom@tromey.com>
PR symtab/25470:
diff --git a/gdb/compile/compile-object-load.h b/gdb/compile/compile-object-load.h
index 0254390109..166d442ad0 100644
--- a/gdb/compile/compile-object-load.h
+++ b/gdb/compile/compile-object-load.h
@@ -30,6 +30,7 @@ struct munmap_list
DISABLE_COPY_AND_ASSIGN (munmap_list);
munmap_list &operator= (munmap_list &&) = default;
+ munmap_list (munmap_list &&) = default;
/* Add a region to the list. */
void add (CORE_ADDR addr, CORE_ADDR size);
--
2.28.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add a missing munmap_list move constructor
2020-09-24 5:22 [PATCH] Add a missing munmap_list move constructor Saagar Jha
@ 2020-09-24 15:27 ` Simon Marchi
2020-09-25 6:59 ` Saagar Jha
0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2020-09-24 15:27 UTC (permalink / raw)
To: Saagar Jha, gdb-patches
On 2020-09-24 1:22 a.m., Saagar Jha wrote:
> Clang warns if the default implementation of a function is requested but it is implicitly deleted. This was happening to compile_module because it didn’t have a move constructor for its munmap_list member, so I went ahead and added one since it already had a move assignment operator defined for it and this seemed like an oversight.
>
When fixing a compilation failure, please always include a paste of the
error in the commit message. But the change itself looks good to me.
If you are compiling with clang I presume you also see this error in
macroexp.c?
/home/simark/src/binutils-gdb/gdb/macroexp.c:125:3: error: definition of implicit copy constructor for 'macro_buffer' is deprecated because it has a user-declared destructor [-Werror,-Wdeprecated-copy-dtor]
~macro_buffer ()
^
I've tried to look into it in the past but I didn't manage to fix it.
The ownership model in there is a big bowl of spaghetti.
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add a missing munmap_list move constructor
2020-09-24 15:27 ` Simon Marchi
@ 2020-09-25 6:59 ` Saagar Jha
2020-09-25 7:05 ` Saagar Jha
0 siblings, 1 reply; 7+ messages in thread
From: Saagar Jha @ 2020-09-25 6:59 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
No, actually I’m not seeing that error; this is what I was trying to fix (yes, I’ll put it into the commit message when I update the patch):
In file included from compile/compile-object-load.c:21:
compile/compile-object-load.h:56:3: error: explicitly defaulted move constructor is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
compile_module (compile_module &&other) = default;
^
compile/compile-object-load.h:86:22: note: move constructor of 'compile_module' is implicitly deleted because field 'munmap_list' has a deleted move constructor
struct munmap_list munmap_list;
^
compile/compile-object-load.h:30:28: note: 'munmap_list' has been explicitly marked deleted here
DISABLE_COPY_AND_ASSIGN (munmap_list);
^
To be clear, I am building GDB for macOS and found this because my CI told me about it: https://travis-ci.com/github/saagarjha/binutils-gdb. Until now the build has been green, so I am assuming that the compiler I have been using either doesn’t warn on the issue or that code looks fine to it…in any case, for the code it’s complaining about I think we should be able to take guidance on ownership from the copy assignment operator right above that destructor.
> On Sep 24, 2020, at 08:27, Simon Marchi <simark@simark.ca> wrote:
>
> On 2020-09-24 1:22 a.m., Saagar Jha wrote:
>> Clang warns if the default implementation of a function is requested but it is implicitly deleted. This was happening to compile_module because it didn’t have a move constructor for its munmap_list member, so I went ahead and added one since it already had a move assignment operator defined for it and this seemed like an oversight.
>>
>
> When fixing a compilation failure, please always include a paste of the
> error in the commit message. But the change itself looks good to me.
>
> If you are compiling with clang I presume you also see this error in
> macroexp.c?
>
> /home/simark/src/binutils-gdb/gdb/macroexp.c:125:3: error: definition of implicit copy constructor for 'macro_buffer' is deprecated because it has a user-declared destructor [-Werror,-Wdeprecated-copy-dtor]
> ~macro_buffer ()
> ^
>
> I've tried to look into it in the past but I didn't manage to fix it.
> The ownership model in there is a big bowl of spaghetti.
>
> Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Add a missing munmap_list move constructor
2020-09-25 6:59 ` Saagar Jha
@ 2020-09-25 7:05 ` Saagar Jha
2020-09-25 7:05 ` Saagar Jha
2020-09-25 14:58 ` Simon Marchi
0 siblings, 2 replies; 7+ messages in thread
From: Saagar Jha @ 2020-09-25 7:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Saagar Jha
compile_module attempts to request a move constructor, but because
munmap_list doesn't have one it gets implicitly deleted. This is an
warning on clang under -Wdefaulted-function-deleted (which is enabled by
default):
In file included from compile/compile-object-load.c:21:
compile/compile-object-load.h:56:3: error: explicitly defaulted move constructor is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
compile_module (compile_module &&other) = default;
^
compile/compile-object-load.h:86:22: note: move constructor of 'compile_module' is implicitly deleted because field 'munmap_list' has a deleted move constructor
struct munmap_list munmap_list;
^
compile/compile-object-load.h:30:28: note: 'munmap_list' has been explicitly marked deleted here
DISABLE_COPY_AND_ASSIGN (munmap_list);
^
gdb/ChangeLog:
* compile/compile-object-load.h: Give munmap_list a move
constructor.
---
gdb/ChangeLog | 5 +++++
gdb/compile/compile-object-load.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3872a8d9cb..043c6a4c72 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-09-25 Saagar Jha <saagar@saagarjha.com>
+
+ * compile/compile-object-load.h: Give munmap_list a move
+ constructor.
+
2020-09-24 Tom Tromey <tromey@adacore.com>
PR tui/26638:
diff --git a/gdb/compile/compile-object-load.h b/gdb/compile/compile-object-load.h
index 0254390109..166d442ad0 100644
--- a/gdb/compile/compile-object-load.h
+++ b/gdb/compile/compile-object-load.h
@@ -30,6 +30,7 @@ struct munmap_list
DISABLE_COPY_AND_ASSIGN (munmap_list);
munmap_list &operator= (munmap_list &&) = default;
+ munmap_list (munmap_list &&) = default;
/* Add a region to the list. */
void add (CORE_ADDR addr, CORE_ADDR size);
--
2.28.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Add a missing munmap_list move constructor
2020-09-25 7:05 ` Saagar Jha
@ 2020-09-25 7:05 ` Saagar Jha
2020-09-25 14:58 ` Simon Marchi
1 sibling, 0 replies; 7+ messages in thread
From: Saagar Jha @ 2020-09-25 7:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Saagar Jha
compile_module attempts to request a move constructor, but because
munmap_list doesn't have one it gets implicitly deleted. This is an
warning on clang under -Wdefaulted-function-deleted (which is enabled by
default):
In file included from compile/compile-object-load.c:21:
compile/compile-object-load.h:56:3: error: explicitly defaulted move constructor is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
compile_module (compile_module &&other) = default;
^
compile/compile-object-load.h:86:22: note: move constructor of 'compile_module' is implicitly deleted because field 'munmap_list' has a deleted move constructor
struct munmap_list munmap_list;
^
compile/compile-object-load.h:30:28: note: 'munmap_list' has been explicitly marked deleted here
DISABLE_COPY_AND_ASSIGN (munmap_list);
^
gdb/ChangeLog:
* compile/compile-object-load.h: Give munmap_list a move
constructor.
---
gdb/ChangeLog | 5 +++++
gdb/compile/compile-object-load.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3872a8d9cb..043c6a4c72 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-09-25 Saagar Jha <saagar@saagarjha.com>
+
+ * compile/compile-object-load.h: Give munmap_list a move
+ constructor.
+
2020-09-24 Tom Tromey <tromey@adacore.com>
PR tui/26638:
diff --git a/gdb/compile/compile-object-load.h b/gdb/compile/compile-object-load.h
index 0254390109..166d442ad0 100644
--- a/gdb/compile/compile-object-load.h
+++ b/gdb/compile/compile-object-load.h
@@ -30,6 +30,7 @@ struct munmap_list
DISABLE_COPY_AND_ASSIGN (munmap_list);
munmap_list &operator= (munmap_list &&) = default;
+ munmap_list (munmap_list &&) = default;
/* Add a region to the list. */
void add (CORE_ADDR addr, CORE_ADDR size);
--
2.28.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add a missing munmap_list move constructor
2020-09-25 7:05 ` Saagar Jha
2020-09-25 7:05 ` Saagar Jha
@ 2020-09-25 14:58 ` Simon Marchi
2020-09-26 0:25 ` Saagar Jha
1 sibling, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2020-09-25 14:58 UTC (permalink / raw)
To: Saagar Jha, gdb-patches
On 2020-09-25 3:05 a.m., Saagar Jha wrote:
> compile_module attempts to request a move constructor, but because
> munmap_list doesn't have one it gets implicitly deleted. This is an
> warning on clang under -Wdefaulted-function-deleted (which is enabled by
> default):
>
> In file included from compile/compile-object-load.c:21:
> compile/compile-object-load.h:56:3: error: explicitly defaulted move constructor is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
> compile_module (compile_module &&other) = default;
> ^
> compile/compile-object-load.h:86:22: note: move constructor of 'compile_module' is implicitly deleted because field 'munmap_list' has a deleted move constructor
> struct munmap_list munmap_list;
> ^
> compile/compile-object-load.h:30:28: note: 'munmap_list' has been explicitly marked deleted here
> DISABLE_COPY_AND_ASSIGN (munmap_list);
> ^
>
> gdb/ChangeLog:
>
> * compile/compile-object-load.h: Give munmap_list a move
> constructor.
Thanks, I pushed it. FYI, I tweaked the ChangeLog entry to include the
structure name in parenthesis:
* compile/compile-object-load.h (struct munmap_list): Add
explicitly-defined move constructor.
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add a missing munmap_list move constructor
2020-09-25 14:58 ` Simon Marchi
@ 2020-09-26 0:25 ` Saagar Jha
0 siblings, 0 replies; 7+ messages in thread
From: Saagar Jha @ 2020-09-26 0:25 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
Thanks, the code seems to build cleanly now :)
> On Sep 25, 2020, at 07:58, Simon Marchi <simark@simark.ca> wrote:
>
> On 2020-09-25 3:05 a.m., Saagar Jha wrote:
>> compile_module attempts to request a move constructor, but because
>> munmap_list doesn't have one it gets implicitly deleted. This is an
>> warning on clang under -Wdefaulted-function-deleted (which is enabled by
>> default):
>>
>> In file included from compile/compile-object-load.c:21:
>> compile/compile-object-load.h:56:3: error: explicitly defaulted move constructor is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
>> compile_module (compile_module &&other) = default;
>> ^
>> compile/compile-object-load.h:86:22: note: move constructor of 'compile_module' is implicitly deleted because field 'munmap_list' has a deleted move constructor
>> struct munmap_list munmap_list;
>> ^
>> compile/compile-object-load.h:30:28: note: 'munmap_list' has been explicitly marked deleted here
>> DISABLE_COPY_AND_ASSIGN (munmap_list);
>> ^
>>
>> gdb/ChangeLog:
>>
>> * compile/compile-object-load.h: Give munmap_list a move
>> constructor.
>
> Thanks, I pushed it. FYI, I tweaked the ChangeLog entry to include the
> structure name in parenthesis:
>
> * compile/compile-object-load.h (struct munmap_list): Add
> explicitly-defined move constructor.
>
> Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-09-26 0:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-24 5:22 [PATCH] Add a missing munmap_list move constructor Saagar Jha
2020-09-24 15:27 ` Simon Marchi
2020-09-25 6:59 ` Saagar Jha
2020-09-25 7:05 ` Saagar Jha
2020-09-25 7:05 ` Saagar Jha
2020-09-25 14:58 ` Simon Marchi
2020-09-26 0:25 ` Saagar Jha
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).