From 1ec8e8a94e0755275c51c2ffbdc1adee2c4ef204 Mon Sep 17 00:00:00 2001 From: faluco Date: Fri, 17 Dec 2021 14:07:43 +0100 Subject: [PATCH] Raise C++ version to 14 and fix ill-formed code that is considered by this new standard. --- CMakeLists.txt | 2 +- lib/include/srsran/asn1/asn1_utils.h | 6 ++++-- srsenb/src/phy/lte/cc_worker.cc | 2 +- srsenb/src/stack/rrc/rrc_mobility.cc | 3 +-- srsue/src/ue.cc | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 076f41b65..018b3e9e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -370,7 +370,7 @@ macro(ADD_C_COMPILER_FLAG_IF_AVAILABLE flag have) endmacro(ADD_C_COMPILER_FLAG_IF_AVAILABLE) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-comment -Wno-reorder -Wno-unused-variable -Wtype-limits -std=c++11 -fno-strict-aliasing") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-comment -Wno-reorder -Wno-unused-variable -Wtype-limits -std=c++14 -fno-strict-aliasing") ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-Wno-unused-but-set-variable" HAVE_WNO_UNUSED_BUT_SET_VARIABLE) diff --git a/lib/include/srsran/asn1/asn1_utils.h b/lib/include/srsran/asn1/asn1_utils.h index 0c287aab2..d78d20e17 100644 --- a/lib/include/srsran/asn1/asn1_utils.h +++ b/lib/include/srsran/asn1/asn1_utils.h @@ -286,7 +286,8 @@ public: using iterator = T*; using const_iterator = const T*; - explicit bounded_array(uint32_t size_ = 0) : data_(), current_size(size_) {} + bounded_array() : data_(), current_size(0) {} + explicit bounded_array(uint32_t size_) : data_(), current_size(size_) {} static uint32_t capacity() { return MAX_N; } uint32_t size() const { return current_size; } T& operator[](uint32_t idx) { return data_[idx]; } @@ -858,7 +859,8 @@ public: static const uint32_t lb = LB, ub = UB; static const bool has_ext = ext, is_aligned = aligned; - explicit bitstring(uint32_t siz_ = lb) { resize(siz_); } + bitstring() { resize(lb); } + explicit bitstring(uint32_t siz_) { resize(siz_); } explicit bitstring(const std::string& s) { resize(s.size()); diff --git a/srsenb/src/phy/lte/cc_worker.cc b/srsenb/src/phy/lte/cc_worker.cc index 5a7478b7c..46ce668a3 100644 --- a/srsenb/src/phy/lte/cc_worker.cc +++ b/srsenb/src/phy/lte/cc_worker.cc @@ -634,7 +634,7 @@ void cc_worker::ue::metrics_read(phy_metrics_t* metrics_) if (metrics_) { *metrics_ = metrics; } - bzero(&metrics, sizeof(phy_metrics_t)); + metrics = {}; } void cc_worker::ue::metrics_dl(uint32_t mcs) diff --git a/srsenb/src/stack/rrc/rrc_mobility.cc b/srsenb/src/stack/rrc/rrc_mobility.cc index 805935f1a..7c85668a5 100644 --- a/srsenb/src/stack/rrc/rrc_mobility.cc +++ b/srsenb/src/stack/rrc/rrc_mobility.cc @@ -316,8 +316,7 @@ bool rrc::ue::rrc_mobility::start_ho_preparation(uint32_t target_eci, capitem.ue_category = 4; capitem.pdcp_params.max_num_rohc_context_sessions_present = true; capitem.pdcp_params.max_num_rohc_context_sessions = asn1::rrc::pdcp_params_s::max_num_rohc_context_sessions_e_::cs2; - bzero(&capitem.pdcp_params.supported_rohc_profiles, - sizeof(asn1::rrc::rohc_profile_support_list_r15_s)); // TODO: why is it r15? + capitem.pdcp_params.supported_rohc_profiles = {}; capitem.phy_layer_params.ue_specific_ref_sigs_supported = false; capitem.phy_layer_params.ue_tx_ant_sel_supported = false; capitem.rf_params.supported_band_list_eutra.resize(1); diff --git a/srsue/src/ue.cc b/srsue/src/ue.cc index 04440c7b9..3b3dcb62f 100644 --- a/srsue/src/ue.cc +++ b/srsue/src/ue.cc @@ -331,7 +331,7 @@ void ue::start_plot() bool ue::get_metrics(ue_metrics_t* m) { - bzero(m, sizeof(ue_metrics_t)); + *m = {}; phy->get_metrics(srsran::srsran_rat_t::lte, &m->phy); phy->get_metrics(srsran::srsran_rat_t::nr, &m->phy_nr); radio->get_metrics(&m->rf);