summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2014-07-07 15:31:33 -0700
committerNicholas Corgan <nick.corgan@ettus.com>2014-07-07 15:31:33 -0700
commit3b6ca994ca2219d3834814d3175ef6aec04b33fb (patch)
treef3b58aee799276f40317f518eb548b1fd16b0be5
parentRemoving trailing/extra whitespaces before release. (diff)
downloadgnuradio-3b6ca994ca2219d3834814d3175ef6aec04b33fb.tar.xz
gnuradio-3b6ca994ca2219d3834814d3175ef6aec04b33fb.zip
Windows compatibility fixes
* Fixed usage of Windows thread-naming API, changed minimum Windows version * Fixed MSVC usage of isnan, round
-rw-r--r--CMakeLists.txt2
-rw-r--r--gnuradio-runtime/lib/block.cc2
-rw-r--r--gnuradio-runtime/lib/math/qa_fast_atan2f.cc12
-rw-r--r--gnuradio-runtime/lib/thread/thread.cc26
-rw-r--r--gnuradio-runtime/lib/tpb_thread_body.cc5
-rw-r--r--gr-filter/lib/pfb_channelizer_ccf_impl.cc4
-rw-r--r--gr-vocoder/lib/codec2/fdmdv.c4
7 files changed, 40 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 404ce0434..55dabebde 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,7 +86,7 @@ endif(CMAKE_COMPILER_IS_GNUCXX)
if(MSVC)
include_directories(${CMAKE_SOURCE_DIR}/cmake/msvc) #missing headers
- add_definitions(-D_WIN32_WINNT=0x0501) #minimum version required is windows xp
+ add_definitions(-D_WIN32_WINNT=0x0502) #Minimum version: "Windows Server 2003 with SP1, Windows XP with SP2"
add_definitions(-DNOMINMAX) #disables stupidity and enables std::min and std::max
add_definitions( #stop all kinds of compatibility warnings
-D_SCL_SECURE_NO_WARNINGS
diff --git a/gnuradio-runtime/lib/block.cc b/gnuradio-runtime/lib/block.cc
index 9e4fcf5cc..108c852db 100644
--- a/gnuradio-runtime/lib/block.cc
+++ b/gnuradio-runtime/lib/block.cc
@@ -30,7 +30,6 @@
#include <gnuradio/buffer.h>
#include <gnuradio/prefs.h>
#include <gnuradio/config.h>
-#include <gnuradio/rpcregisterhelpers.h>
#include <stdexcept>
#include <iostream>
@@ -796,6 +795,7 @@ namespace gr {
{
d_pc_rpc_set = true;
#if defined(GR_CTRLPORT) && defined(GR_PERFORMANCE_COUNTERS)
+#include <gnuradio/rpcregisterhelpers.h>
d_rpc_vars.push_back(
rpcbasic_sptr(new rpcbasic_register_trigger<block>(
alias(), "reset_perf_counters", &block::reset_perf_counters,
diff --git a/gnuradio-runtime/lib/math/qa_fast_atan2f.cc b/gnuradio-runtime/lib/math/qa_fast_atan2f.cc
index 2ec4ecb18..b70475679 100644
--- a/gnuradio-runtime/lib/math/qa_fast_atan2f.cc
+++ b/gnuradio-runtime/lib/math/qa_fast_atan2f.cc
@@ -30,6 +30,12 @@
#include <cmath>
#include <limits>
+#ifdef _MSC_VER
+#define isnan _isnan
+#else
+using std::isnan;
+#endif
+
void
qa_fast_atan2f::t1()
{
@@ -92,7 +98,7 @@ qa_fast_atan2f::t2()
x = inf;
y = inf;
gr_atan2f = gr::fast_atan2f(x, y);
- CPPUNIT_ASSERT(std::isnan(gr_atan2f));
+ CPPUNIT_ASSERT(isnan(gr_atan2f));
/* Test x as NAN */
@@ -123,11 +129,11 @@ qa_fast_atan2f::t2()
x = inf;
y = nan;
gr_atan2f = gr::fast_atan2f(x, y);
- CPPUNIT_ASSERT(std::isnan(gr_atan2f));
+ CPPUNIT_ASSERT(isnan(gr_atan2f));
x = nan;
y = inf;
gr_atan2f = gr::fast_atan2f(x, y);
- CPPUNIT_ASSERT(std::isnan(gr_atan2f));
+ CPPUNIT_ASSERT(isnan(gr_atan2f));
}
diff --git a/gnuradio-runtime/lib/thread/thread.cc b/gnuradio-runtime/lib/thread/thread.cc
index e393ae543..483dfed49 100644
--- a/gnuradio-runtime/lib/thread/thread.cc
+++ b/gnuradio-runtime/lib/thread/thread.cc
@@ -120,21 +120,14 @@ namespace gr {
DWORD dwFlags; // Reserved for future use, must be zero
} THREADNAME_INFO;
#pragma pack(pop)
- void
- set_thread_name(gr_thread_t thread, std::string name)
+ static void
+ _set_thread_name(gr_thread_t thread, const char* name, DWORD dwThreadId)
{
const DWORD SET_THREAD_NAME_EXCEPTION = 0x406D1388;
- DWORD dwThreadId = GetThreadId(thread);
- if (dwThreadId == 0)
- return;
-
- if (name.empty())
- name = boost::str(boost::format("thread %lu") % dwThreadId);
-
THREADNAME_INFO info;
info.dwType = 0x1000;
- info.szName = name.c_str();
+ info.szName = name;
info.dwThreadID = dwThreadId;
info.dwFlags = 0;
@@ -147,6 +140,19 @@ namespace gr {
}
}
+ void
+ set_thread_name(gr_thread_t thread, std::string name)
+ {
+ DWORD dwThreadId = GetThreadId(thread);
+ if (dwThreadId == 0)
+ return;
+
+ if (name.empty())
+ name = boost::str(boost::format("thread %lu") % dwThreadId);
+
+ _set_thread_name(thread, name.c_str(), dwThreadId);
+ }
+
} /* namespace thread */
} /* namespace gr */
diff --git a/gnuradio-runtime/lib/tpb_thread_body.cc b/gnuradio-runtime/lib/tpb_thread_body.cc
index d2f0fce83..d80ab860f 100644
--- a/gnuradio-runtime/lib/tpb_thread_body.cc
+++ b/gnuradio-runtime/lib/tpb_thread_body.cc
@@ -37,7 +37,12 @@ namespace gr {
{
//std::cerr << "tpb_thread_body: " << block << std::endl;
+#ifdef _MSC_VER
+ #include <Windows.h>
+ thread::set_thread_name(GetCurrentThread(), boost::str(boost::format("%s%d") % block->name() % block->unique_id()));
+#else
thread::set_thread_name(pthread_self(), boost::str(boost::format("%s%d") % block->name() % block->unique_id()));
+#endif
block_detail *d = block->detail().get();
block_executor::state s;
diff --git a/gr-filter/lib/pfb_channelizer_ccf_impl.cc b/gr-filter/lib/pfb_channelizer_ccf_impl.cc
index fe1966bc3..c43935350 100644
--- a/gr-filter/lib/pfb_channelizer_ccf_impl.cc
+++ b/gr-filter/lib/pfb_channelizer_ccf_impl.cc
@@ -28,6 +28,10 @@
#include <gnuradio/io_signature.h>
#include <stdio.h>
+#ifdef _MSC_VER
+#define round(number) number < 0.0 ? ceil(number - 0.5) : floor(number + 0.5)
+#endif
+
namespace gr {
namespace filter {
diff --git a/gr-vocoder/lib/codec2/fdmdv.c b/gr-vocoder/lib/codec2/fdmdv.c
index 6af1cf4c6..8855f76ae 100644
--- a/gr-vocoder/lib/codec2/fdmdv.c
+++ b/gr-vocoder/lib/codec2/fdmdv.c
@@ -25,6 +25,10 @@
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef _MSC_VER
+#define round(number) number < 0.0 ? ceil(number - 0.5) : floor(number + 0.5)
+#endif
+
/*---------------------------------------------------------------------------*\
INCLUDES