From a734411b8698b1bfd46fa93f5219ed1303bc9ea3 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 21 Feb 2019 12:46:01 +0100 Subject: [PATCH] clang-tidy: apply performance-type-promotion-in-math-fn check --- .../galileo_e1_tcp_connector_tracking_cc.cc | 4 ++-- .../gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc | 2 +- .../gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc | 2 +- .../gps_l1_ca_tcp_connector_tracking_cc.cc | 8 ++++---- src/algorithms/tracking/libs/tracking_discriminators.cc | 4 ++-- src/utils/rinex2assist/CMakeLists.txt | 9 --------- 6 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index 641dcf248..36fae9906 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -321,8 +321,8 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri float acq_trk_shif_correction_samples; int32_t acq_to_trk_delay_samples; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; - acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast(acq_to_trk_delay_samples), static_cast(d_current_prn_length_samples)); - samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); + acq_trk_shif_correction_samples = d_current_prn_length_samples - std::fmod(static_cast(acq_to_trk_delay_samples), static_cast(d_current_prn_length_samples)); + samples_offset = std::round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast(samples_offset); current_synchro_data.fs = d_fs_in; *out[0] = current_synchro_data; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index 68d94e82f..e00604c90 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -574,7 +574,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut double acq_trk_shif_correction_samples; int32_t acq_to_trk_delay_samples; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; - acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast(acq_to_trk_delay_samples), static_cast(d_current_prn_length_samples)); + acq_trk_shif_correction_samples = d_current_prn_length_samples - std::fmod(static_cast(acq_to_trk_delay_samples), static_cast(d_current_prn_length_samples)); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast(samples_offset); d_sample_counter = d_sample_counter + static_cast(samples_offset); // count for the processed samples diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index 8156ea09b..b161483c5 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -574,7 +574,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut double acq_trk_shif_correction_samples; int32_t acq_to_trk_delay_samples; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; - acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast(acq_to_trk_delay_samples), static_cast(d_current_prn_length_samples)); + acq_trk_shif_correction_samples = d_current_prn_length_samples - std::fmod(static_cast(acq_to_trk_delay_samples), static_cast(d_current_prn_length_samples)); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast(samples_offset); d_sample_counter = d_sample_counter + static_cast(samples_offset); // count for the processed samples diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index 2912e8e2c..51c8d20fc 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -204,7 +204,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking() T_prn_mod_seconds = T_chip_mod_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; T_prn_mod_samples = T_prn_mod_seconds * static_cast(d_fs_in); - d_next_prn_length_samples = round(T_prn_mod_samples); + d_next_prn_length_samples = std::round(T_prn_mod_samples); float T_prn_true_seconds = GPS_L1_CA_CODE_LENGTH_CHIPS / GPS_L1_CA_CODE_RATE_HZ; float T_prn_true_samples = T_prn_true_seconds * static_cast(d_fs_in); @@ -213,7 +213,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking() float N_prn_diff; N_prn_diff = acq_trk_diff_seconds / T_prn_true_seconds; float corrected_acq_phase_samples, delay_correction_samples; - corrected_acq_phase_samples = fmod((d_acq_code_phase_samples + T_prn_diff_seconds * N_prn_diff * static_cast(d_fs_in)), T_prn_true_samples); + corrected_acq_phase_samples = std::fmod((d_acq_code_phase_samples + T_prn_diff_seconds * N_prn_diff * static_cast(d_fs_in)), T_prn_true_samples); if (corrected_acq_phase_samples < 0) { corrected_acq_phase_samples = T_prn_mod_samples + corrected_acq_phase_samples; @@ -357,8 +357,8 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib float acq_trk_shif_correction_samples; int32_t acq_to_trk_delay_samples; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; - acq_trk_shif_correction_samples = d_next_prn_length_samples - fmod(static_cast(acq_to_trk_delay_samples), static_cast(d_next_prn_length_samples)); - samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); + acq_trk_shif_correction_samples = d_next_prn_length_samples - std::fmod(static_cast(acq_to_trk_delay_samples), static_cast(d_next_prn_length_samples)); + samples_offset = std::round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast(samples_offset); current_synchro_data.fs = d_fs_in; *out[0] = current_synchro_data; diff --git a/src/algorithms/tracking/libs/tracking_discriminators.cc b/src/algorithms/tracking/libs/tracking_discriminators.cc index c7ba2858f..f1944ddc5 100644 --- a/src/algorithms/tracking/libs/tracking_discriminators.cc +++ b/src/algorithms/tracking/libs/tracking_discriminators.cc @@ -64,7 +64,7 @@ double fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2, double */ double pll_four_quadrant_atan(gr_complex prompt_s1) { - return atan2(prompt_s1.imag(), prompt_s1.real()); + return static_cast(std::atan2(prompt_s1.imag(), prompt_s1.real())); } @@ -79,7 +79,7 @@ double pll_cloop_two_quadrant_atan(gr_complex prompt_s1) { if (prompt_s1.real() != 0.0) { - return atan(prompt_s1.imag() / prompt_s1.real()); + return static_cast(std::atan(prompt_s1.imag() / prompt_s1.real())); } return 0.0; } diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index 9f2c6b911..d42b379b5 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -86,15 +86,6 @@ if(Boost_FOUND) add_dependencies(rinex2assist gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}) endif() - if(ENABLE_CLANG_TIDY) - if(CLANG_TIDY_EXE) - set_target_properties(rinex2assist - PROPERTIES - CXX_CLANG_TIDY "${DO_CLANG_TIDY}" - ) - endif() - endif() - add_custom_command(TARGET rinex2assist POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_SOURCE_DIR}/install/$