1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

Remove all warnings raised by bugprone-* clang-tidy checks in acquisition adapters

This commit is contained in:
Carles Fernandez 2020-07-10 13:35:15 +02:00
parent 5ad319e133
commit 33cee4a759
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
27 changed files with 36 additions and 36 deletions

View File

@ -57,7 +57,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max; acq_parameters_.doppler_max = FLAGS_doppler_max;
} }
doppler_max_ = acq_parameters_.doppler_max; doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step; doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
fs_in_ = acq_parameters_.fs_in; fs_in_ = acq_parameters_.fs_in;
item_type_ = acq_parameters_.item_type; item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size; item_size_ = acq_parameters_.it_size;

View File

@ -55,7 +55,7 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max; acq_parameters_.doppler_max = FLAGS_doppler_max;
} }
doppler_max_ = acq_parameters_.doppler_max; doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step; doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type; item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size; item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in; fs_in_ = acq_parameters_.fs_in;

View File

@ -239,7 +239,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::reset()
float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa) float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa)
{ {
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{ {
frequency_bins++; frequency_bins++;
} }

View File

@ -55,7 +55,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max; acq_parameters_.doppler_max = FLAGS_doppler_max;
} }
doppler_max_ = acq_parameters_.doppler_max; doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step; doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type; item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size; item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in; fs_in_ = acq_parameters_.fs_in;

View File

@ -74,7 +74,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
acq_parameters.code_length = code_length; acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two. // The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0)); float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits); uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0); uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0);

View File

@ -219,7 +219,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_state(int state)
float GalileoE1PcpsCccwsrAmbiguousAcquisition::calculate_threshold(float pfa) float GalileoE1PcpsCccwsrAmbiguousAcquisition::calculate_threshold(float pfa)
{ {
if (pfa) if (pfa > 0.0)
{ /* Not implemented*/ { /* Not implemented*/
}; };
return 0.0; return 0.0;

View File

@ -283,7 +283,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_state(int state)
float GalileoE1PcpsQuickSyncAmbiguousAcquisition::calculate_threshold(float pfa) float GalileoE1PcpsQuickSyncAmbiguousAcquisition::calculate_threshold(float pfa)
{ {
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{ {
frequency_bins++; frequency_bins++;
} }

View File

@ -249,7 +249,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_state(int state)
float GalileoE1PcpsTongAmbiguousAcquisition::calculate_threshold(float pfa) float GalileoE1PcpsTongAmbiguousAcquisition::calculate_threshold(float pfa)
{ {
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{ {
frequency_bins++; frequency_bins++;
} }

View File

@ -86,7 +86,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false); bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
// -- Find number of samples per spreading code (1ms)------------------------- // -- Find number of samples per spreading code (1ms)-------------------------
code_length_ = static_cast<unsigned int>(round(static_cast<double>(fs_in_) / GALILEO_E5A_CODE_CHIP_RATE_CPS * static_cast<double>(GALILEO_E5A_CODE_LENGTH_CHIPS))); code_length_ = static_cast<int>(round(static_cast<double>(fs_in_) / GALILEO_E5A_CODE_CHIP_RATE_CPS * static_cast<double>(GALILEO_E5A_CODE_LENGTH_CHIPS)));
vector_length_ = code_length_ * sampled_ms_; vector_length_ = code_length_ * sampled_ms_;
@ -198,7 +198,7 @@ signed int GalileoE5aNoncoherentIQAcquisitionCaf::mag()
{ {
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
return acquisition_cc_->mag(); return static_cast<signed int>(acquisition_cc_->mag());
} }
return 0; return 0;
} }
@ -276,7 +276,7 @@ float GalileoE5aNoncoherentIQAcquisitionCaf::calculate_threshold(float pfa)
{ {
// Calculate the threshold // Calculate the threshold
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{ {
frequency_bins++; frequency_bins++;
} }

View File

@ -160,8 +160,8 @@ private:
float threshold_; float threshold_;
int Zero_padding; int Zero_padding;
int CAF_window_hz_; int CAF_window_hz_;
int code_length_;
unsigned int vector_length_; unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_; unsigned int channel_;
unsigned int doppler_max_; unsigned int doppler_max_;
unsigned int doppler_step_; unsigned int doppler_step_;

View File

@ -53,7 +53,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max; acq_parameters_.doppler_max = FLAGS_doppler_max;
} }
doppler_max_ = acq_parameters_.doppler_max; doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step; doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type; item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size; item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in; fs_in_ = acq_parameters_.fs_in;

View File

@ -76,7 +76,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(
acq_parameters.code_length = code_length; acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two. // The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0)); float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits); uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1); uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1);
acq_parameters.select_queue_Fpga = select_queue_Fpga; acq_parameters.select_queue_Fpga = select_queue_Fpga;

View File

@ -55,7 +55,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max; acq_parameters_.doppler_max = FLAGS_doppler_max;
} }
doppler_max_ = acq_parameters_.doppler_max; doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step; doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type; item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size; item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in; fs_in_ = acq_parameters_.fs_in;

View File

@ -54,7 +54,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max; acq_parameters_.doppler_max = FLAGS_doppler_max;
} }
doppler_max_ = acq_parameters_.doppler_max; doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step; doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type; item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size; item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in; fs_in_ = acq_parameters_.fs_in;

View File

@ -58,7 +58,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
} }
doppler_max_ = acq_parameters_.doppler_max; doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step; doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type; item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size; item_size_ = acq_parameters_.it_size;

View File

@ -68,7 +68,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
// -- Find number of samples per spreading code ------------------------- // -- Find number of samples per spreading code -------------------------
vector_length_ = static_cast<unsigned int>(round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); vector_length_ = static_cast<unsigned int>(round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)));
acq_parameters.samples_per_ms = vector_length_; acq_parameters.samples_per_ms = static_cast<float>(vector_length_);
code_ = std::vector<std::complex<float>>(vector_length_); code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
@ -114,7 +114,7 @@ void GpsL1CaPcpsAcquisitionFineDoppler::set_threshold(float threshold)
void GpsL1CaPcpsAcquisitionFineDoppler::set_doppler_max(unsigned int doppler_max) void GpsL1CaPcpsAcquisitionFineDoppler::set_doppler_max(unsigned int doppler_max)
{ {
doppler_max_ = doppler_max; doppler_max_ = static_cast<int>(doppler_max);
acquisition_cc_->set_doppler_max(doppler_max_); acquisition_cc_->set_doppler_max(doppler_max_);
} }
@ -135,7 +135,7 @@ void GpsL1CaPcpsAcquisitionFineDoppler::set_gnss_synchro(Gnss_Synchro* gnss_sync
signed int GpsL1CaPcpsAcquisitionFineDoppler::mag() signed int GpsL1CaPcpsAcquisitionFineDoppler::mag()
{ {
return acquisition_cc_->mag(); return static_cast<signed int>(acquisition_cc_->mag());
} }

View File

@ -68,7 +68,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)));
acq_parameters.code_length = code_length; acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two. // The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0)); float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits); uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0); uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0);
acq_parameters.select_queue_Fpga = select_queue_Fpga; acq_parameters.select_queue_Fpga = select_queue_Fpga;

View File

@ -106,7 +106,7 @@ void GpsL1CaPcpsAssistedAcquisition::set_threshold(float threshold)
void GpsL1CaPcpsAssistedAcquisition::set_doppler_max(unsigned int doppler_max) void GpsL1CaPcpsAssistedAcquisition::set_doppler_max(unsigned int doppler_max)
{ {
doppler_max_ = doppler_max; doppler_max_ = static_cast<int>(doppler_max);
acquisition_cc_->set_doppler_max(doppler_max_); acquisition_cc_->set_doppler_max(doppler_max_);
} }

View File

@ -231,7 +231,7 @@ float GpsL1CaPcpsOpenClAcquisition::calculate_threshold(float pfa)
{ {
// Calculate the threshold // Calculate the threshold
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{ {
frequency_bins++; frequency_bins++;
} }

View File

@ -266,7 +266,7 @@ float GpsL1CaPcpsQuickSyncAcquisition::calculate_threshold(float pfa)
{ {
// Calculate the threshold // Calculate the threshold
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{ {
frequency_bins++; frequency_bins++;
} }

View File

@ -228,7 +228,7 @@ float GpsL1CaPcpsTongAcquisition::calculate_threshold(float pfa)
{ {
// Calculate the threshold // Calculate the threshold
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{ {
frequency_bins++; frequency_bins++;
} }

View File

@ -55,7 +55,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max; acq_parameters_.doppler_max = FLAGS_doppler_max;
} }
doppler_max_ = acq_parameters_.doppler_max; doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step; doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type; item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size; item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in; fs_in_ = acq_parameters_.fs_in;

View File

@ -55,7 +55,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
} }
doppler_max_ = acq_parameters_.doppler_max; doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step; doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type; item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size; item_size_ = acq_parameters_.it_size;

View File

@ -72,7 +72,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (GPS_L5I_CODE_RATE_CPS / static_cast<double>(GPS_L5I_CODE_LENGTH_CHIPS)))); auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (GPS_L5I_CODE_RATE_CPS / static_cast<double>(GPS_L5I_CODE_LENGTH_CHIPS))));
acq_parameters.code_length = code_length; acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two. // The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0)); float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits); uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1); uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1);
acq_parameters.select_queue_Fpga = select_queue_Fpga; acq_parameters.select_queue_Fpga = select_queue_Fpga;

View File

@ -241,19 +241,19 @@ private:
int d_state; int d_state;
int d_samples_per_ms; int d_samples_per_ms;
unsigned int d_sampled_ms;
int d_samples_per_code; int d_samples_per_code;
int d_CAF_window_hz; int d_CAF_window_hz;
unsigned int d_channel;
int d_buffer_count; int d_buffer_count;
unsigned int d_gr_stream_buffer;
int d_doppler_resolution; int d_doppler_resolution;
int d_doppler_max; int d_doppler_max;
int d_doppler_step; int d_doppler_step;
unsigned int d_max_dwells;
unsigned int d_well_count;
int d_fft_size; int d_fft_size;
int d_num_doppler_bins; int d_num_doppler_bins;
unsigned int d_gr_stream_buffer;
unsigned int d_channel;
unsigned int d_max_dwells;
unsigned int d_well_count;
unsigned int d_sampled_ms;
unsigned int d_code_phase; unsigned int d_code_phase;
bool d_bit_transition_flag; bool d_bit_transition_flag;

View File

@ -179,12 +179,12 @@ void Fpga_Acquisition::set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_s
// The doppler step can never be outside the range -pi to +pi, otherwise there would be aliasing // The doppler step can never be outside the range -pi to +pi, otherwise there would be aliasing
// The FPGA expects phase_step_rad between -1 (-pi) to +1 (+pi) // The FPGA expects phase_step_rad between -1 (-pi) to +1 (+pi)
phase_step_rad_real = 2.0 * (doppler_min) / static_cast<float>(d_fs_in); phase_step_rad_real = 2.0F * (doppler_min) / static_cast<float>(d_fs_in);
phase_step_rad_int = static_cast<int32_t>(phase_step_rad_real * (POW_2_31)); phase_step_rad_int = static_cast<int32_t>(phase_step_rad_real * (POW_2_31));
d_map_base[3] = phase_step_rad_int; d_map_base[3] = phase_step_rad_int;
// repeat the calculation with the doppler step // repeat the calculation with the doppler step
phase_step_rad_real = 2.0 * (doppler_step) / static_cast<float>(d_fs_in); phase_step_rad_real = 2.0F * (doppler_step) / static_cast<float>(d_fs_in);
phase_step_rad_int = static_cast<int32_t>(phase_step_rad_real * (POW_2_31)); // * 2^29 (in total it makes x2^31 in two steps to avoid the warnings phase_step_rad_int = static_cast<int32_t>(phase_step_rad_real * (POW_2_31)); // * 2^29 (in total it makes x2^31 in two steps to avoid the warnings
d_map_base[4] = phase_step_rad_int; d_map_base[4] = phase_step_rad_int;

View File

@ -1466,7 +1466,7 @@ void GNSSFlowgraph::perform_hw_reset()
// a stop acquisition command causes the SW to reset the HW // a stop acquisition command causes the SW to reset the HW
std::shared_ptr<Channel> channel_ptr; std::shared_ptr<Channel> channel_ptr;
for (uint32_t i = 0; i < channels_count_; i++) for (int i = 0; i < channels_count_; i++)
{ {
channel_ptr = std::dynamic_pointer_cast<Channel>(channels_.at(i)); channel_ptr = std::dynamic_pointer_cast<Channel>(channels_.at(i));
channel_ptr->tracking()->stop_tracking(); channel_ptr->tracking()->stop_tracking();