diff options
author | Tom Tromey <tromey@adacore.com> | 2019-02-26 14:59:47 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2019-03-05 08:48:40 -0700 |
commit | 895dafa679db7af79576dcd177a6d91d65657ee8 (patch) | |
tree | ff0395477787a0b1b5f432866f3428e9edbf40e5 /gdb | |
parent | 88a774b9984e42c492ddcf4e4b4b0170ac803576 (diff) | |
download | gdb-895dafa679db7af79576dcd177a6d91d65657ee8.zip gdb-895dafa679db7af79576dcd177a6d91d65657ee8.tar.gz gdb-895dafa679db7af79576dcd177a6d91d65657ee8.tar.bz2 |
Add ATTRIBUTE_UNUSED_RESULT to ref_ptr::release
This applies ATTRIBUTE_UNUSED_RESULT to ref_ptr::release and updates a
few spots to comply. I believe one use in install_default_visualizer
was in error, fixed by this patch.
gdb/ChangeLog
2019-03-05 Tom Tromey <tromey@adacore.com>
* varobj.c (update_dynamic_varobj_children): Update.
(install_default_visualizer): Use reset, not release.
* value.c (set_internalvar): Update.
* dwarf2loc.c (value_of_dwarf_reg_entry): Update.
* common/gdb_ref_ptr.h (class ref_ptr) <release>: Add
ATTRIBUTE_UNUSED_RESULT.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/common/gdb_ref_ptr.h | 2 | ||||
-rw-r--r-- | gdb/dwarf2loc.c | 3 | ||||
-rw-r--r-- | gdb/value.c | 10 | ||||
-rw-r--r-- | gdb/varobj.c | 4 |
5 files changed, 18 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6ed91e2..bb94ae2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,14 @@ 2019-03-05 Tom Tromey <tromey@adacore.com> + * varobj.c (update_dynamic_varobj_children): Update. + (install_default_visualizer): Use reset, not release. + * value.c (set_internalvar): Update. + * dwarf2loc.c (value_of_dwarf_reg_entry): Update. + * common/gdb_ref_ptr.h (class ref_ptr) <release>: Add + ATTRIBUTE_UNUSED_RESULT. + +2019-03-05 Tom Tromey <tromey@adacore.com> + * remote.c (class scoped_remote_fd) <release>: Add ATTRIBUTE_UNUSED_RESULT. diff --git a/gdb/common/gdb_ref_ptr.h b/gdb/common/gdb_ref_ptr.h index b104556..c31c9a2 100644 --- a/gdb/common/gdb_ref_ptr.h +++ b/gdb/common/gdb_ref_ptr.h @@ -135,7 +135,7 @@ class ref_ptr /* Return this instance's referent, and stop managing this reference. The caller is now responsible for the ownership of the reference. */ - T *release () + ATTRIBUTE_UNUSED_RESULT T *release () { T *result = m_obj; diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 9c974a1..29d289b 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -1472,9 +1472,8 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame, target_type, caller_frame, caller_per_cu); - release_value (target_val).release (); val = allocate_computed_value (type, &entry_data_value_funcs, - target_val /* closure */); + release_value (target_val).release ()); /* Copy the referencing pointer to the new computed value. */ memcpy (value_contents_raw (val), value_contents_raw (outer_val), diff --git a/gdb/value.c b/gdb/value.c index 95b6a56..50e47a9 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2274,20 +2274,20 @@ set_internalvar (struct internalvar *var, struct value *val) default: new_kind = INTERNALVAR_VALUE; - new_data.value = value_copy (val); - new_data.value->modifiable = 1; + struct value *copy = value_copy (val); + copy->modifiable = 1; /* Force the value to be fetched from the target now, to avoid problems later when this internalvar is referenced and the target is gone or has changed. */ - if (value_lazy (new_data.value)) - value_fetch_lazy (new_data.value); + if (value_lazy (copy)) + value_fetch_lazy (copy); /* Release the value from the value chain to prevent it from being deleted by free_all_values. From here on this function should not call error () until new_data is installed into the var->u to avoid leaking memory. */ - release_value (new_data.value).release (); + new_data.value = release_value (copy).release (); /* Internal variables which are created from values with a dynamic location don't need the location property of the origin anymore. diff --git a/gdb/varobj.c b/gdb/varobj.c index b033070..3715bb6 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -760,7 +760,7 @@ update_dynamic_varobj_children (struct varobj *var, /* Release vitem->value so its lifetime is not bound to the execution of a command. */ if (item != NULL && item->value != NULL) - release_value (item->value).release (); + item->value = release_value (item->value).release (); } if (item == NULL) @@ -1127,7 +1127,7 @@ install_default_visualizer (struct varobj *var) } if (pretty_printer == Py_None) - pretty_printer.release (); + pretty_printer.reset (nullptr); install_visualizer (var->dynamic, NULL, pretty_printer.release ()); } |