diff options
| author | Martin Braun <martin.braun@ettus.com> | 2021-01-08 09:33:36 +0100 | 
|---|---|---|
| committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-03-04 08:07:26 -0600 | 
| commit | 107a49c0c236940da7d3bd0f57da4bc1e2a34cb4 (patch) | |
| tree | fdeaad56030a02948377c45838dab97beb7a5c84 /host/lib/include/uhdlib/usrp | |
| parent | 7d5e48032baa62cbe7467833b9e057900602f4b9 (diff) | |
| download | uhd-107a49c0c236940da7d3bd0f57da4bc1e2a34cb4.tar.gz uhd-107a49c0c236940da7d3bd0f57da4bc1e2a34cb4.tar.bz2 uhd-107a49c0c236940da7d3bd0f57da4bc1e2a34cb4.zip | |
host: Update code base using clang-tidy
The checks from the new clang-tidy file are applied to the source tree
using:
$ find . -name "*.cpp" | sort -u | xargs \
    --max-procs 8 --max-args 1 clang-tidy --format-style=file \
    --fix -p /path/to/compile_commands.json
Diffstat (limited to 'host/lib/include/uhdlib/usrp')
10 files changed, 93 insertions, 85 deletions
| diff --git a/host/lib/include/uhdlib/usrp/common/adf435x.hpp b/host/lib/include/uhdlib/usrp/common/adf435x.hpp index de93bfd69..8c47c94fd 100644 --- a/host/lib/include/uhdlib/usrp/common/adf435x.hpp +++ b/host/lib/include/uhdlib/usrp/common/adf435x.hpp @@ -139,19 +139,19 @@ public:      {      } -    virtual ~adf435x_impl(){}; +    ~adf435x_impl() override{}; -    void set_reference_freq(double fref) +    void set_reference_freq(double fref) override      {          _reference_freq = fref;      } -    void set_feedback_select(feedback_sel_t fb_sel) +    void set_feedback_select(feedback_sel_t fb_sel) override      {          _fb_after_divider = (fb_sel == FB_SEL_DIVIDED);      } -    void set_prescaler(prescaler_t prescaler) +    void set_prescaler(prescaler_t prescaler) override      {          if (prescaler == PRESCALER_8_9) {              _regs.prescaler = adf435x_regs_t::PRESCALER_8_9; @@ -162,7 +162,7 @@ public:          }      } -    void set_output_power(output_t output, output_power_t power) +    void set_output_power(output_t output, output_power_t power) override      {          switch (output) {              case RF_OUTPUT_A: @@ -206,7 +206,7 @@ public:          }      } -    void set_output_enable(output_t output, bool enable) +    void set_output_enable(output_t output, bool enable) override      {          switch (output) {              case RF_OUTPUT_A: @@ -222,7 +222,7 @@ public:          }      } -    void set_muxout_mode(muxout_t mode) +    void set_muxout_mode(muxout_t mode) override      {          switch (mode) {              case MUXOUT_3STATE: @@ -251,7 +251,7 @@ public:          }      } -    void set_tuning_mode(tuning_mode_t mode) +    void set_tuning_mode(tuning_mode_t mode) override      {          // New mode applies to subsequent tunes i.e. do not re-tune now          _tuning_mode = mode; @@ -262,7 +262,7 @@ public:          _regs.phase_12_bit = (_tuning_mode == TUNING_MODE_HIGH_RESOLUTION) ? 0 : 1;      } -    void set_charge_pump_current(charge_pump_current_t cp_current) +    void set_charge_pump_current(charge_pump_current_t cp_current) override      {          switch (cp_current) {              case CHARGE_PUMP_CURRENT_0_31MA: @@ -318,7 +318,7 @@ public:          }      } -    double set_charge_pump_current(const double current, const bool flush) +    double set_charge_pump_current(const double current, const bool flush) override      {          const auto cp_range = get_charge_pump_current_range(); @@ -344,19 +344,19 @@ public:          return coerced_current;      } -    uhd::meta_range_t get_charge_pump_current_range() +    uhd::meta_range_t get_charge_pump_current_range() override      {          return uhd::meta_range_t(.3125e-6, 5e-6, .3125e-6);      } -    uhd::range_t get_int_range() +    uhd::range_t get_int_range() override      {          if (_N_min < 0)              throw uhd::runtime_error("set_prescaler must be called before get_int_range");          return uhd::range_t(_N_min, 4095);      } -    double set_frequency(double target_freq, bool int_n_mode, bool flush = false) +    double set_frequency(double target_freq, bool int_n_mode, bool flush = false) override      {          static const double REF_DOUBLER_THRESH_FREQ = 12.5e6;          static const double PFD_FREQ_MAX            = 25.0e6; @@ -531,7 +531,7 @@ public:          return actual_freq;      } -    void commit() +    void commit() override      {          // reset counters          _regs.counter_reset = adf435x_regs_t::COUNTER_RESET_ENABLED; diff --git a/host/lib/include/uhdlib/usrp/common/max287x.hpp b/host/lib/include/uhdlib/usrp/common/max287x.hpp index 5e23649ef..8aa7e947e 100644 --- a/host/lib/include/uhdlib/usrp/common/max287x.hpp +++ b/host/lib/include/uhdlib/usrp/common/max287x.hpp @@ -224,24 +224,26 @@ class max287x : public max287x_iface  {  public:      max287x(write_fn func); -    virtual ~max287x(); -    virtual void power_up(void); -    virtual void shutdown(void); -    virtual bool is_shutdown(void); -    virtual double set_frequency( -        double target_freq, double ref_freq, double target_pfd_freq, bool is_int_n); -    virtual void set_output_power(output_power_t power); -    virtual void set_ld_pin_mode(ld_pin_mode_t mode); -    virtual void set_muxout_mode(muxout_mode_t mode); -    virtual void set_charge_pump_current(charge_pump_current_t cp_current); -    virtual void set_auto_retune(bool enabled); -    virtual void set_clock_divider_mode(clock_divider_mode_t mode); -    virtual void set_cycle_slip_mode(bool enabled); -    virtual void set_low_noise_and_spur(low_noise_and_spur_t mode); -    virtual void set_phase(uint16_t phase); -    virtual void commit(); -    virtual bool can_sync(); -    virtual void config_for_sync(bool enable); +    ~max287x() override; +    void power_up(void) override; +    void shutdown(void) override; +    bool is_shutdown(void) override; +    double set_frequency(double target_freq, +        double ref_freq, +        double target_pfd_freq, +        bool is_int_n) override; +    void set_output_power(output_power_t power) override; +    void set_ld_pin_mode(ld_pin_mode_t mode) override; +    void set_muxout_mode(muxout_mode_t mode) override; +    void set_charge_pump_current(charge_pump_current_t cp_current) override; +    void set_auto_retune(bool enabled) override; +    void set_clock_divider_mode(clock_divider_mode_t mode) override; +    void set_cycle_slip_mode(bool enabled) override; +    void set_low_noise_and_spur(low_noise_and_spur_t mode) override; +    void set_phase(uint16_t phase) override; +    void commit() override; +    bool can_sync() override; +    void config_for_sync(bool enable) override;  protected:      max287x_regs_t _regs; @@ -261,9 +263,11 @@ class max2870 : public max287x<max2870_regs_t>  {  public:      max2870(write_fn func) : max287x<max2870_regs_t>(func) {} -    ~max2870() {} -    double set_frequency( -        double target_freq, double ref_freq, double target_pfd_freq, bool is_int_n) +    ~max2870() override {} +    double set_frequency(double target_freq, +        double ref_freq, +        double target_pfd_freq, +        bool is_int_n) override      {          _regs.cpoc = is_int_n ? max2870_regs_t::CPOC_ENABLED                                : max2870_regs_t::CPOC_DISABLED; @@ -274,7 +278,7 @@ public:          return max287x<max2870_regs_t>::set_frequency(              target_freq, ref_freq, target_pfd_freq, is_int_n);      } -    void commit(void) +    void commit(void) override      {          // For MAX2870, we always need to write all registers.          _write_all_regs = true; @@ -354,8 +358,8 @@ class max2871 : public max287x<max2871_regs_t>  {  public:      max2871(write_fn func) : max287x<max2871_regs_t>(func) {} -    ~max2871(){}; -    void set_muxout_mode(muxout_mode_t mode) +    ~max2871() override{}; +    void set_muxout_mode(muxout_mode_t mode) override      {          switch (mode) {              case MUXOUT_SYNC: @@ -369,8 +373,10 @@ public:          }      } -    double set_frequency( -        double target_freq, double ref_freq, double target_pfd_freq, bool is_int_n) +    double set_frequency(double target_freq, +        double ref_freq, +        double target_pfd_freq, +        bool is_int_n) override      {          _regs.feedback_select = max2871_regs_t::FEEDBACK_SELECT_DIVIDED;          double freq           = max287x<max2871_regs_t>::set_frequency( @@ -414,7 +420,7 @@ public:          return freq;      } -    void commit() +    void commit() override      {          max287x<max2871_regs_t>::commit(); @@ -883,7 +889,7 @@ void max287x<max287x_regs_t>::commit()          try {              changed_regs = _regs.template get_changed_addrs<uint32_t>();              // register 0 must be written to apply double buffered fields -            if (changed_regs.size() > 0) { +            if (!changed_regs.empty()) {                  changed_regs.insert(0);              } diff --git a/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp b/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp index acdd361e4..98e7f2ac4 100644 --- a/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp +++ b/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp @@ -55,11 +55,11 @@ public:              // nop          } -        uint64_t get_ticks_now(); -        uint64_t get_ticks_last_pps(); -        void set_ticks_now(const uint64_t ticks); -        void set_ticks_next_pps(const uint64_t ticks); -        void set_period(const uint64_t period_ns); +        uint64_t get_ticks_now() override; +        uint64_t get_ticks_last_pps() override; +        void set_ticks_now(const uint64_t ticks) override; +        void set_ticks_next_pps(const uint64_t ticks) override; +        void set_period(const uint64_t period_ns) override;          /*! Update the tick rate           *  Note: This is separate from set_tick_rate because the latter is @@ -75,26 +75,28 @@ public:      /**************************************************************************       * Motherboard Control API (see mb_controller.hpp)       *************************************************************************/ -    std::string get_mboard_name() const; -    void set_time_source(const std::string& source); -    std::string get_time_source() const; -    std::vector<std::string> get_time_sources() const; -    void set_clock_source(const std::string& source); -    std::string get_clock_source() const; -    std::vector<std::string> get_clock_sources() const; -    void set_sync_source(const std::string& clock_source, const std::string& time_source); -    void set_sync_source(const uhd::device_addr_t& sync_source); -    uhd::device_addr_t get_sync_source() const; -    std::vector<uhd::device_addr_t> get_sync_sources(); -    void set_clock_source_out(const bool enb); -    void set_time_source_out(const bool enb); -    uhd::sensor_value_t get_sensor(const std::string& name); -    std::vector<std::string> get_sensor_names(); -    uhd::usrp::mboard_eeprom_t get_eeprom(); -    std::vector<std::string> get_gpio_banks() const; -    std::vector<std::string> get_gpio_srcs(const std::string& bank) const; -    std::vector<std::string> get_gpio_src(const std::string& bank); -    void set_gpio_src(const std::string& bank, const std::vector<std::string>& src); +    std::string get_mboard_name() const override; +    void set_time_source(const std::string& source) override; +    std::string get_time_source() const override; +    std::vector<std::string> get_time_sources() const override; +    void set_clock_source(const std::string& source) override; +    std::string get_clock_source() const override; +    std::vector<std::string> get_clock_sources() const override; +    void set_sync_source( +        const std::string& clock_source, const std::string& time_source) override; +    void set_sync_source(const uhd::device_addr_t& sync_source) override; +    uhd::device_addr_t get_sync_source() const override; +    std::vector<uhd::device_addr_t> get_sync_sources() override; +    void set_clock_source_out(const bool enb) override; +    void set_time_source_out(const bool enb) override; +    uhd::sensor_value_t get_sensor(const std::string& name) override; +    std::vector<std::string> get_sensor_names() override; +    uhd::usrp::mboard_eeprom_t get_eeprom() override; +    std::vector<std::string> get_gpio_banks() const override; +    std::vector<std::string> get_gpio_srcs(const std::string& bank) const override; +    std::vector<std::string> get_gpio_src(const std::string& bank) override; +    void set_gpio_src( +        const std::string& bank, const std::vector<std::string>& src) override;  private:      /************************************************************************** diff --git a/host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp b/host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp index 9cbede8e4..0e1041642 100644 --- a/host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp +++ b/host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp @@ -117,32 +117,32 @@ struct recv_packet_demuxer_proxy_3000 : transport::zero_copy_if          _demux->realloc_sid(_sid); // causes clear      } -    ~recv_packet_demuxer_proxy_3000(void) +    ~recv_packet_demuxer_proxy_3000(void) override      {          _demux->realloc_sid(_sid); // causes clear      } -    size_t get_num_recv_frames(void) const +    size_t get_num_recv_frames(void) const override      {          return _xport->get_num_recv_frames();      } -    size_t get_recv_frame_size(void) const +    size_t get_recv_frame_size(void) const override      {          return _xport->get_recv_frame_size();      } -    transport::managed_recv_buffer::sptr get_recv_buff(double timeout) +    transport::managed_recv_buffer::sptr get_recv_buff(double timeout) override      {          return _demux->get_recv_buff(_sid, timeout);      } -    size_t get_num_send_frames(void) const +    size_t get_num_send_frames(void) const override      {          return _xport->get_num_send_frames();      } -    size_t get_send_frame_size(void) const +    size_t get_send_frame_size(void) const override      {          return _xport->get_send_frame_size();      } -    transport::managed_send_buffer::sptr get_send_buff(double timeout) +    transport::managed_send_buffer::sptr get_send_buff(double timeout) override      {          return _xport->get_send_buff(timeout);      } diff --git a/host/lib/include/uhdlib/usrp/constrained_device_args.hpp b/host/lib/include/uhdlib/usrp/constrained_device_args.hpp index 7588462c4..bdd492752 100644 --- a/host/lib/include/uhdlib/usrp/constrained_device_args.hpp +++ b/host/lib/include/uhdlib/usrp/constrained_device_args.hpp @@ -79,7 +79,7 @@ public: // Types          {              set(str_rep);          } -        inline virtual std::string to_string() const +        inline std::string to_string() const override          {              return key() + "=" + get();          } @@ -125,7 +125,7 @@ public: // Types                          % ex.what()));              }          } -        inline virtual std::string to_string() const +        inline std::string to_string() const override          {              return key() + "=" + std::to_string(get());          } @@ -179,7 +179,7 @@ public: // Types              set(_str_values.at(str_rep_lowercase));          } -        inline virtual std::string to_string() const +        inline std::string to_string() const override          {              std::string repr;              for (const auto& value : _str_values) { @@ -232,7 +232,7 @@ public: // Types                          % key() % ex.what()));              }          } -        inline virtual std::string to_string() const +        inline std::string to_string() const override          {              return key() + "=" + (get() ? "true" : "false");          } diff --git a/host/lib/include/uhdlib/usrp/cores/i2c_core_100_wb32.hpp b/host/lib/include/uhdlib/usrp/cores/i2c_core_100_wb32.hpp index e38f73127..08c77e282 100644 --- a/host/lib/include/uhdlib/usrp/cores/i2c_core_100_wb32.hpp +++ b/host/lib/include/uhdlib/usrp/cores/i2c_core_100_wb32.hpp @@ -18,7 +18,7 @@ class i2c_core_100_wb32 : uhd::noncopyable, public uhd::i2c_iface  public:      typedef std::shared_ptr<i2c_core_100_wb32> sptr; -    virtual ~i2c_core_100_wb32(void) = 0; +    ~i2c_core_100_wb32(void) override = 0;      //! makes a new i2c core from iface and slave base      static sptr make(uhd::wb_iface::sptr iface, const size_t base); diff --git a/host/lib/include/uhdlib/usrp/cores/i2c_core_200.hpp b/host/lib/include/uhdlib/usrp/cores/i2c_core_200.hpp index 4b7353812..980b8997f 100644 --- a/host/lib/include/uhdlib/usrp/cores/i2c_core_200.hpp +++ b/host/lib/include/uhdlib/usrp/cores/i2c_core_200.hpp @@ -19,7 +19,7 @@ class i2c_core_200 : uhd::noncopyable, public uhd::i2c_iface  public:      typedef std::shared_ptr<i2c_core_200> sptr; -    virtual ~i2c_core_200(void) = 0; +    ~i2c_core_200(void) override = 0;      //! makes a new i2c core from iface and slave base      static sptr make(uhd::wb_iface::sptr iface, const size_t base, const size_t readback); diff --git a/host/lib/include/uhdlib/usrp/cores/radio_ctrl_core_3000.hpp b/host/lib/include/uhdlib/usrp/cores/radio_ctrl_core_3000.hpp index 0b5ba6a6f..c24ee4524 100644 --- a/host/lib/include/uhdlib/usrp/cores/radio_ctrl_core_3000.hpp +++ b/host/lib/include/uhdlib/usrp/cores/radio_ctrl_core_3000.hpp @@ -23,7 +23,7 @@ class radio_ctrl_core_3000 : public uhd::timed_wb_iface  public:      typedef std::shared_ptr<radio_ctrl_core_3000> sptr; -    virtual ~radio_ctrl_core_3000(void) = 0; +    ~radio_ctrl_core_3000(void) override = 0;      //! Make a new control object      static sptr make(const bool big_endian, @@ -39,10 +39,10 @@ public:      virtual void push_response(const uint32_t* buff) = 0;      //! Set the command time that will activate -    virtual void set_time(const uhd::time_spec_t& time) = 0; +    void set_time(const uhd::time_spec_t& time) override = 0;      //! Get the command time that will activate -    virtual uhd::time_spec_t get_time(void) = 0; +    uhd::time_spec_t get_time(void) override = 0;      //! Set the tick rate (converting time into ticks)      virtual void set_tick_rate(const double rate) = 0; diff --git a/host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp b/host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp index d08147407..a821ae602 100644 --- a/host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp +++ b/host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp @@ -21,7 +21,7 @@ public:      using poke32_fn_t = std::function<void(uint32_t, uint32_t)>;      using peek32_fn_t = std::function<uint32_t(uint32_t)>; -    virtual ~spi_core_3000(void) = 0; +    ~spi_core_3000(void) override = 0;      //! makes a new spi core from iface and slave base      static sptr make(uhd::wb_iface::sptr iface, const size_t base, const size_t readback); diff --git a/host/lib/include/uhdlib/usrp/cores/user_settings_core_3000.hpp b/host/lib/include/uhdlib/usrp/cores/user_settings_core_3000.hpp index 3f461ddb7..6e17e0b97 100644 --- a/host/lib/include/uhdlib/usrp/cores/user_settings_core_3000.hpp +++ b/host/lib/include/uhdlib/usrp/cores/user_settings_core_3000.hpp @@ -15,7 +15,7 @@  class user_settings_core_3000 : public uhd::wb_iface  {  public: -    virtual ~user_settings_core_3000() {} +    ~user_settings_core_3000() override {}      static sptr make(wb_iface::sptr iface,          const wb_addr_type sr_base_addr, | 
