From d2eefb7ed4d36e5d450444a6c873a40896b80c25 Mon Sep 17 00:00:00 2001 From: vogel76 Date: Wed, 29 Jan 2014 13:08:37 +0100 Subject: [PATCH] [BW]: [Ign] #pragma warning enclosed into _MSC_VER to avoid gcc complaining [BW]: [NIP] Added LLCONST and ULLCONST macros to safely declare large literals incl. setting its type and avoid gcc compile error this way. --- include/fc/time.hpp | 11 +++++++---- include/fc/uint128.hpp | 11 +++++++---- include/fc/utility.hpp | 4 ++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/include/fc/time.hpp b/include/fc/time.hpp index f2e4024..c5ae58a 100644 --- a/include/fc/time.hpp +++ b/include/fc/time.hpp @@ -3,8 +3,10 @@ #include #include -#pragma warning (push) -#pragma warning (disable : 4244) +#ifdef _MSC_VER + #pragma warning (push) + #pragma warning (disable : 4244) +#endif //// _MSC_VER namespace fc { class microseconds { @@ -91,5 +93,6 @@ namespace fc { typedef fc::optional otime_point; } -#pragma warning (pop) - +#ifdef _MSC_VER + #pragma warning (pop) +#endif /// #ifdef _MSC_VER diff --git a/include/fc/uint128.hpp b/include/fc/uint128.hpp index 0577e3c..aab14f2 100644 --- a/include/fc/uint128.hpp +++ b/include/fc/uint128.hpp @@ -2,8 +2,10 @@ #include #include -#pragma warning (push) -#pragma warning (disable : 4244) +#ifdef _MSC_VER + #pragma warning (push) + #pragma warning (disable : 4244) +#endif //// _MSC_VER namespace fc { @@ -114,5 +116,6 @@ namespace std }; } -#pragma warning (pop) - +#ifdef _MSC_VER + #pragma warning (pop) +#endif ///_MSC_VER diff --git a/include/fc/utility.hpp b/include/fc/utility.hpp index 0c6c77e..098d9d0 100644 --- a/include/fc/utility.hpp +++ b/include/fc/utility.hpp @@ -59,3 +59,7 @@ namespace fc { a = fc::move(b); b = fc::move(tmp); } + +#define LLCONST(constant) static_cast(constant##ll) +#define ULLCONST(constant) static_cast(constant##ull) +