diff options
author | Pedro Alves <palves@redhat.com> | 2017-04-25 01:27:42 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-04-25 01:43:06 +0100 |
commit | 5625a2864147f4d92b22edfeeab7600818988be2 (patch) | |
tree | ca0186cbd9c0151663899d86542d2587e230de0d /gdb/ada-lang.c | |
parent | 23bcc18f470ee4364bd362a8b78c6c1415a9dadb (diff) | |
download | gdb-5625a2864147f4d92b22edfeeab7600818988be2.zip gdb-5625a2864147f4d92b22edfeeab7600818988be2.tar.gz gdb-5625a2864147f4d92b22edfeeab7600818988be2.tar.bz2 |
Don't memset non-POD types: struct bp_location
struct bp_location is not a POD, so we shouldn't be using memset to
initialize it.
Caught like this:
src/gdb/breakpoint.c: In function ‘bp_location** get_first_locp_gte_addr(CORE_ADDR)’:
src/gdb/breakpoint.c:950:53: error: use of deleted function ‘void* memset(T*, int, size_t) [with T = bp_location; <template-parameter-1-2> = void; size_t = long unsigned int]’
memset (&dummy_loc, 0, sizeof (struct bp_location));
^
In file included from src/gdb/defs.h:28:0,
from src/gdb/breakpoint.c:20:
src/gdb/common/common-defs.h:126:7: note: declared here
void *memset (T *s, int c, size_t n) = delete;
^
gdb/ChangeLog:
2017-04-25 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_catchpoint_location): Now a "class". Remove
"base" field and inherit from "bp_location" instead. Add
non-default ctor.
(allocate_location_exception): Use new non-default ctor.
* breakpoint.c (get_first_locp_gte_addr): Remove memset call.
(init_bp_location): Convert to ...
(bp_location::bp_location): ... this new ctor, and remove memset
call.
(base_breakpoint_allocate_location): Use the new non-default ctor.
* breakpoint.h (bp_location): Now a class. Declare default and
non-default ctors. In-class initialize all members.
(init_bp_location): Remove declaration.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 2e5643b..58c8a2e 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -12224,14 +12224,14 @@ static char *ada_exception_catchpoint_cond_string (const char *excep_string); when symbols change. */ /* An instance of this type is used to represent an Ada catchpoint - breakpoint location. It includes a "struct bp_location" as a kind - of base class; users downcast to "struct bp_location *" when - needed. */ + breakpoint location. */ -struct ada_catchpoint_location +class ada_catchpoint_location : public bp_location { - /* The base class. */ - struct bp_location base; +public: + ada_catchpoint_location (const bp_location_ops *ops, breakpoint *owner) + : bp_location (ops, owner) + {} /* The condition that checks whether the exception that was raised is the specific exception the user specified on catchpoint @@ -12347,12 +12347,7 @@ static struct bp_location * allocate_location_exception (enum ada_exception_catchpoint_kind ex, struct breakpoint *self) { - struct ada_catchpoint_location *loc; - - loc = new ada_catchpoint_location (); - init_bp_location (&loc->base, &ada_catchpoint_location_ops, self); - loc->excep_cond_expr = NULL; - return &loc->base; + return new ada_catchpoint_location (&ada_catchpoint_location_ops, self); } /* Implement the RE_SET method in the breakpoint_ops structure for all |