diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | cmake/msvc/config.h | 44 | ||||
-rw-r--r-- | cmake/msvc/sys/time.h | 17 | ||||
-rw-r--r-- | cmake/msvc/unistd.h | 7 | ||||
-rw-r--r-- | gr-blocks/tests/benchmark_nco.cc | 9 | ||||
-rw-r--r-- | gr-blocks/tests/benchmark_vco.cc | 10 |
7 files changed, 16 insertions, 73 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index af5e1c76c7..00ed1c0af7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Older Logs can be found in `docs/RELEASE-NOTES-*`. - C++17 - requires MSVC 1914 (Microsoft VS 2017 15.7) +- Windows build: removed unnecessary MSVC-specific system include overrides ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ec9e4e847..e491a756d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,7 +194,6 @@ if(MSVC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE ) - add_definitions(-DHAVE_CONFIG_H) add_compile_options(/MP) #build with multiple processors add_compile_options(/bigobj) #allow for larger object files endif(MSVC) diff --git a/cmake/msvc/config.h b/cmake/msvc/config.h deleted file mode 100644 index ec307a8a1b..0000000000 --- a/cmake/msvc/config.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_CONFIG_H_ // [ -#define _MSC_CONFIG_H_ - -//////////////////////////////////////////////////////////////////////// -// enable inline functions for C code -//////////////////////////////////////////////////////////////////////// -#ifndef __cplusplus -#define inline __inline -#endif - -//////////////////////////////////////////////////////////////////////// -// rint functions -//////////////////////////////////////////////////////////////////////// -#if _MSC_VER < 1800 -#include <math.h> -static inline long lrint(double x) { return (long)(x > 0.0 ? x + 0.5 : x - 0.5); } -static inline long lrintf(float x) { return (long)(x > 0.0f ? x + 0.5f : x - 0.5f); } -static inline long long llrint(double x) -{ - return (long long)(x > 0.0 ? x + 0.5 : x - 0.5); -} -static inline long long llrintf(float x) -{ - return (long long)(x > 0.0f ? x + 0.5f : x - 0.5f); -} -static inline double rint(double x) { return (x > 0.0) ? floor(x + 0.5) : ceil(x - 0.5); } -static inline float rintf(float x) -{ - return (x > 0.0f) ? floorf(x + 0.5f) : ceilf(x - 0.5f); -} -#endif - -//////////////////////////////////////////////////////////////////////// -// random and srandom -//////////////////////////////////////////////////////////////////////// -#include <stdlib.h> -static inline long int random(void) { return rand(); } -static inline void srandom(unsigned int seed) { srand(seed); } - -#endif // _MSC_CONFIG_H_ ] diff --git a/cmake/msvc/sys/time.h b/cmake/msvc/sys/time.h deleted file mode 100644 index df178d3039..0000000000 --- a/cmake/msvc/sys/time.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_SYS_TIME_H_ -#define _MSC_SYS_TIME_H_ - -#include < time.h > - -#if _MSC_VER < 1900 -struct timespec { - time_t tv_sec; /*! \brief Seconds since 00:00:00 GMT, 1 January 1970 */ - long tv_nsec; /*! \brief Additional nanoseconds since tv_sec */ -}; -#endif - -#endif //_MSC_SYS_TIME_H_ diff --git a/cmake/msvc/unistd.h b/cmake/msvc/unistd.h index de412e42a5..bb781160d7 100644 --- a/cmake/msvc/unistd.h +++ b/cmake/msvc/unistd.h @@ -1,10 +1,11 @@ +#ifndef _MSC_UNISTD_H_ // [ +#define _MSC_UNISTD_H_ #ifndef _MSC_VER // [ #error "Use this header only with Microsoft Visual C++ compilers!" #endif // _MSC_VER ] -#ifndef _MSC_UNISTD_H_ // [ -#define _MSC_UNISTD_H_ - +// Just for getpid in the vmcircbuf classes +// (at least as far as I can tell 2021) #include <process.h> #endif // _MSC_UNISTD_H_ ] diff --git a/gr-blocks/tests/benchmark_nco.cc b/gr-blocks/tests/benchmark_nco.cc index d9a9a3a564..1970182294 100644 --- a/gr-blocks/tests/benchmark_nco.cc +++ b/gr-blocks/tests/benchmark_nco.cc @@ -16,16 +16,17 @@ #include <gnuradio/math.h> #include <gnuradio/nco.h> -#include <sys/time.h> -#include <unistd.h> - #ifdef HAVE_SYS_RESOURCE_H +/* from man gtrusage + "including <sys/time.h> is not required these days" + So, we don't */ #include <sys/resource.h> #endif #include <cstdio> #include <cstdlib> #include <cstring> +#include <ctime> #define ITERATIONS 20000000 #define BLOCK_SIZE (10 * 1000) // fits in cache @@ -84,7 +85,7 @@ static void benchmark(void test(float* x, float* y), const char* implementation_ double total = user + sys; #else - clock_end = (double)clock() * (1000000. / CLOCKS_PER_SEC); + clock_end = (double)std::clock() * (1000000. / CLOCKS_PER_SEC); double total = clock_end - clock_start; #endif diff --git a/gr-blocks/tests/benchmark_vco.cc b/gr-blocks/tests/benchmark_vco.cc index 52ce63e8a7..13a6c428d6 100644 --- a/gr-blocks/tests/benchmark_vco.cc +++ b/gr-blocks/tests/benchmark_vco.cc @@ -16,16 +16,18 @@ #include <gnuradio/math.h> #include <gnuradio/vco.h> -#include <sys/time.h> -#include <unistd.h> #ifdef HAVE_SYS_RESOURCE_H +/* from man gtrusage + "including <sys/time.h> is not required these days" + So, we don't */ #include <sys/resource.h> #endif #include <cstdio> #include <cstdlib> #include <cstring> +#include <ctime> #define ITERATIONS 5000000 #define BLOCK_SIZE (10 * 1000) // fits in cache @@ -66,7 +68,7 @@ static void benchmark(void test(float* x, const float* y), exit(1); } #else - clock_start = (double)clock() * (1000000. / CLOCKS_PER_SEC); + clock_start = (double)std::clock() * (1000000. / CLOCKS_PER_SEC); #endif // do the actual work @@ -90,7 +92,7 @@ static void benchmark(void test(float* x, const float* y), double total = user + sys; #else - clock_end = (double)clock() * (1000000. / CLOCKS_PER_SEC); + clock_end = (double)std::clock() * (1000000. / CLOCKS_PER_SEC); double total = clock_end - clock_start; #endif |