From 3a1123e3b9ea2f7d2d998f5120c6ecf7fc6016de Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 24 Oct 2019 16:58:18 -0700 Subject: [PATCH] more compat --- src/pvxs/util.h | 4 ++++ src/pvxs/version.h | 4 ++++ src/server.cpp | 1 + src/unittest.cpp | 10 ++++++++++ src/util.cpp | 1 + 5 files changed, 20 insertions(+) diff --git a/src/pvxs/util.h b/src/pvxs/util.h index 1f746d2..33f1cf8 100644 --- a/src/pvxs/util.h +++ b/src/pvxs/util.h @@ -13,6 +13,10 @@ #include #include +#ifdef _WIN32 +# include +#endif + #include namespace pvxs { diff --git a/src/pvxs/version.h b/src/pvxs/version.h index c7e0283..4ae7b63 100644 --- a/src/pvxs/version.h +++ b/src/pvxs/version.h @@ -32,6 +32,10 @@ #define PVXS_VERSION VERSION_INT(PVXS_MAJOR_VERSION, PVXS_MINOR_VERSION, PVXS_MAINTENANCE_VERSION, 0) +#ifdef __GNUC__ +# define GCC_VERSION VERSION_INT(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, 0) +#endif + namespace pvxs { //! Library version as a string diff --git a/src/server.cpp b/src/server.cpp index 9b34c4f..7137706 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -5,6 +5,7 @@ */ #include +#include #include #include diff --git a/src/unittest.cpp b/src/unittest.cpp index bdfb997..02dcc56 100644 --- a/src/unittest.cpp +++ b/src/unittest.cpp @@ -20,7 +20,12 @@ testCase::testCase(bool result) testCase::testCase(testCase&& o) noexcept :result(o.result) +#if !GCC_VERSION || GCC_VERSION>=VERSION_INT(4,9,0,0) ,msg(std::move(o.msg)) +#else + // gcc 4.8 (at least) doesn't provide a move ctor yet + ,msg(o.msg.str()) +#endif { o.result = Nothing; } @@ -30,7 +35,12 @@ testCase& testCase::operator=(testCase&& o) noexcept if(this!=&o) { result = o.result; o.result = Nothing; +#if !GCC_VERSION || GCC_VERSION>=VERSION_INT(4,9,0,0) msg = std::move(o.msg); +#else + msg.seekp(0); + msg.str(o.msg.str()); +#endif } return *this; } diff --git a/src/util.cpp b/src/util.cpp index a768d44..0a3d5c6 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include