Skip to content

Commit

Permalink
Resolve uninitialised values. (#1616)
Browse files Browse the repository at this point in the history
- Fixes a set of undefined value warnings.
- merge identical `case`s
  • Loading branch information
thorstenhater authored Aug 27, 2021
1 parent 37dd7de commit 417e4e8
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
6 changes: 3 additions & 3 deletions arbor/backends/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ struct target_handle {
};

struct deliverable_event {
time_type time;
float weight;
time_type time = 0;
float weight = 0;
target_handle handle;

deliverable_event() {}
deliverable_event() = default;
deliverable_event(time_type time, target_handle handle, float weight):
time(time), weight(weight), handle(handle) {}
};
Expand Down
2 changes: 1 addition & 1 deletion arbor/fvm_lowered_cell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct fvm_probe_scalar {

struct fvm_probe_interpolated {
probe_handle raw_handles[2] = {nullptr, nullptr};
double coef[2];
double coef[2] = {};
mlocation metadata;

util::any_ptr get_metadata_ptr() const { return &metadata; }
Expand Down
2 changes: 1 addition & 1 deletion arbor/fvm_lowered_cell_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class fvm_lowered_cell_impl: public fvm_lowered_cell {
value_type check_voltage_mV_ = 0;

// Flag indicating that at least one of the mechanisms implements the post_events procedure
bool post_events_;
bool post_events_ = false;

// Host-side views/copies and local state.
decltype(backend::host_view(sample_time_)) sample_time_host_;
Expand Down
6 changes: 3 additions & 3 deletions arbor/include/arbor/common_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ struct cell_member_type {
// Pair of indexes that describe range of local indices.

struct lid_range {
cell_lid_type begin;
cell_lid_type end;
lid_range() {};
cell_lid_type begin = 0;
cell_lid_type end = 0;
lid_range() = default;
lid_range(cell_lid_type b, cell_lid_type e):
begin(b), end(e) {}
};
Expand Down
4 changes: 2 additions & 2 deletions arbor/include/arbor/fvm_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ struct fvm_gap_junction {
using index_type = fvm_index_type;

std::pair<index_type, index_type> loc;
value_type weight;
value_type weight = 0;

fvm_gap_junction() {}
fvm_gap_junction() = default;
fvm_gap_junction(std::pair<index_type, index_type> l, value_type w): loc(l), weight(w) {}
};

Expand Down
2 changes: 1 addition & 1 deletion arbor/include/arbor/profile/meter_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class meter_manager {
private:
bool started_ = false;

tick_type start_time_;
tick_type start_time_ = 0;
std::vector<double> times_;

std::vector<std::unique_ptr<meter>> meters_;
Expand Down
4 changes: 0 additions & 4 deletions arbor/include/arbor/simd/simd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,6 @@ namespace detail {
using IndexImpl = typename Index::simd_base;
switch (pi.constraint) {
case index_constraint::none:
value_ = Impl::gather(tag<IndexImpl>{}, pi.p, pi.index.value_);
break;
case index_constraint::independent:
value_ = Impl::gather(tag<IndexImpl>{}, pi.p, pi.index.value_);
break;
Expand All @@ -507,8 +505,6 @@ namespace detail {
using IndexImpl = typename Index::simd_base;
switch (pi.constraint) {
case index_constraint::none:
value_ = Impl::gather(tag<IndexImpl>{}, pi.p, pi.index.value_);
break;
case index_constraint::independent:
value_ = Impl::gather(tag<IndexImpl>{}, pi.p, pi.index.value_);
break;
Expand Down

0 comments on commit 417e4e8

Please sign in to comment.