by ogopogo » 03 Aug 2012, 19:03
Wow, I'm glad that CMake build has already been adopted, it's a great tool.
Here are the Mingw patches. The only build that they might break is the MSVC build, and the defines that I switch to in the patches are available in MSVC (see MSVC's float.h header for confirmation):
--- ./poco-1.4.3-all/Foundation/src/FPEnvironment_WIN32.cpp 2012-01-15 18:26:18.000000000 +0200
+++ ./poco-1.4.3-all-gcc/Foundation/src/FPEnvironment_WIN32.cpp 2012-08-01 16:27:59.508843800 +0300
@@ -54,7 +54,7 @@
FPEnvironmentImpl::~FPEnvironmentImpl()
{
- _controlfp(_env, MCW_RC);
+ _controlfp(_env, _MCW_RC);
}
@@ -85,13 +85,13 @@
void FPEnvironmentImpl::setRoundingModeImpl(RoundingModeImpl mode)
{
- _controlfp(mode, MCW_RC);
+ _controlfp(mode, _MCW_RC);
}
FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl()
{
- return RoundingModeImpl(_controlfp(0, 0) & MCW_RC);
+ return RoundingModeImpl(_controlfp(0, 0) & _MCW_RC);
}
--- ./poco-1.4.3-all/Foundation/include/Poco/FPEnvironment_WIN32.h 2012-01-15 18:26:18.000000000 +0200
+++ ./poco-1.4.3-all-gcc/Foundation/include/Poco/FPEnvironment_WIN32.h 2012-08-01 16:24:19.105523500 +0300
@@ -48,23 +48,42 @@
namespace Poco {
+#ifndef _SW_INEXACT
+ #define _SW_INEXACT 0x00000001 /* inexact (precision) */
+#endif
+#ifndef _SW_UNDERFLOW
+ #define _SW_UNDERFLOW 0x00000002 /* underflow */
+#endif
+#ifndef _SW_OVERFLOW
+ #define _SW_OVERFLOW 0x00000004 /* overflow */
+#endif
+#ifndef _SW_ZERODIVIDE
+ #define _SW_ZERODIVIDE 0x00000008 /* zero divide */
+#endif
+#ifndef _SW_INVALID
+ #define _SW_INVALID 0x00000010 /* invalid */
+#endif
+#ifndef _SW_DENORMAL
+ #define _SW_DENORMAL 0x00080000 /* denormal status bit */
+#endif
+
class Foundation_API FPEnvironmentImpl
{
protected:
enum RoundingModeImpl
{
- FP_ROUND_DOWNWARD_IMPL = RC_DOWN,
- FP_ROUND_UPWARD_IMPL = RC_UP,
- FP_ROUND_TONEAREST_IMPL = RC_NEAR,
- FP_ROUND_TOWARDZERO_IMPL = RC_CHOP
+ FP_ROUND_DOWNWARD_IMPL = _RC_DOWN,
+ FP_ROUND_UPWARD_IMPL = _RC_UP,
+ FP_ROUND_TONEAREST_IMPL = _RC_NEAR,
+ FP_ROUND_TOWARDZERO_IMPL = _RC_CHOP
};
enum FlagImpl
{
- FP_DIVIDE_BY_ZERO_IMPL = SW_ZERODIVIDE,
- FP_INEXACT_IMPL = SW_INEXACT,
- FP_OVERFLOW_IMPL = SW_OVERFLOW,
- FP_UNDERFLOW_IMPL = SW_UNDERFLOW,
- FP_INVALID_IMPL = SW_INVALID
+ FP_DIVIDE_BY_ZERO_IMPL = _SW_ZERODIVIDE,
+ FP_INEXACT_IMPL = _SW_INEXACT,
+ FP_OVERFLOW_IMPL = _SW_OVERFLOW,
+ FP_UNDERFLOW_IMPL = _SW_UNDERFLOW,
+ FP_INVALID_IMPL = _SW_INVALID
};
FPEnvironmentImpl();
FPEnvironmentImpl(const FPEnvironmentImpl& env);