From: <man...@us...> - 2015-06-13 11:59:31
|
Revision: 5297 http://sourceforge.net/p/modplug/code/5297 Author: manxorist Date: 2015-06-13 11:59:24 +0000 (Sat, 13 Jun 2015) Log Message: ----------- [Ref] Add MPT_DO and MPT_WHILE_0 macros that work around the stupid MSVC W4 "conditional expression is constant" warning in every block macro. [Ref] Use MPT_CONSTANT_IF in mpt::saturate_cast to silence MSVC W4 warnings. Modified Paths: -------------- trunk/OpenMPT/common/BuildSettings.h trunk/OpenMPT/common/ComponentManager.h trunk/OpenMPT/common/Endianness.h trunk/OpenMPT/common/Logging.cpp trunk/OpenMPT/common/Logging.h trunk/OpenMPT/common/Profiler.h trunk/OpenMPT/common/misc_util.h trunk/OpenMPT/common/serialization_utils.cpp trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/soundlib/Load_mt2.cpp trunk/OpenMPT/soundlib/SampleFormatConverters.h trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/test/TestToolsLib.h trunk/OpenMPT/test/TestToolsTracker.h trunk/OpenMPT/test/test.cpp Modified: trunk/OpenMPT/common/BuildSettings.h =================================================================== --- trunk/OpenMPT/common/BuildSettings.h 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/common/BuildSettings.h 2015-06-13 11:59:24 UTC (rev 5297) @@ -500,7 +500,7 @@ #if MPT_COMPILER_MSVC -// happens for do { } while(0) +// happens for if expression that only depend on template parameters #pragma warning(disable:4127) // conditional expression is constant // happens for immutable classes (i.e. classes containing const members) @@ -514,5 +514,5 @@ #pragma warning(disable:4250) // 'mpt::fstream' : inherits 'std::basic_istream<_Elem,_Traits>::std::basic_istream<_Elem,_Traits>::_Add_vtordisp1' via dominance #endif -#endif +#endif // MPT_COMPILER_MSVC Modified: trunk/OpenMPT/common/ComponentManager.h =================================================================== --- trunk/OpenMPT/common/ComponentManager.h 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/common/ComponentManager.h 2015-06-13 11:59:24 UTC (rev 5297) @@ -155,9 +155,9 @@ }; -#define MPT_COMPONENT_BIND(libName, func) do { if(!Bind( func , libName , #func )) { SetBindFailed(); } } while(0) +#define MPT_COMPONENT_BIND(libName, func) MPT_DO { if(!Bind( func , libName , #func )) { SetBindFailed(); } } MPT_WHILE_0 #define MPT_COMPONENT_BIND_OPTIONAL(libName, func) Bind( func , libName , #func ) -#define MPT_COMPONENT_BIND_SYMBOL(libName, symbol, func) do { if(!Bind( func , libName , symbol )) { SetBindFailed(); } } while(0) +#define MPT_COMPONENT_BIND_SYMBOL(libName, symbol, func) MPT_DO { if(!Bind( func , libName , symbol )) { SetBindFailed(); } } MPT_WHILE_0 #define MPT_COMPONENT_BIND_SYMBOL_OPTIONAL(libName, symbol, func) Bind( func , libName , symbol ) Modified: trunk/OpenMPT/common/Endianness.h =================================================================== --- trunk/OpenMPT/common/Endianness.h 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/common/Endianness.h 2015-06-13 11:59:24 UTC (rev 5297) @@ -140,8 +140,8 @@ // argument. // In-place modifying version: -#define SwapBytesBE(value) do { (value) = SwapBytesBE_((value)); } while(0) -#define SwapBytesLE(value) do { (value) = SwapBytesLE_((value)); } while(0) +#define SwapBytesBE(value) MPT_DO { (value) = SwapBytesBE_((value)); } MPT_WHILE_0 +#define SwapBytesLE(value) MPT_DO { (value) = SwapBytesLE_((value)); } MPT_WHILE_0 // Alternative, function-style syntax: #define SwapBytesReturnBE(value) SwapBytesBE_((value)) Modified: trunk/OpenMPT/common/Logging.cpp =================================================================== --- trunk/OpenMPT/common/Logging.cpp 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/common/Logging.cpp 2015-06-13 11:59:24 UTC (rev 5297) @@ -33,7 +33,7 @@ #if MPT_COMPILER_MSVC || (MPT_COMPILER_GCC && MPT_GCC_AT_LEAST(4,3,0) && MPT_GCC_BEFORE(4,4,0)) #ifndef va_copy -#define va_copy(dst, src) do { (dst) = (src); } while (0) +#define va_copy(dst, src) MPT_DO { (dst) = (src); } MPT_WHILE_0 #endif #endif Modified: trunk/OpenMPT/common/Logging.h =================================================================== --- trunk/OpenMPT/common/Logging.h 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/common/Logging.h 2015-06-13 11:59:24 UTC (rev 5297) @@ -138,13 +138,13 @@ void Seal(); bool Dump(const mpt::PathString &filename); -#define MPT_TRACE() do { if(mpt::log::Trace::g_Enabled) { mpt::log::Trace::Trace(MPT_LOG_CURRENTCONTEXT()); } } while(0) +#define MPT_TRACE() MPT_DO { if(mpt::log::Trace::g_Enabled) { mpt::log::Trace::Trace(MPT_LOG_CURRENTCONTEXT()); } } MPT_WHILE_0 } // namespace Trace #else // !MODPLUG_TRACKER -#define MPT_TRACE() do { } while(0) +#define MPT_TRACE() MPT_DO { } MPT_WHILE_0 #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/common/Profiler.h =================================================================== --- trunk/OpenMPT/common/Profiler.h 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/common/Profiler.h 2015-06-13 11:59:24 UTC (rev 5297) @@ -115,8 +115,8 @@ static std::string DumpProfiles() { return std::string(); } static std::vector<double> DumpCategories() { return std::vector<double>(); } }; -#define OPENMPT_PROFILE_SCOPE(cat, name) do { } while(0) -#define OPENMPT_PROFILE_FUNCTION(cat) do { } while(0) +#define OPENMPT_PROFILE_SCOPE(cat, name) MPT_DO { } MPT_WHILE_0 +#define OPENMPT_PROFILE_FUNCTION(cat) MPT_DO { } MPT_WHILE_0 #endif // USE_PROFILER Modified: trunk/OpenMPT/common/misc_util.h =================================================================== --- trunk/OpenMPT/common/misc_util.h 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/common/misc_util.h 2015-06-13 11:59:24 UTC (rev 5297) @@ -122,34 +122,34 @@ // This code tries not only to obviously avoid overflows but also to avoid signed/unsigned comparison warnings and type truncation warnings (which in fact would be safe here) by explicit casting. STATIC_ASSERT(std::numeric_limits<Tdst>::is_integer); STATIC_ASSERT(std::numeric_limits<Tsrc>::is_integer); - if(std::numeric_limits<Tdst>::is_signed && std::numeric_limits<Tsrc>::is_signed) + MPT_CONSTANT_IF(std::numeric_limits<Tdst>::is_signed && std::numeric_limits<Tsrc>::is_signed) { - if(sizeof(Tdst) >= sizeof(Tsrc)) + MPT_CONSTANT_IF(sizeof(Tdst) >= sizeof(Tsrc)) { return static_cast<Tdst>(src); } return static_cast<Tdst>(std::max<Tsrc>(static_cast<Tsrc>(std::numeric_limits<Tdst>::min()), std::min<Tsrc>(src, static_cast<Tsrc>(std::numeric_limits<Tdst>::max())))); - } else if(!std::numeric_limits<Tdst>::is_signed && !std::numeric_limits<Tsrc>::is_signed) + } else MPT_CONSTANT_IF(!std::numeric_limits<Tdst>::is_signed && !std::numeric_limits<Tsrc>::is_signed) { - if(sizeof(Tdst) >= sizeof(Tsrc)) + MPT_CONSTANT_IF(sizeof(Tdst) >= sizeof(Tsrc)) { return static_cast<Tdst>(src); } return static_cast<Tdst>(std::min<Tsrc>(src, static_cast<Tsrc>(std::numeric_limits<Tdst>::max()))); - } else if(std::numeric_limits<Tdst>::is_signed && !std::numeric_limits<Tsrc>::is_signed) + } else MPT_CONSTANT_IF(std::numeric_limits<Tdst>::is_signed && !std::numeric_limits<Tsrc>::is_signed) { - if(sizeof(Tdst) > sizeof(Tsrc)) + MPT_CONSTANT_IF(sizeof(Tdst) > sizeof(Tsrc)) { return static_cast<Tdst>(src); } - if(sizeof(Tdst) == sizeof(Tsrc)) + MPT_CONSTANT_IF(sizeof(Tdst) == sizeof(Tsrc)) { return static_cast<Tdst>(std::min<Tsrc>(src, static_cast<Tsrc>(std::numeric_limits<Tdst>::max()))); } return static_cast<Tdst>(std::min<Tsrc>(src, static_cast<Tsrc>(std::numeric_limits<Tdst>::max()))); } else // Tdst unsigned, Tsrc signed { - if(sizeof(Tdst) >= sizeof(Tsrc)) + MPT_CONSTANT_IF(sizeof(Tdst) >= sizeof(Tsrc)) { return static_cast<Tdst>(std::max<Tsrc>(0, src)); } @@ -466,7 +466,7 @@ a = -a; if(b < 0) b = -b; - do + for(;;) { if(a == 0) return b; @@ -474,7 +474,7 @@ if(b == 0) return a; a %= b; - } while(true); + } } // Least Common Multiple. Always returns non-negative number. Modified: trunk/OpenMPT/common/serialization_utils.cpp =================================================================== --- trunk/OpenMPT/common/serialization_utils.cpp 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/common/serialization_utils.cpp 2015-06-13 11:59:24 UTC (rev 5297) @@ -32,7 +32,7 @@ #ifdef SSB_LOGGING #define SSB_LOG(x) Log(x) #else -#define SSB_LOG(x) do{}while(0) +#define SSB_LOG(x) MPT_DO { } MPT_WHILE_0 #endif Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/common/typedefs.h 2015-06-13 11:59:24 UTC (rev 5297) @@ -227,7 +227,7 @@ if(x) \ /**/ #elif MPT_GCC_AT_LEAST(4,4,0) -// GCC 4.4 does not like _Pragma inside functions. +// GCC 4.4 does not like _Pragma diagnostic inside functions. // As GCC 4.4 is one of our major compilers, we do not want a noisy build. // Thus, just disable this warning globally. (not required for now) //#pragma GCC diagnostic ignored "-Wtype-limits" @@ -254,7 +254,24 @@ #endif - + +#if MPT_COMPILER_MSVC +// MSVC warns for the well-known and widespread "do { } while(0)" idiom with warning level 4 ("conditional expression is constant"). +// It does not warn with "while(0,0)". However this again causes warnings with other compilers. +// Solve it with a macro. +#define MPT_DO do +#define MPT_WHILE_0 while(0,0) +#endif + +#ifndef MPT_DO +#define MPT_DO do +#endif +#ifndef MPT_WHILE_0 +#define MPT_WHILE_0 while(0) +#endif + + + // Static code checkers might need to get the knowledge of our assertions transferred to them. #define MPT_CHECKER_ASSUME_ASSERTIONS 1 //#define MPT_CHECKER_ASSUME_ASSERTIONS 0 @@ -268,7 +285,7 @@ #endif #ifndef MPT_CHECKER_ASSUME -#define MPT_CHECKER_ASSUME(x) do { } while(0) +#define MPT_CHECKER_ASSUME(x) MPT_DO { } MPT_WHILE_0 #endif @@ -314,8 +331,8 @@ #define MPT_ASSERT_ALWAYS(expr) ASSERT((expr)) #define MPT_ASSERT_ALWAYS_MSG(expr, msg) ASSERT((expr) && (msg)) #else -#define MPT_ASSERT_ALWAYS(expr) do { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr); } MPT_CHECKER_ASSUME(expr); } while(0) -#define MPT_ASSERT_ALWAYS_MSG(expr, msg) do { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr, msg); } MPT_CHECKER_ASSUME(expr); } while(0) +#define MPT_ASSERT_ALWAYS(expr) MPT_DO { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr); } MPT_CHECKER_ASSUME(expr); } MPT_WHILE_0 +#define MPT_ASSERT_ALWAYS_MSG(expr, msg) MPT_DO { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr, msg); } MPT_CHECKER_ASSUME(expr); } MPT_WHILE_0 #ifndef MPT_ASSERT_HANDLER_NEEDED #define MPT_ASSERT_HANDLER_NEEDED #endif @@ -325,18 +342,18 @@ #define MPT_ASSERT(expr) MPT_CHECKER_ASSUME(expr) #define MPT_ASSERT_MSG(expr, msg) MPT_CHECKER_ASSUME(expr) -#define MPT_ASSERT_ALWAYS(expr) do { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr); } MPT_CHECKER_ASSUME(expr); } while(0) -#define MPT_ASSERT_ALWAYS_MSG(expr, msg) do { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr, msg); } MPT_CHECKER_ASSUME(expr); } while(0) +#define MPT_ASSERT_ALWAYS(expr) MPT_DO { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr); } MPT_CHECKER_ASSUME(expr); } MPT_WHILE_0 +#define MPT_ASSERT_ALWAYS_MSG(expr, msg) MPT_DO { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr, msg); } MPT_CHECKER_ASSUME(expr); } MPT_WHILE_0 #ifndef MPT_ASSERT_HANDLER_NEEDED #define MPT_ASSERT_HANDLER_NEEDED #endif #else // !NO_ASSERTS -#define MPT_ASSERT(expr) do { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr); } MPT_CHECKER_ASSUME(expr); } while(0) -#define MPT_ASSERT_MSG(expr, msg) do { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr, msg); } MPT_CHECKER_ASSUME(expr); } while(0) -#define MPT_ASSERT_ALWAYS(expr) do { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr); } MPT_CHECKER_ASSUME(expr); } while(0) -#define MPT_ASSERT_ALWAYS_MSG(expr, msg) do { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr, msg); } MPT_CHECKER_ASSUME(expr); } while(0) +#define MPT_ASSERT(expr) MPT_DO { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr); } MPT_CHECKER_ASSUME(expr); } MPT_WHILE_0 +#define MPT_ASSERT_MSG(expr, msg) MPT_DO { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr, msg); } MPT_CHECKER_ASSUME(expr); } MPT_WHILE_0 +#define MPT_ASSERT_ALWAYS(expr) MPT_DO { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr); } MPT_CHECKER_ASSUME(expr); } MPT_WHILE_0 +#define MPT_ASSERT_ALWAYS_MSG(expr, msg) MPT_DO { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr, msg); } MPT_CHECKER_ASSUME(expr); } MPT_WHILE_0 #ifndef MPT_ASSERT_HANDLER_NEEDED #define MPT_ASSERT_HANDLER_NEEDED #endif @@ -368,7 +385,7 @@ #elif MPT_COMPILER_CLANG #define MPT_FALLTHROUGH [[clang::fallthrough]] #else -#define MPT_FALLTHROUGH do { } while(0) +#define MPT_FALLTHROUGH MPT_DO { } MPT_WHILE_0 #endif Modified: trunk/OpenMPT/soundlib/Load_mt2.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mt2.cpp 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/soundlib/Load_mt2.cpp 2015-06-13 11:59:24 UTC (rev 5297) @@ -553,7 +553,7 @@ switch(id) { case MAGIC4LE('B','P','M','+'): - if(0) + MPT_CONSTANT_IF(0) { double d = chunk.ReadDoubleLE(); if(fileHeader.samplesPerTick != 0 && d != 0.0) Modified: trunk/OpenMPT/soundlib/SampleFormatConverters.h =================================================================== --- trunk/OpenMPT/soundlib/SampleFormatConverters.h 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/soundlib/SampleFormatConverters.h 2015-06-13 11:59:24 UTC (rev 5297) @@ -639,7 +639,7 @@ forceinline output_t operator() (input_t val) { STATIC_ASSERT(fractionalBits >= 0 && fractionalBits <= sizeof(input_t)*8-1); - if(clipOutput) + MPT_CONSTANT_IF(clipOutput) { float32 out = val * factor; if(out < -1.0f) out = -1.0f; Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2015-06-13 11:59:24 UTC (rev 5297) @@ -2343,21 +2343,21 @@ { // Ramping required m_lHighResRampingGlobalVolume += step; - SoundBuffer[0] = Util::muldiv(SoundBuffer[0], m_lHighResRampingGlobalVolume, MAX_GLOBAL_VOLUME << VOLUMERAMPPRECISION); - if(isStereo) SoundBuffer[1] = Util::muldiv(SoundBuffer[1], m_lHighResRampingGlobalVolume, MAX_GLOBAL_VOLUME << VOLUMERAMPPRECISION); - if(hasRear) RearBuffer[0] = Util::muldiv(RearBuffer[0] , m_lHighResRampingGlobalVolume, MAX_GLOBAL_VOLUME << VOLUMERAMPPRECISION); - if(hasRear) RearBuffer[1] = Util::muldiv(RearBuffer[1] , m_lHighResRampingGlobalVolume, MAX_GLOBAL_VOLUME << VOLUMERAMPPRECISION); + SoundBuffer[0] = Util::muldiv(SoundBuffer[0], m_lHighResRampingGlobalVolume, MAX_GLOBAL_VOLUME << VOLUMERAMPPRECISION); + MPT_CONSTANT_IF(isStereo) SoundBuffer[1] = Util::muldiv(SoundBuffer[1], m_lHighResRampingGlobalVolume, MAX_GLOBAL_VOLUME << VOLUMERAMPPRECISION); + MPT_CONSTANT_IF(hasRear) RearBuffer[0] = Util::muldiv(RearBuffer[0] , m_lHighResRampingGlobalVolume, MAX_GLOBAL_VOLUME << VOLUMERAMPPRECISION); + MPT_CONSTANT_IF(hasRear) RearBuffer[1] = Util::muldiv(RearBuffer[1] , m_lHighResRampingGlobalVolume, MAX_GLOBAL_VOLUME << VOLUMERAMPPRECISION); m_nSamplesToGlobalVolRampDest--; } else { - SoundBuffer[0] = Util::muldiv(SoundBuffer[0], m_nGlobalVolume, MAX_GLOBAL_VOLUME); - if(isStereo) SoundBuffer[1] = Util::muldiv(SoundBuffer[1], m_nGlobalVolume, MAX_GLOBAL_VOLUME); - if(hasRear) RearBuffer[0] = Util::muldiv(RearBuffer[0] , m_nGlobalVolume, MAX_GLOBAL_VOLUME); - if(hasRear) RearBuffer[1] = Util::muldiv(RearBuffer[1] , m_nGlobalVolume, MAX_GLOBAL_VOLUME); + SoundBuffer[0] = Util::muldiv(SoundBuffer[0], m_nGlobalVolume, MAX_GLOBAL_VOLUME); + MPT_CONSTANT_IF(isStereo) SoundBuffer[1] = Util::muldiv(SoundBuffer[1], m_nGlobalVolume, MAX_GLOBAL_VOLUME); + MPT_CONSTANT_IF(hasRear) RearBuffer[0] = Util::muldiv(RearBuffer[0] , m_nGlobalVolume, MAX_GLOBAL_VOLUME); + MPT_CONSTANT_IF(hasRear) RearBuffer[1] = Util::muldiv(RearBuffer[1] , m_nGlobalVolume, MAX_GLOBAL_VOLUME); m_lHighResRampingGlobalVolume = m_nGlobalVolume << VOLUMERAMPPRECISION; } SoundBuffer += isStereo ? 2 : 1; - if(hasRear) RearBuffer += 2; + MPT_CONSTANT_IF(hasRear) RearBuffer += 2; } } Modified: trunk/OpenMPT/test/TestToolsLib.h =================================================================== --- trunk/OpenMPT/test/TestToolsLib.h 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/test/TestToolsLib.h 2015-06-13 11:59:24 UTC (rev 5297) @@ -224,7 +224,7 @@ #define DO_TEST(func) \ -do{ \ +MPT_DO { \ Test::Testcase test(Test::FatalityStop, Test::VerbosityVerbose, #func , MPT_TEST_CONTEXT_CURRENT() ); \ try { \ test.ShowStart(); \ @@ -237,7 +237,7 @@ } catch(...) { \ test.ReportException(); \ } \ -}while(0) +} MPT_WHILE_0 } // namespace Test Modified: trunk/OpenMPT/test/TestToolsTracker.h =================================================================== --- trunk/OpenMPT/test/TestToolsTracker.h 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/test/TestToolsTracker.h 2015-06-13 11:59:24 UTC (rev 5297) @@ -33,11 +33,11 @@ // Verify that given parameters are 'equal'. Break directly into the debugger if not. // The exact meaning of equality is based on operator!= . #define VERIFY_EQUAL(x,y) \ - do { \ + MPT_DO { \ if((x) != (y)) { \ MyDebugBreak(); \ } \ - } while(0) \ + } MPT_WHILE_0 \ /**/ // Like VERIFY_EQUAL, only differs for libopenmpt @@ -48,11 +48,11 @@ #define DO_TEST(func) \ - do { \ + MPT_DO { \ if(IsDebuggerPresent()) { \ func(); \ } \ - } while(0) \ + } MPT_WHILE_0 \ /**/ Modified: trunk/OpenMPT/test/test.cpp =================================================================== --- trunk/OpenMPT/test/test.cpp 2015-06-13 00:42:19 UTC (rev 5296) +++ trunk/OpenMPT/test/test.cpp 2015-06-13 11:59:24 UTC (rev 5297) @@ -932,19 +932,19 @@ _tcscpy(src_tchar, _T("ab")); #define MPT_TEST_PRINTF(dst_type, function, format, src_type) \ - do { \ + MPT_DO { \ MemsetZero(dst_ ## dst_type); \ function(dst_ ## dst_type, format, src_ ## src_type); \ VERIFY_EQUAL(std::memcmp(dst_ ## dst_type, src_ ## dst_type, 256), 0); \ - } while(0) \ + } MPT_WHILE_0 \ /**/ #define MPT_TEST_PRINTF_N(dst_type, function, format, src_type) \ - do { \ + MPT_DO { \ MemsetZero(dst_ ## dst_type); \ function(dst_ ## dst_type, 255, format, src_ ## src_type); \ VERIFY_EQUAL(std::memcmp(dst_ ## dst_type, src_ ## dst_type, 256), 0); \ - } while(0) \ + } MPT_WHILE_0 \ /**/ // CRT narrow This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |