From a12fc913a078c6c2cf16787e64f4f24d448ff2f6 Mon Sep 17 00:00:00 2001
From: Andrej Rode <andrej.rode@ettus.com>
Date: Mon, 19 Dec 2016 16:28:16 -0800
Subject: lib: add default ctors to structs and initialize members properly

---
 host/lib/rfnoc/nocscript/function_table.cpp        |  2 +-
 host/lib/rfnoc/xports.hpp                          |  1 +
 host/lib/usrp/common/ad9361_driver/ad9361_device.h | 18 +++++++++++++++---
 host/lib/usrp/e300/e300_global_regs.hpp            |  1 +
 host/lib/usrp/e300/e300_i2c.hpp                    |  1 +
 host/lib/usrp/e300/e300_impl.hpp                   |  3 ++-
 6 files changed, 21 insertions(+), 5 deletions(-)

(limited to 'host/lib')

diff --git a/host/lib/rfnoc/nocscript/function_table.cpp b/host/lib/rfnoc/nocscript/function_table.cpp
index bebceb8dc..a4e36c1a1 100644
--- a/host/lib/rfnoc/nocscript/function_table.cpp
+++ b/host/lib/rfnoc/nocscript/function_table.cpp
@@ -31,7 +31,7 @@ class function_table_impl : public function_table
         expression::type_t return_type;
         function_ptr function;
 
-        function_info() {};
+        function_info(): return_type(expression::TYPE_INT)  {};
         function_info(const expression::type_t return_type_, const function_ptr &function_)
             : return_type(return_type_), function(function_)
         {};
diff --git a/host/lib/rfnoc/xports.hpp b/host/lib/rfnoc/xports.hpp
index 7872f2e1b..98cf71b6d 100644
--- a/host/lib/rfnoc/xports.hpp
+++ b/host/lib/rfnoc/xports.hpp
@@ -24,6 +24,7 @@ namespace uhd {
      */
     struct both_xports_t
     {
+        both_xports_t(): recv_buff_size(0), send_buff_size(0) {}
         uhd::transport::zero_copy_if::sptr recv;
         uhd::transport::zero_copy_if::sptr send;
         size_t recv_buff_size;
diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.h b/host/lib/usrp/common/ad9361_driver/ad9361_device.h
index ae065d78e..f3d24d6b9 100644
--- a/host/lib/usrp/common/ad9361_driver/ad9361_device.h
+++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.h
@@ -40,7 +40,15 @@ public:
     enum chain_t { CHAIN_1, CHAIN_2, CHAIN_BOTH };
 
     ad9361_device_t(ad9361_params::sptr client, ad9361_io::sptr io_iface) :
-        _client_params(client), _io_iface(io_iface) {
+        _client_params(client), _io_iface(io_iface),
+        _bbpll_freq(0.0), _adcclock_freq(0.0), _req_clock_rate(0.0),
+        _req_coreclk(0.0), _rx_bbf_tunediv(0), _curr_gain_table(0),
+        _rx1_gain(0.0), _rx2_gain(0.0), _tx1_gain(0.0), _tx2_gain(0.0),
+        _tfir_factor(0), _rfir_factor(0),
+        _rx1_agc_mode(GAIN_MODE_MANUAL), _rx2_agc_mode(GAIN_MODE_MANUAL),
+        _rx1_agc_enable(false), _rx2_agc_enable(false),
+        _use_dc_offset_tracking(false), _use_iq_balance_tracking(false)
+    {
 
         /*
          * This Boost.Assign to_container() workaround is necessary because STL containers
@@ -213,7 +221,11 @@ private:    //Methods
     void _set_filter_lp_tia_sec(direction_t direction, filter_info_base::sptr filter);
 
 private:    //Members
-    typedef struct {
+    struct chip_regs_t
+    {
+        chip_regs_t():
+            vcodivs(0), inputsel(0), rxfilt(0), txfilt(0),
+            bbpll(0), bbftune_config(0), bbftune_mode(0) {}
         uint8_t vcodivs;
         uint8_t inputsel;
         uint8_t rxfilt;
@@ -221,7 +233,7 @@ private:    //Members
         uint8_t bbpll;
         uint8_t bbftune_config;
         uint8_t bbftune_mode;
-    } chip_regs_t;
+    };
 
     struct filter_query_helper
     {
diff --git a/host/lib/usrp/e300/e300_global_regs.hpp b/host/lib/usrp/e300/e300_global_regs.hpp
index 3b6b26239..c56cff298 100644
--- a/host/lib/usrp/e300/e300_global_regs.hpp
+++ b/host/lib/usrp/e300/e300_global_regs.hpp
@@ -24,6 +24,7 @@
 namespace uhd { namespace usrp { namespace e300 {
 
 struct global_regs_transaction_t {
+    global_regs_transaction_t(): is_poke(0), addr(0), data(0), pad(0) {}
     uint32_t is_poke;
     uint32_t addr;
     uint32_t data;
diff --git a/host/lib/usrp/e300/e300_i2c.hpp b/host/lib/usrp/e300/e300_i2c.hpp
index 98a1f80aa..1c5e06bba 100644
--- a/host/lib/usrp/e300/e300_i2c.hpp
+++ b/host/lib/usrp/e300/e300_i2c.hpp
@@ -27,6 +27,7 @@
 namespace uhd { namespace usrp { namespace e300 {
 
 struct i2c_transaction_t {
+    i2c_transaction_t(): reg(0), addr(0), data(0), type(0) {};
     uint16_t reg;
     uint8_t  addr;
     uint8_t  data;
diff --git a/host/lib/usrp/e300/e300_impl.hpp b/host/lib/usrp/e300/e300_impl.hpp
index 632424438..50d78fdd4 100644
--- a/host/lib/usrp/e300/e300_impl.hpp
+++ b/host/lib/usrp/e300/e300_impl.hpp
@@ -189,7 +189,8 @@ private: // types
     {
         gpio_t() : pps_sel(global_regs::PPS_INT),
             mimo(0), codec_arst(0), tx_bandsels(0),
-            rx_bandsel_a(0), rx_bandsel_b(0), rx_bandsel_c(0)
+            rx_bandsel_a(0), rx_bandsel_b(0), rx_bandsel_c(0),
+            time_sync(0)
         {}
 
         uint32_t pps_sel;
-- 
cgit v1.2.3