diff --git a/CMakeLists.txt b/CMakeLists.txt index d495d54a9..df9cf4f32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,7 +226,7 @@ macro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have) endmacro(ADD_CXX_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} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -Wformat -Wtype-limits -std=c++03") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -Wformat -Wmissing-field-initializers -Wtype-limits -std=c++03") find_package(SSE) if (HAVE_AVX2) @@ -243,7 +243,7 @@ endif(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clan ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-Werror=incompatible-pointer-types" HAVE_ERROR_INCOMPATIBLE) if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-write-strings -Winline -Wno-unused-result -Wformat -Wtype-limits -std=c99 -D_GNU_SOURCE") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-write-strings -Winline -Wno-unused-result -Wformat -Wmissing-field-initializers -Wtype-limits -std=c99 -D_GNU_SOURCE") if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -O0 -DDEBUG_MODE -DBUILD_TYPE_DEBUG") diff --git a/lib/include/srslte/common/common.h b/lib/include/srslte/common/common.h index b7130f6d5..5668454e0 100644 --- a/lib/include/srslte/common/common.h +++ b/lib/include/srslte/common/common.h @@ -72,6 +72,8 @@ #define pool_allocate (pool->allocate()) #endif +#define ZERO_OBJECT(x) memset(&(x), 0x0, sizeof((x))) + #include "srslte/srslte.h" /******************************************************************************* diff --git a/lib/src/phy/ch_estimation/test/chest_test_dl.c b/lib/src/phy/ch_estimation/test/chest_test_dl.c index 222263c7e..65cc8ced5 100644 --- a/lib/src/phy/ch_estimation/test/chest_test_dl.c +++ b/lib/src/phy/ch_estimation/test/chest_test_dl.c @@ -37,7 +37,9 @@ srslte_cell_t cell = { 6, // nof_prb 1, // nof_ports 1000, // cell_id - SRSLTE_CP_NORM // cyclic prefix + SRSLTE_CP_NORM, // cyclic prefix + SRSLTE_PHICH_NORM, + SRSLTE_PHICH_R_1_6 }; char *output_matlab = NULL; diff --git a/lib/src/phy/ch_estimation/test/chest_test_ul.c b/lib/src/phy/ch_estimation/test/chest_test_ul.c index 7b9fbacc9..f0dc2064d 100644 --- a/lib/src/phy/ch_estimation/test/chest_test_ul.c +++ b/lib/src/phy/ch_estimation/test/chest_test_ul.c @@ -37,7 +37,8 @@ srslte_cell_t cell = { 1, // nof_ports 0, 1000, // cell_id - SRSLTE_CP_NORM // cyclic prefix + SRSLTE_CP_NORM, // cyclic prefix + SRSLTE_PHICH_NORM }; char *output_matlab = NULL; diff --git a/lib/src/phy/ch_estimation/test/refsignal_ul_test.c b/lib/src/phy/ch_estimation/test/refsignal_ul_test.c index c1323bf0d..5ca18cdda 100644 --- a/lib/src/phy/ch_estimation/test/refsignal_ul_test.c +++ b/lib/src/phy/ch_estimation/test/refsignal_ul_test.c @@ -36,7 +36,9 @@ srslte_cell_t cell = { 100, // nof_prb SRSLTE_MAX_PORTS, // nof_ports 1, // cell_id - SRSLTE_CP_NORM // cyclic prefix + SRSLTE_CP_NORM, // cyclic prefix + SRSLTE_PHICH_NORM, + SRSLTE_PHICH_R_1_6 }; void usage(char *prog) { diff --git a/srsenb/src/phy/phch_worker.cc b/srsenb/src/phy/phch_worker.cc index 8b6a731e2..9982841f0 100644 --- a/srsenb/src/phy/phch_worker.cc +++ b/srsenb/src/phy/phch_worker.cc @@ -242,13 +242,17 @@ void phch_worker::set_config_dedicated(uint16_t rnti, pthread_mutex_lock(&mutex); if (ue_db.count(rnti)) { /* PUSCH UCI and scheduling configuration */ - srslte_uci_cfg_t uci_cfg = {0}; + srslte_uci_cfg_t uci_cfg; + ZERO_OBJECT(uci_cfg); + if (dedicated->pusch_cnfg_ded_present && dedicated->sched_request_cnfg_present) { uci_cfg.I_offset_ack = dedicated->pusch_cnfg_ded.beta_offset_ack_idx; uci_cfg.I_offset_cqi = dedicated->pusch_cnfg_ded.beta_offset_cqi_idx; uci_cfg.I_offset_ri = dedicated->pusch_cnfg_ded.beta_offset_ri_idx; - srslte_pucch_sched_t pucch_sched = {false}; + srslte_pucch_sched_t pucch_sched; + ZERO_OBJECT(pucch_sched); + pucch_sched.N_pucch_1 = phy->pucch_cfg.n1_pucch_an; pucch_sched.n_pucch_2 = dedicated->cqi_report_cnfg.report_periodic.pucch_resource_idx; pucch_sched.n_pucch_sr = dedicated->sched_request_cnfg.sr_pucch_resource_idx; @@ -452,7 +456,9 @@ unlock: int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch) { - srslte_uci_data_t uci_data = {0}; + srslte_uci_data_t uci_data; + ZERO_OBJECT(uci_data); + uint32_t wideband_cqi_value = 0, wideband_pmi = 0; bool wideband_pmi_present = false; @@ -478,7 +484,9 @@ int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch) } // Configure PUSCH CQI channel - srslte_cqi_value_t cqi_value = {0}; + srslte_cqi_value_t cqi_value; + ZERO_OBJECT(cqi_value); + bool cqi_enabled = false; if (ue_db[rnti].cqi_en && ue_db[rnti].ri_en && srslte_ri_send(ue_db[rnti].pmi_idx, ue_db[rnti].ri_idx, tti_rx) ) { @@ -688,7 +696,9 @@ int phch_worker::decode_pucch() uci_data.uci_ack_len++; } } - srslte_cqi_value_t cqi_value = {0}; + srslte_cqi_value_t cqi_value; + ZERO_OBJECT(cqi_value); + LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT *dedicated = &ue_db[rnti].dedicated; LIBLTE_RRC_TRANSMISSION_MODE_ENUM tx_mode = dedicated->antenna_info_explicit_value.tx_mode; diff --git a/srsue/src/phy/phch_recv.cc b/srsue/src/phy/phch_recv.cc index bb4997c7f..b563ef40f 100644 --- a/srsue/src/phy/phch_recv.cc +++ b/srsue/src/phy/phch_recv.cc @@ -1216,7 +1216,7 @@ phch_recv::measure::ret_code phch_recv::measure::run_multiple_subframes(cf_t *in sf_start = found_best?best_test_sf_start:sf_start; #endif - if (sf_start >= 0 && sf_start < (sf_len*max_sf)) { + if (sf_start >= 0 && sf_start < (int) (sf_len*max_sf)) { uint32_t nof_sf = (sf_len*max_sf - sf_start)/sf_len; diff --git a/srsue/src/phy/phch_worker.cc b/srsue/src/phy/phch_worker.cc index d34aa90e8..16152a428 100644 --- a/srsue/src/phy/phch_worker.cc +++ b/srsue/src/phy/phch_worker.cc @@ -924,7 +924,9 @@ void phch_worker::set_uci_periodic_cqi() compute_ri(NULL, NULL, NULL); phy->last_pmi = (uint8_t) ue_dl.pmi[phy->last_ri % SRSLTE_MAX_LAYERS]; - srslte_cqi_value_t cqi_report = {0}; + srslte_cqi_value_t cqi_report; + ZERO_OBJECT(cqi_report); + if (period_cqi.format_is_subband) { // TODO: Implement subband periodic reports cqi_report.type = SRSLTE_CQI_TYPE_SUBBAND; @@ -975,7 +977,9 @@ void phch_worker::set_uci_aperiodic_cqi() reported RI. For other transmission modes they are reported conditioned on rank 1. */ if (rnti_is_set) { - srslte_cqi_value_t cqi_report = {0}; + srslte_cqi_value_t cqi_report; + ZERO_OBJECT(cqi_report); + cqi_report.type = SRSLTE_CQI_TYPE_SUBBAND_HL; cqi_report.subband_hl.wideband_cqi_cw0 = srslte_cqi_from_snr(phy->avg_snr_db_cqi); @@ -1020,7 +1024,9 @@ void phch_worker::set_uci_aperiodic_cqi() */ if (rnti_is_set) { /* Fill CQI Report */ - srslte_cqi_value_t cqi_report = {0}; + srslte_cqi_value_t cqi_report; + ZERO_OBJECT(cqi_report); + cqi_report.type = SRSLTE_CQI_TYPE_SUBBAND_HL; cqi_report.subband_hl.wideband_cqi_cw0 = srslte_cqi_from_snr(sinr_db); diff --git a/srsue/src/upper/nas.cc b/srsue/src/upper/nas.cc index 0488f4b45..067e6bfab 100644 --- a/srsue/src/upper/nas.cc +++ b/srsue/src/upper/nas.cc @@ -549,10 +549,14 @@ void nas::parse_attach_accept(uint32_t lcid, byte_buffer_t *pdu) { return; } - LIBLTE_MME_ATTACH_ACCEPT_MSG_STRUCT attach_accept = {0}; - LIBLTE_MME_ATTACH_COMPLETE_MSG_STRUCT attach_complete = {0}; - LIBLTE_MME_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT act_def_eps_bearer_context_req = {0}; - LIBLTE_MME_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_MSG_STRUCT act_def_eps_bearer_context_accept = {0}; + LIBLTE_MME_ATTACH_ACCEPT_MSG_STRUCT attach_accept; + ZERO_OBJECT(attach_accept); + LIBLTE_MME_ATTACH_COMPLETE_MSG_STRUCT attach_complete; + ZERO_OBJECT(attach_complete); + LIBLTE_MME_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT act_def_eps_bearer_context_req; + ZERO_OBJECT(act_def_eps_bearer_context_req); + LIBLTE_MME_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_MSG_STRUCT act_def_eps_bearer_context_accept; + ZERO_OBJECT(act_def_eps_bearer_context_accept); nas_log->info("Received Attach Accept\n"); @@ -677,7 +681,8 @@ void nas::parse_attach_accept(uint32_t lcid, byte_buffer_t *pdu) { } void nas::parse_attach_reject(uint32_t lcid, byte_buffer_t *pdu) { - LIBLTE_MME_ATTACH_REJECT_MSG_STRUCT attach_rej = {0}; + LIBLTE_MME_ATTACH_REJECT_MSG_STRUCT attach_rej; + ZERO_OBJECT(attach_rej); liblte_mme_unpack_attach_reject_msg((LIBLTE_BYTE_MSG_STRUCT *) pdu, &attach_rej); nas_log->warning("Received Attach Reject. Cause= %02X\n", attach_rej.emm_cause); @@ -746,8 +751,10 @@ void nas::parse_authentication_reject(uint32_t lcid, byte_buffer_t *pdu) { } void nas::parse_identity_request(uint32_t lcid, byte_buffer_t *pdu) { - LIBLTE_MME_ID_REQUEST_MSG_STRUCT id_req = {0}; - LIBLTE_MME_ID_RESPONSE_MSG_STRUCT id_resp = {0}; + LIBLTE_MME_ID_REQUEST_MSG_STRUCT id_req; + ZERO_OBJECT(id_req); + LIBLTE_MME_ID_RESPONSE_MSG_STRUCT id_resp; + ZERO_OBJECT(id_resp); liblte_mme_unpack_identity_request_msg((LIBLTE_BYTE_MSG_STRUCT *) pdu, &id_req); nas_log->info("Received Identity Request. ID type: %d\n", id_req.id_type); @@ -1037,7 +1044,8 @@ void nas::gen_service_request(byte_buffer_t *msg) { } void nas::gen_pdn_connectivity_request(LIBLTE_BYTE_MSG_STRUCT *msg) { - LIBLTE_MME_PDN_CONNECTIVITY_REQUEST_MSG_STRUCT pdn_con_req = {0}; + LIBLTE_MME_PDN_CONNECTIVITY_REQUEST_MSG_STRUCT pdn_con_req; + ZERO_OBJECT(pdn_con_req); nas_log->info("Generating PDN Connectivity Request\n"); diff --git a/srsue/src/upper/rrc.cc b/srsue/src/upper/rrc.cc index 0f5975705..4e09ba3f9 100644 --- a/srsue/src/upper/rrc.cc +++ b/srsue/src/upper/rrc.cc @@ -1582,7 +1582,9 @@ void rrc::write_pdu_bcch_dlsch(byte_buffer_t *pdu) { rrc_log->info_hex(pdu->msg, pdu->N_bytes, "BCCH DLSCH message received."); rrc_log->info("BCCH DLSCH message Stack latency: %ld us\n", pdu->get_latency_us()); - LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT dlsch_msg = {0}; + LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT dlsch_msg; + ZERO_OBJECT(dlsch_msg); + srslte_bit_unpack_vector(pdu->msg, bit_buf.msg, pdu->N_bytes * 8); bit_buf.N_bits = pdu->N_bytes * 8; pool->deallocate(pdu); @@ -1697,7 +1699,8 @@ void rrc::process_pcch(byte_buffer_t *pdu) { rrc_log->info("PCCH message Stack latency: %ld us\n", pdu->get_latency_us()); rrc_log->console("PCCH message received %d bytes\n", pdu->N_bytes); - LIBLTE_RRC_PCCH_MSG_STRUCT pcch_msg = {0}; + LIBLTE_RRC_PCCH_MSG_STRUCT pcch_msg; + ZERO_OBJECT(pcch_msg); srslte_bit_unpack_vector(pdu->msg, bit_buf.msg, pdu->N_bytes * 8); bit_buf.N_bits = pdu->N_bytes * 8; pool->deallocate(pdu);