From 715f4dd313656f936e40b6415179b7ab6feda128 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Fri, 27 Mar 2015 10:55:48 -0700 Subject: Fixed master-specific warnings * MinGW: unused parameter warning, MSVC-specific pragma * MSVC: bool narrowing --- host/examples/benchmark_rate.cpp | 2 +- host/include/uhd/config.hpp | 4 ++-- host/include/uhd/transport/nirio/nirio_driver_iface.h | 10 +++++++--- host/lib/transport/chdr.cpp | 6 +++--- host/lib/utils/thread_priority.cpp | 2 +- host/tests/chdr_test.cpp | 5 ++++- 6 files changed, 18 insertions(+), 11 deletions(-) (limited to 'host') diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp index 7ff8b9939..cc3ef04a4 100644 --- a/host/examples/benchmark_rate.cpp +++ b/host/examples/benchmark_rate.cpp @@ -142,7 +142,7 @@ void benchmark_tx_rate( md.has_time_spec = (buffs.size() != 1); if (random_nsamps) { - std::srand( time(NULL) ); + std::srand( (unsigned int)time(NULL) ); while(not boost::this_thread::interruption_requested()){ size_t total_num_samps = rand() % max_samps_per_packet; size_t num_acc_samps = 0; diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp index 23eb9cdb2..8939cd773 100644 --- a/host/include/uhd/config.hpp +++ b/host/include/uhd/config.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2011,2014 Ettus Research LLC +// Copyright 2010-2011,2014-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 @@ -62,7 +62,7 @@ typedef ptrdiff_t ssize_t; #define UHD_INLINE inline #define UHD_DEPRECATED __declspec(deprecated) #define UHD_ALIGNED(x) __declspec(align(x)) - #define UHD_UNUSED(x) x + #define UHD_UNUSED(x) x __attribute__((unused)) #elif defined(__GNUG__) && __GNUG__ >= 4 #define UHD_EXPORT __attribute__((visibility("default"))) #define UHD_IMPORT __attribute__((visibility("default"))) diff --git a/host/include/uhd/transport/nirio/nirio_driver_iface.h b/host/include/uhd/transport/nirio/nirio_driver_iface.h index 3e0e56a7f..c562f0ca5 100644 --- a/host/include/uhd/transport/nirio/nirio_driver_iface.h +++ b/host/include/uhd/transport/nirio/nirio_driver_iface.h @@ -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 @@ -25,9 +25,13 @@ #include #if defined(UHD_PLATFORM_WIN32) #include - #pragma warning(disable:4201) // nonstandard extension used : nameless struct/union + #ifdef _MSC_VER + #pragma warning(disable:4201) // nonstandard extension used : nameless struct/union + #endif #include - #pragma warning(default:4201) + #ifdef _MSC_VER + #pragma warning(default:4201) + #endif #elif !defined(UHD_PLATFORM_LINUX) #include #endif diff --git a/host/lib/transport/chdr.cpp b/host/lib/transport/chdr.cpp index 47ac961b9..632887e56 100644 --- a/host/lib/transport/chdr.cpp +++ b/host/lib/transport/chdr.cpp @@ -115,12 +115,12 @@ UHD_INLINE void _hdr_unpack_chdr( if_packet_info.sob = false; // Set configurable members - if_packet_info.has_tsf = bool(chdr & HDR_FLAG_TSF); + if_packet_info.has_tsf = (chdr & HDR_FLAG_TSF) > 0; if_packet_info.packet_type = if_packet_info_t::packet_type_t((chdr >> 30) & 0x3); if_packet_info.eob = (if_packet_info.packet_type == if_packet_info_t::PACKET_TYPE_DATA) - && bool(chdr & HDR_FLAG_EOB); + && ((chdr & HDR_FLAG_EOB) > 0); if_packet_info.error = (if_packet_info.packet_type == if_packet_info_t::PACKET_TYPE_RESP) - && bool(chdr & HDR_FLAG_ERROR); + && ((chdr & HDR_FLAG_ERROR) > 0); if_packet_info.packet_count = (chdr >> 16) & 0xFFF; // Set packet length variables diff --git a/host/lib/utils/thread_priority.cpp b/host/lib/utils/thread_priority.cpp index 7c3faa37a..af25d088a 100644 --- a/host/lib/utils/thread_priority.cpp +++ b/host/lib/utils/thread_priority.cpp @@ -74,7 +74,7 @@ static void check_priority_range(float priority){ #ifdef HAVE_WIN_SETTHREADPRIORITY #include - void uhd::set_thread_priority(float priority, bool realtime){ + void uhd::set_thread_priority(float priority, UHD_UNUSED(bool realtime)){ check_priority_range(priority); /* diff --git a/host/tests/chdr_test.cpp b/host/tests/chdr_test.cpp index ed6c690f9..f48073a09 100644 --- a/host/tests/chdr_test.cpp +++ b/host/tests/chdr_test.cpp @@ -47,7 +47,10 @@ static void pack_and_unpack( ); std::cout << std::endl; boost::uint32_t header_bits = (uhd::ntohx(packet_buff[0]) >> 28); - std::cout << boost::format("header bits = 0b%d%d%d%d") % bool(header_bits & 8) % bool(header_bits & 4) % bool(header_bits & 2) % bool(header_bits & 1) << std::endl; + std::cout << boost::format("header bits = 0b%d%d%d%d") % ((header_bits & 8) > 0) + % ((header_bits & 4) > 0) + % ((header_bits & 2) > 0) + % ((header_bits & 1) > 0) << std::endl; for (size_t i = 0; i < 5; i++) { std::cout << boost::format("packet_buff[%u] = 0x%08x") % i % uhd::ntohx(packet_buff[i]) << std::endl; -- cgit v1.2.3