aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/transport
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2015-03-27 09:35:29 -0700
committerNicholas Corgan <nick.corgan@ettus.com>2015-03-27 09:35:29 -0700
commit1200721b696751edaceb70a332861f84fb8c16d5 (patch)
tree15a56b1a54b5b059779d00115a9f58af991035ac /host/lib/transport
parenta712b026a806cd1c106d62fd9278536fcc0a8b62 (diff)
downloaduhd-1200721b696751edaceb70a332861f84fb8c16d5.tar.gz
uhd-1200721b696751edaceb70a332861f84fb8c16d5.tar.bz2
uhd-1200721b696751edaceb70a332861f84fb8c16d5.zip
Warning fixes
* CMake now not applying C++ flags to C files * GCC 4.4: anti-aliasing rules * MSVC: narrowing, differences in subclass function parameters * Clang: uninitialized variables
Diffstat (limited to 'host/lib/transport')
-rw-r--r--host/lib/transport/libusb1_zero_copy.cpp2
-rw-r--r--host/lib/transport/nirio/nirio_driver_iface_unsupported.cpp34
-rw-r--r--host/lib/transport/nirio/nirio_resource_manager.cpp11
-rw-r--r--host/lib/transport/nirio/niriok_proxy.cpp10
-rw-r--r--host/lib/transport/nirio/niriok_proxy_impl_v1.cpp11
-rw-r--r--host/lib/transport/nirio/niriok_proxy_impl_v2.cpp10
-rw-r--r--host/lib/transport/nirio_zero_copy.cpp16
7 files changed, 51 insertions, 43 deletions
diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp
index 4ea2032e3..1ac02d16f 100644
--- a/host/lib/transport/libusb1_zero_copy.cpp
+++ b/host/lib/transport/libusb1_zero_copy.cpp
@@ -192,7 +192,7 @@ public:
result.usb_transfer_complete.timed_wait(lock, timeout_time, lut_result_completed(result));
}
}
- return result.completed;
+ return (result.completed > 0);
}
private:
diff --git a/host/lib/transport/nirio/nirio_driver_iface_unsupported.cpp b/host/lib/transport/nirio/nirio_driver_iface_unsupported.cpp
index 1a1142525..ba0febe20 100644
--- a/host/lib/transport/nirio/nirio_driver_iface_unsupported.cpp
+++ b/host/lib/transport/nirio/nirio_driver_iface_unsupported.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2013 Ettus Research LLC
+// Copyright 2013,2015 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -19,43 +19,43 @@
namespace nirio_driver_iface {
nirio_status rio_open(
- const std::string& device_path,
- rio_dev_handle_t& device_handle)
+ UHD_UNUSED(const std::string& device_path),
+ UHD_UNUSED(rio_dev_handle_t& device_handle))
{
return NiRio_Status_FeatureNotSupported;
}
-void rio_close(rio_dev_handle_t& device_handle)
+void rio_close(UHD_UNUSED(rio_dev_handle_t& device_handle))
{
}
-bool rio_isopen(rio_dev_handle_t device_handle)
+bool rio_isopen(UHD_UNUSED(rio_dev_handle_t device_handle))
{
return false;
}
nirio_status rio_ioctl(
- rio_dev_handle_t device_handle,
- uint32_t ioctl_code,
- const void *write_buf,
- size_t write_buf_len,
- void *read_buf,
- size_t read_buf_len)
+ UHD_UNUSED(rio_dev_handle_t device_handle),
+ UHD_UNUSED(uint32_t ioctl_code),
+ UHD_UNUSED(const void *write_buf),
+ UHD_UNUSED(size_t write_buf_len),
+ UHD_UNUSED(void *read_buf),
+ UHD_UNUSED(size_t read_buf_len))
{
return NiRio_Status_FeatureNotSupported;
}
nirio_status rio_mmap(
- rio_dev_handle_t device_handle,
- uint16_t memory_type,
- size_t size,
- bool writable,
- rio_mmap_t &map)
+ UHD_UNUSED(rio_dev_handle_t device_handle),
+ UHD_UNUSED(uint16_t memory_type),
+ UHD_UNUSED(size_t size),
+ UHD_UNUSED(bool writable),
+ UHD_UNUSED(rio_mmap_t &map))
{
return NiRio_Status_FeatureNotSupported;
}
-nirio_status rio_munmap(rio_mmap_t &map)
+nirio_status rio_munmap(UHD_UNUSED(rio_mmap_t &map))
{
return NiRio_Status_FeatureNotSupported;
}
diff --git a/host/lib/transport/nirio/nirio_resource_manager.cpp b/host/lib/transport/nirio/nirio_resource_manager.cpp
index e56670de0..d62f5c40d 100644
--- a/host/lib/transport/nirio/nirio_resource_manager.cpp
+++ b/host/lib/transport/nirio/nirio_resource_manager.cpp
@@ -15,12 +15,13 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-
#include <uhd/transport/nirio/nirio_resource_manager.h>
-#ifdef __clang__
- #pragma GCC diagnostic push ignored "-Wmissing-field-initializers"
-#elif defined(__GNUC__)
+// "push" and "pop" introduced in GCC 4.6; works with all clang
+#if defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC_MINOR__ > 5)
+ #pragma GCC diagnostic push
+#endif
+#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
@@ -100,6 +101,6 @@ nirio_fifo_info_t* nirio_resource_manager::_lookup_fifo_info(const char* fifo_na
}}
-#ifdef __GNUC__
+#if defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC_MINOR__ > 5)
#pragma GCC diagnostic pop
#endif
diff --git a/host/lib/transport/nirio/niriok_proxy.cpp b/host/lib/transport/nirio/niriok_proxy.cpp
index cc2daba22..0cc13efb8 100644
--- a/host/lib/transport/nirio/niriok_proxy.cpp
+++ b/host/lib/transport/nirio/niriok_proxy.cpp
@@ -20,9 +20,11 @@
#include <uhd/transport/nirio/niriok_proxy_impl_v2.h>
#include <cstring>
-#ifdef __clang__
- #pragma GCC diagnostic push ignored "-Wmissing-field-initializers"
-#elif defined(__GNUC__)
+// "push" and "pop" introduced in GCC 4.6; works with all clang
+#if defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC_MINOR__ > 5)
+ #pragma GCC diagnostic push
+#endif
+#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
@@ -73,6 +75,6 @@ namespace uhd { namespace niusrprio
}
}}
-#ifdef __GNUC__
+#if defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC_MINOR__ > 5)
#pragma GCC diagnostic pop
#endif
diff --git a/host/lib/transport/nirio/niriok_proxy_impl_v1.cpp b/host/lib/transport/nirio/niriok_proxy_impl_v1.cpp
index f4a8e4ff5..f0ffe2ffc 100644
--- a/host/lib/transport/nirio/niriok_proxy_impl_v1.cpp
+++ b/host/lib/transport/nirio/niriok_proxy_impl_v1.cpp
@@ -15,13 +15,14 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-
#include <uhd/transport/nirio/niriok_proxy_impl_v1.h>
#include <cstring>
-#ifdef __clang__
- #pragma GCC diagnostic push ignored "-Wmissing-field-initializers"
-#elif defined(__GNUC__)
+// "push" and "pop" introduced in GCC 4.6; works with all clang
+#if defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC_MINOR__ > 5)
+ #pragma GCC diagnostic push
+#endif
+#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
@@ -490,6 +491,6 @@ namespace uhd { namespace niusrprio
}}
-#ifdef __GNUC__
+#if defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC_MINOR__ > 5)
#pragma GCC diagnostic pop
#endif
diff --git a/host/lib/transport/nirio/niriok_proxy_impl_v2.cpp b/host/lib/transport/nirio/niriok_proxy_impl_v2.cpp
index 8fb82708e..748db5cf8 100644
--- a/host/lib/transport/nirio/niriok_proxy_impl_v2.cpp
+++ b/host/lib/transport/nirio/niriok_proxy_impl_v2.cpp
@@ -19,9 +19,11 @@
#include <uhd/transport/nirio/niriok_proxy_impl_v2.h>
#include <cstring>
-#ifdef __clang__
- #pragma GCC diagnostic push ignored "-Wmissing-field-initializers"
-#elif defined(__GNUC__)
+// "push" and "pop" introduced in GCC 4.6; works with all clang
+#if defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC_MINOR__ > 5)
+ #pragma GCC diagnostic push
+#endif
+#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
@@ -642,6 +644,6 @@ namespace uhd { namespace niusrprio
}}
-#ifdef __GNUC__
+#if defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC_MINOR__ > 5)
#pragma GCC diagnostic pop
#endif
diff --git a/host/lib/transport/nirio_zero_copy.cpp b/host/lib/transport/nirio_zero_copy.cpp
index 9d64d0792..1eb431a19 100644
--- a/host/lib/transport/nirio_zero_copy.cpp
+++ b/host/lib/transport/nirio_zero_copy.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2013-2014 Ettus Research LLC
+// Copyright 2013-2015 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -51,7 +51,8 @@ public:
UHD_INLINE sptr get_new(const double timeout, size_t &index)
{
nirio_status status = 0;
- size_t elems_acquired, elems_remaining;
+ size_t elems_acquired = 0;
+ size_t elems_remaining = 0;
nirio_status_chain(_fifo.acquire(
_typed_buffer, _frame_size / sizeof(fifo_data_t),
static_cast<uint32_t>(timeout*1000),
@@ -91,7 +92,8 @@ public:
UHD_INLINE sptr get_new(const double timeout, size_t &index)
{
nirio_status status = 0;
- size_t elems_acquired, elems_remaining;
+ size_t elems_acquired = 0;
+ size_t elems_remaining = 0;
nirio_status_chain(_fifo.acquire(
_typed_buffer, _frame_size / sizeof(fifo_data_t),
static_cast<uint32_t>(timeout*1000),
@@ -299,10 +301,10 @@ private:
nirio_status_chain(_proxy()->peek(
PCIE_TX_DMA_REG(DMA_CTRL_STATUS_REG, _fifo_instance), reg_data), status);
- tx_busy = (reg_data & DMA_STATUS_BUSY);
+ tx_busy = (reg_data & DMA_STATUS_BUSY) > 0;
nirio_status_chain(_proxy()->peek(
PCIE_RX_DMA_REG(DMA_CTRL_STATUS_REG, _fifo_instance), reg_data), status);
- rx_busy = (reg_data & DMA_STATUS_BUSY);
+ rx_busy = (reg_data & DMA_STATUS_BUSY) > 0;
if (nirio_status_not_fatal(status) && (tx_busy || rx_busy)) {
start_time = boost::posix_time::microsec_clock::local_time();
@@ -311,10 +313,10 @@ private:
elapsed = boost::posix_time::microsec_clock::local_time() - start_time;
nirio_status_chain(_proxy()->peek(
PCIE_TX_DMA_REG(DMA_CTRL_STATUS_REG, _fifo_instance), reg_data), status);
- tx_busy = (reg_data & DMA_STATUS_BUSY);
+ tx_busy = (reg_data & DMA_STATUS_BUSY) > 0;
nirio_status_chain(_proxy()->peek(
PCIE_RX_DMA_REG(DMA_CTRL_STATUS_REG, _fifo_instance), reg_data), status);
- rx_busy = (reg_data & DMA_STATUS_BUSY);
+ rx_busy = (reg_data & DMA_STATUS_BUSY) > 0;
} while (
nirio_status_not_fatal(status) &&
(tx_busy || rx_busy) &&