]> sourceware.org Git - libabigail.git/commit
dwarf-reader: get_die_source: always initialize return value
authorMatthias Maennich <maennich@google.com>
Thu, 11 Jun 2020 13:22:49 +0000 (15:22 +0200)
committerDodji Seketeli <dodji@redhat.com>
Mon, 15 Jun 2020 08:00:54 +0000 (10:00 +0200)
commit659e9442664e89fc805f0b182f648233b7675af1
tree2a37dcd7f96da145154fd192c7148a44d0f19389
parent4ef7e8c97604c0146520782576cea3f475e89121
dwarf-reader: get_die_source: always initialize return value

GCC9 with ABIGAIL_DEVEL=1 and ABIGAIL_DEBUG=1 set, regularly emits
-Werror=maybe-uninitialized for the values gathered by get_die_source.
As a counter measure, some of them were initialized before the call to
NO_DEBUG_INFO_DIE_SOURCE, but not all of them, leading to said warning.
In order to overcome this, let get_die_source always initialize the
source to NO_DEBUG_INFO_DIE_SOURCE and adjust the caller to consistently
not do that anymore. This solves the warning and maybe but unlikely (due
to the ABG_ASSERT) avoids some UB.

Changing the interface of get_die_source to return the source directly,
lead to the ability to initialize the value const and to defer the
assertion to the function itself. Some occurrences could be removed
entirely as the die_source was not used at all.

* src/abg-dwarf-reader.cc
(read_context::get_die_source): Always initialize die_source.
(read_context::ContainerType::get_container): Fix
initialization of die_source.
(read_context::compute_canonical_die): Likewise.
(read_context::get_canonical_die): Likewise.
(read_context::get_or_compute_canonical_die): Likewise.
(read_context::associate_die_to_decl): Likewise.
(read_context::set_canonical_die_offset): Likewise.
(read_context::schedule_type_for_late_canonicalization): Likewise.
(read_context::compare_dies): Likewise.
(read_context::get_parent_die): Likewise.
(read_context::get_scope_for_die): Likewise.
(read_context::add_or_update_union_type): Likewise.
(read_context::maybe_canonicalize_type): Likewise.
(read_context::build_ir_node_from_die): Likewise.

Signed-off-by: Matthias Maennich <maennich@google.com>
src/abg-dwarf-reader.cc
This page took 0.033919 seconds and 5 git commands to generate.