diff --git a/.clang-tidy b/.clang-tidy index eb5a2c37d..10ea5f0ea 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -29,10 +29,14 @@ Checks: '-*, misc-uniqueptr-reset-release, misc-unused-using-decls, modernize-avoid-bind, + modernize-use-default-member-init, modernize-deprecated-headers, modernize-loop-convert, modernize-pass-by-value, modernize-raw-string-literal, + modernize-redundant-void-arg, + modernize-return-braced-init-list, + modernize-shrink-to-fit, modernize-use-auto, modernize-use-bool-literals, modernize-use-emplace, @@ -61,6 +65,7 @@ Checks: '-*, readability-named-parameter, readability-non-const-parameter, readability-redundant-control-flow, + readability-redundant-member-init, readability-string-compare, readability-uppercase-literal-suffix' WarningsAsErrors: '' @@ -116,6 +121,10 @@ CheckOptions: value: '5' - key: modernize-use-auto.RemoveStars value: '0' + - key: modernize-use-default-member-init.IgnoreMacros + value: '1' + - key: modernize-use-default-member-init.UseAssignment + value: '0' - key: modernize-use-emplace.ContainersWithPushBack value: '::std::vector;::std::list;::std::deque' - key: modernize-use-emplace.SmartPointers diff --git a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc index 590774c1d..ae971b39f 100644 --- a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc +++ b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc @@ -38,7 +38,7 @@ #include -Hybrid_Ls_Pvt::Hybrid_Ls_Pvt(int nchannels, std::string dump_filename, bool flag_dump_to_file) : Ls_Pvt() +Hybrid_Ls_Pvt::Hybrid_Ls_Pvt(int nchannels, std::string dump_filename, bool flag_dump_to_file) { // init empty ephemeris for all the available GNSS channels d_nchannels = nchannels; diff --git a/src/algorithms/PVT/libs/ls_pvt.cc b/src/algorithms/PVT/libs/ls_pvt.cc index 5f6448eec..3b471738a 100644 --- a/src/algorithms/PVT/libs/ls_pvt.cc +++ b/src/algorithms/PVT/libs/ls_pvt.cc @@ -36,11 +36,6 @@ #include -Ls_Pvt::Ls_Pvt() : Pvt_Solution() -{ -} - - arma::vec Ls_Pvt::bancroftPos(const arma::mat& satpos, const arma::vec& obs) { // BANCROFT Calculation of preliminary coordinates for a GPS receiver based on pseudoranges diff --git a/src/algorithms/PVT/libs/ls_pvt.h b/src/algorithms/PVT/libs/ls_pvt.h index 1f96caedf..36fb7c8e0 100644 --- a/src/algorithms/PVT/libs/ls_pvt.h +++ b/src/algorithms/PVT/libs/ls_pvt.h @@ -42,7 +42,7 @@ class Ls_Pvt : public Pvt_Solution { public: - Ls_Pvt(); + Ls_Pvt() = default; /*! * \brief Computes the initial position solution based on the Bancroft algorithm diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index b15be13a7..a95dddb53 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -313,7 +313,7 @@ void pcps_acquisition_fpga::set_active(bool active) } -void pcps_acquisition_fpga::reset_acquisition(void) +void pcps_acquisition_fpga::reset_acquisition() { // this function triggers a HW reset of the FPGA PL. acquisition_fpga->open_device(); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h index c47ebce6a..1126a403e 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h @@ -199,7 +199,7 @@ public: /*! * \brief This function triggers a HW reset of the FPGA PL. */ - void reset_acquisition(void); + void reset_acquisition(); private: friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_); diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.cc b/src/algorithms/acquisition/libs/fpga_acquisition.cc index dd1a7fe1c..99a7c936f 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.cc +++ b/src/algorithms/acquisition/libs/fpga_acquisition.cc @@ -152,7 +152,7 @@ void Fpga_Acquisition::fpga_acquisition_test_register() } -void Fpga_Acquisition::run_acquisition(void) +void Fpga_Acquisition::run_acquisition() { // enable interrupts int32_t reenable = 1; @@ -263,7 +263,7 @@ void Fpga_Acquisition::close_device() } -void Fpga_Acquisition::reset_acquisition(void) +void Fpga_Acquisition::reset_acquisition() { //printf("============ resetting the hw now from the acquisition ==============="); d_map_base[8] = RESET_ACQUISITION; // writing a 2 to d_map_base[8] resets the acquisition. This causes a reset of all diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.h b/src/algorithms/acquisition/libs/fpga_acquisition.h index 33a5a6867..507a9ae77 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.h +++ b/src/algorithms/acquisition/libs/fpga_acquisition.h @@ -77,7 +77,7 @@ public: /*! * \brief Run the acquisition process in the FPGA */ - void run_acquisition(void); + void run_acquisition(); /*! * \brief Read the results of the acquisition process @@ -112,7 +112,7 @@ public: /*! * \brief Reset the FPGA PL. */ - void reset_acquisition(void); + void reset_acquisition(); /*! * \brief Read the scaling factor that has been used by the FFT-IFFT diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index d924d3d69..1b2dc6c27 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -1768,7 +1768,7 @@ double timediffweekcrossover(gtime_t t1, gtime_t t2) * args : none * return : current time in utc *-----------------------------------------------------------------------------*/ -gtime_t timeget(void) +gtime_t timeget() { gtime_t time; double ep[6] = {}; @@ -2143,7 +2143,7 @@ int adjgpsweek(int week) * args : none * return : current tick in ms *-----------------------------------------------------------------------------*/ -unsigned int tickget(void) +unsigned int tickget() { struct timespec tp = {0, 0}; struct timeval tv = {0, 0}; @@ -3835,7 +3835,7 @@ unsigned int tick_trace = 0; /* tick time at traceopen (ms) */ gtime_t time_trace = {0, 0.0}; /* time at traceopen */ pthread_mutex_t lock_trace; /* lock for trace */ -void traceswap(void) +void traceswap() { gtime_t time = utc2gpst(timeget()); char path[1024]; @@ -3893,7 +3893,7 @@ void traceopen(const char *file) } -void traceclose(void) +void traceclose() { if (fp_trace && fp_trace != stderr) { @@ -5125,6 +5125,7 @@ int rtk_uncompress(const char *file, char *uncfile) if (strlen(uncfile) < 1025) { std::strncpy(tmpfile, uncfile, 1024); + tmpfile[1023] = '\0'; } stat = 1; } diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.h b/src/algorithms/libs/rtklib/rtklib_rtkcmn.h index ea7a870dc..adf506d5a 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.h +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.h @@ -174,7 +174,7 @@ double time2bdt(gtime_t t, int *week); gtime_t timeadd(gtime_t t, double sec); double timediff(gtime_t t1, gtime_t t2); double timediffweekcrossover(gtime_t t1, gtime_t t2); -gtime_t timeget(void); +gtime_t timeget(); void timeset(gtime_t t); int read_leaps_text(FILE *fp); int read_leaps_usno(FILE *fp); @@ -189,7 +189,7 @@ void time2str(gtime_t t, char *s, int n); char *time_str(gtime_t t, int n); double time2doy(gtime_t t); int adjgpsweek(int week); -unsigned int tickget(void); +unsigned int tickget(); void sleepms(int ms); void deg2dms(double deg, double *dms, int ndec); void deg2dms(double deg, double *dms); @@ -232,9 +232,9 @@ void freeobs(obs_t *obs); void freenav(nav_t *nav, int opt); void traceopen(const char *file); -void traceclose(void); +void traceclose(); void tracelevel(int level); -void traceswap(void); +void traceswap(); void trace(int level, const char *format, ...); void tracet(int level, const char *format, ...); void tracemat(int level, const double *A, int n, int m, int p, int q); diff --git a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc index aef2ab19a..38c9ce9a6 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc @@ -181,7 +181,7 @@ int rtkopenstat(const char *file, int level) * args : none * return : none *-----------------------------------------------------------------------------*/ -void rtkclosestat(void) +void rtkclosestat() { trace(3, "rtkclosestat:\n"); @@ -341,7 +341,7 @@ void rtkoutstat(rtk_t *rtk, char *buff __attribute__((unused))) /* swap solution status file -------------------------------------------------*/ -void swapsolstat(void) +void swapsolstat() { gtime_t time = utc2gpst(timeget()); char path[1024]; diff --git a/src/algorithms/libs/rtklib/rtklib_rtkpos.h b/src/algorithms/libs/rtklib/rtklib_rtkpos.h index 3cac6b4d0..79d9fe375 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkpos.h +++ b/src/algorithms/libs/rtklib/rtklib_rtkpos.h @@ -84,11 +84,11 @@ const double TTOL_MOVEB = (1.0 + 2 * DTTOL); int rtkopenstat(const char *file, int level); -void rtkclosestat(void); +void rtkclosestat(); void rtkoutstat(rtk_t *rtk); -void swapsolstat(void); +void swapsolstat(); void outsolstat(rtk_t *rtk); diff --git a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc index 0c7a1d477..63ba80c56 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc @@ -992,6 +992,7 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs, if (strlen(rcvopts[i]) < 256) { std::strncpy(svr->raw[i].opt, rcvopts[i], 256); + svr->raw[i].opt[255] = '\0'; } if (strlen(rcvopts[i]) < 256) { diff --git a/src/algorithms/libs/rtklib/rtklib_stream.cc b/src/algorithms/libs/rtklib/rtklib_stream.cc index f114cdecc..986e4c7b5 100644 --- a/src/algorithms/libs/rtklib/rtklib_stream.cc +++ b/src/algorithms/libs/rtklib/rtklib_stream.cc @@ -813,7 +813,7 @@ void decodetcppath(const char *path, char *addr, char *port, char *user, /* get socket error ----------------------------------------------------------*/ -int errsock(void) { return errno; } +int errsock() { return errno; } /* set socket option ---------------------------------------------------------*/ @@ -2241,7 +2241,7 @@ int stateftp(ftp_t *ftp) * args : none * return : none *-----------------------------------------------------------------------------*/ -void strinitcom(void) +void strinitcom() { tracet(3, "strinitcom:\n"); } diff --git a/src/algorithms/libs/rtklib/rtklib_stream.h b/src/algorithms/libs/rtklib/rtklib_stream.h index cfbc2a4f5..3c4caad48 100644 --- a/src/algorithms/libs/rtklib/rtklib_stream.h +++ b/src/algorithms/libs/rtklib/rtklib_stream.h @@ -113,7 +113,7 @@ void syncfile(file_t *file1, file_t *file2); void decodetcppath(const char *path, char *addr, char *port, char *user, char *passwd, char *mntpnt, char *str); -int errsock(void); +int errsock(); int setsock(socket_t sock, char *msg); @@ -196,7 +196,7 @@ int readftp(ftp_t *ftp, unsigned char *buff, int n, char *msg); int stateftp(ftp_t *ftp); -void strinitcom(void); +void strinitcom(); void strinit(stream_t *stream); diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index af87e03f1..c00d4ef78 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -657,7 +657,7 @@ bool dll_pll_veml_tracking_fpga::cn0_and_tracking_lock_status(double coh_integra // - updated remnant code phase in samples (d_rem_code_phase_samples) // - d_code_freq_chips // - d_carrier_doppler_hz -void dll_pll_veml_tracking_fpga::do_correlation_step(void) +void dll_pll_veml_tracking_fpga::do_correlation_step() { // ################# CARRIER WIPEOFF AND CORRELATORS ############################## // perform carrier wipe-off and compute Early, Prompt and Late correlation @@ -1468,7 +1468,7 @@ void dll_pll_veml_tracking_fpga::stop_tracking() } -void dll_pll_veml_tracking_fpga::reset(void) +void dll_pll_veml_tracking_fpga::reset() { gr::thread::scoped_lock l(d_setlock); multicorrelator_fpga->unlock_channel(); diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.h b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.h index 76563715d..c33a48ed7 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.h +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.h @@ -101,7 +101,7 @@ public: /*! * \brief This function disables the HW multicorrelator in the FPGA in order to stop the tracking process */ - void reset(void); + void reset(); private: friend dll_pll_veml_tracking_fpga_sptr dll_pll_veml_make_tracking_fpga(const Dll_Pll_Conf_Fpga &conf_); @@ -110,7 +110,7 @@ private: bool cn0_and_tracking_lock_status(double coh_integration_time_s); bool acquire_secondary(); - void do_correlation_step(void); + void do_correlation_step(); void run_dll_pll(); void update_tracking_vars(); void clear_tracking_vars(); diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.cc b/src/algorithms/tracking/libs/fpga_multicorrelator.cc index e3a7639de..cb5ab95fd 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.cc +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.cc @@ -318,7 +318,7 @@ void Fpga_Multicorrelator_8sc::fpga_configure_tracking_gps_local_code(int32_t PR } -void Fpga_Multicorrelator_8sc::fpga_compute_code_shift_parameters(void) +void Fpga_Multicorrelator_8sc::fpga_compute_code_shift_parameters() { float frac_part; // decimal part int32_t dec_part; // fractional part @@ -362,7 +362,7 @@ void Fpga_Multicorrelator_8sc::fpga_compute_code_shift_parameters(void) } -void Fpga_Multicorrelator_8sc::fpga_configure_code_parameters_in_fpga(void) +void Fpga_Multicorrelator_8sc::fpga_configure_code_parameters_in_fpga() { for (uint32_t i = 0; i < d_n_correlators; i++) { @@ -377,7 +377,7 @@ void Fpga_Multicorrelator_8sc::fpga_configure_code_parameters_in_fpga(void) } -void Fpga_Multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga(void) +void Fpga_Multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga() { float d_rem_carrier_phase_in_rad_temp; @@ -403,7 +403,7 @@ void Fpga_Multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga(void) } -void Fpga_Multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga(void) +void Fpga_Multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga() { d_map_base[code_phase_step_chips_num_reg_addr] = d_code_phase_step_chips_num; // code phase step @@ -419,7 +419,7 @@ void Fpga_Multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga(void) } -void Fpga_Multicorrelator_8sc::fpga_launch_multicorrelator_fpga(void) +void Fpga_Multicorrelator_8sc::fpga_launch_multicorrelator_fpga() { // enable interrupts int32_t reenable = 1; @@ -433,7 +433,7 @@ void Fpga_Multicorrelator_8sc::fpga_launch_multicorrelator_fpga(void) } -void Fpga_Multicorrelator_8sc::read_tracking_gps_results(void) +void Fpga_Multicorrelator_8sc::read_tracking_gps_results() { int32_t readval_real; int32_t readval_imag; @@ -453,7 +453,7 @@ void Fpga_Multicorrelator_8sc::read_tracking_gps_results(void) } -void Fpga_Multicorrelator_8sc::unlock_channel(void) +void Fpga_Multicorrelator_8sc::unlock_channel() { // unlock the channel to let the next samples go through d_map_base[drop_samples_reg_addr] = drop_samples; // unlock the channel and disable secondary codes @@ -474,7 +474,7 @@ void Fpga_Multicorrelator_8sc::close_device() } -void Fpga_Multicorrelator_8sc::lock_channel(void) +void Fpga_Multicorrelator_8sc::lock_channel() { // lock the channel for processing d_map_base[drop_samples_reg_addr] = 0; // lock the channel diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.h b/src/algorithms/tracking/libs/fpga_multicorrelator.h index 8513dec25..8862b4b47 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.h +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.h @@ -110,12 +110,12 @@ public: /*! * \brief Start the tracking process in the FPGA */ - void lock_channel(void); + void lock_channel(); /*! * \brief finish the tracking process in the FPGA */ - void unlock_channel(void); + void unlock_channel(); /*! * \brief Set the secondary code length in the FPGA. This is only used when extended coherent integration @@ -248,12 +248,12 @@ private: // private functions uint32_t fpga_acquisition_test_register(uint32_t writeval); void fpga_configure_tracking_gps_local_code(int32_t PRN); - void fpga_compute_code_shift_parameters(void); - void fpga_configure_code_parameters_in_fpga(void); - void fpga_compute_signal_parameters_in_fpga(void); - void fpga_configure_signal_parameters_in_fpga(void); - void fpga_launch_multicorrelator_fpga(void); - void read_tracking_gps_results(void); + void fpga_compute_code_shift_parameters(); + void fpga_configure_code_parameters_in_fpga(); + void fpga_compute_signal_parameters_in_fpga(); + void fpga_configure_signal_parameters_in_fpga(); + void fpga_launch_multicorrelator_fpga(); + void read_tracking_gps_results(); void close_device(void); void write_secondary_code(uint32_t secondary_code_length, std::string *secondary_code_string, uint32_t reg_addr); }; diff --git a/src/algorithms/tracking/libs/tracking_loop_filter.cc b/src/algorithms/tracking/libs/tracking_loop_filter.cc index 553292308..85939db29 100644 --- a/src/algorithms/tracking/libs/tracking_loop_filter.cc +++ b/src/algorithms/tracking/libs/tracking_loop_filter.cc @@ -105,7 +105,7 @@ float Tracking_loop_filter::apply(float current_input) } -void Tracking_loop_filter::update_coefficients(void) +void Tracking_loop_filter::update_coefficients() { // Analog gains: float g1; @@ -219,7 +219,7 @@ void Tracking_loop_filter::set_noise_bandwidth(float noise_bandwidth) } -float Tracking_loop_filter::get_noise_bandwidth(void) const +float Tracking_loop_filter::get_noise_bandwidth() const { return d_noise_bandwidth; } @@ -232,7 +232,7 @@ void Tracking_loop_filter::set_update_interval(float update_interval) } -float Tracking_loop_filter::get_update_interval(void) const +float Tracking_loop_filter::get_update_interval() const { return d_update_interval; } @@ -245,7 +245,7 @@ void Tracking_loop_filter::set_include_last_integrator(bool include_last_integra } -bool Tracking_loop_filter::get_include_last_integrator(void) const +bool Tracking_loop_filter::get_include_last_integrator() const { return d_include_last_integrator; } @@ -266,7 +266,7 @@ void Tracking_loop_filter::set_order(int loop_order) } -int Tracking_loop_filter::get_order(void) const +int Tracking_loop_filter::get_order() const { return d_loop_order; } diff --git a/src/algorithms/tracking/libs/tracking_loop_filter.h b/src/algorithms/tracking/libs/tracking_loop_filter.h index 10dc855d9..300c491cb 100644 --- a/src/algorithms/tracking/libs/tracking_loop_filter.h +++ b/src/algorithms/tracking/libs/tracking_loop_filter.h @@ -54,10 +54,10 @@ public: Tracking_loop_filter(Tracking_loop_filter&&) = default; //!< Move operator Tracking_loop_filter& operator=(Tracking_loop_filter&& /*other*/) = default; //!< Move assignment operator - float get_noise_bandwidth(void) const; - float get_update_interval(void) const; - bool get_include_last_integrator(void) const; - int get_order(void) const; + float get_noise_bandwidth() const; + float get_update_interval() const; + bool get_include_last_integrator() const; + int get_order() const; void set_noise_bandwidth(float noise_bandwidth); void set_update_interval(float update_interval); @@ -94,7 +94,7 @@ private: float d_update_interval; // Compute the filter coefficients: - void update_coefficients(void); + void update_coefficients(); }; #endif diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc index 9bc82a7f6..120399cd8 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc @@ -176,7 +176,7 @@ private: public: int rx_message; - ~GpsL1CADllPllTrackingTestFpga_msg_rx(); //!< Default destructor + ~GpsL1CADllPllTrackingTestFpga_msg_rx() override; //!< Default destructor }; @@ -252,7 +252,7 @@ public: gnss_synchro = Gnss_Synchro(); } - ~GpsL1CADllPllTrackingTestFpga() = default; + ~GpsL1CADllPllTrackingTestFpga() override = default; void configure_receiver();