From: <man...@us...> - 2015-06-13 16:51:51
|
Revision: 5312 http://sourceforge.net/p/modplug/code/5312 Author: manxorist Date: 2015-06-13 16:51:44 +0000 (Sat, 13 Jun 2015) Log Message: ----------- [Ref] Add MPT_ASSERT_NOTREACHED(). Modified Paths: -------------- trunk/OpenMPT/common/mptIO.h trunk/OpenMPT/common/mptString.cpp trunk/OpenMPT/common/mptTime.cpp trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp trunk/OpenMPT/soundlib/ITCompression.cpp trunk/OpenMPT/soundlib/Load_okt.cpp trunk/OpenMPT/soundlib/Load_umx.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/WAVTools.cpp trunk/OpenMPT/soundlib/tuning.cpp Modified: trunk/OpenMPT/common/mptIO.h =================================================================== --- trunk/OpenMPT/common/mptIO.h 2015-06-13 16:44:01 UTC (rev 5311) +++ trunk/OpenMPT/common/mptIO.h 2015-06-13 16:51:44 UTC (rev 5312) @@ -298,7 +298,7 @@ return IO::WriteIntLE<uint16>(f, static_cast<uint16>(v << 1) | 0x01); } else { - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); return false; } } @@ -328,7 +328,7 @@ return IO::WriteIntLE<uint32>(f, static_cast<uint32>(v << 2) | 0x03); } else { - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); return false; } } @@ -353,7 +353,7 @@ return IO::WriteIntLE<uint64>(f, static_cast<uint64>(v << 2) | 0x03); } else { - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); return false; } } Modified: trunk/OpenMPT/common/mptString.cpp =================================================================== --- trunk/OpenMPT/common/mptString.cpp 2015-06-13 16:44:01 UTC (rev 5311) +++ trunk/OpenMPT/common/mptString.cpp 2015-06-13 16:51:44 UTC (rev 5312) @@ -684,7 +684,7 @@ { // nothing } - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); return String::FromAscii(str, replacement); // fallback } @@ -715,7 +715,7 @@ { // nothing } - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); return String::ToAscii(str, replacement); // fallback } Modified: trunk/OpenMPT/common/mptTime.cpp =================================================================== --- trunk/OpenMPT/common/mptTime.cpp 2015-06-13 16:44:01 UTC (rev 5311) +++ trunk/OpenMPT/common/mptTime.cpp 2015-06-13 16:51:44 UTC (rev 5312) @@ -227,7 +227,7 @@ if(timeEndPeriod(m_CurrentPeriod) != MMSYSERR_NOERROR) { // should not happen - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); } m_CurrentPeriod = 0; } Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2015-06-13 16:44:01 UTC (rev 5311) +++ trunk/OpenMPT/common/typedefs.h 2015-06-13 16:51:44 UTC (rev 5312) @@ -325,6 +325,7 @@ #if defined(MPT_FRAMEWORK_ASSERT_IS_DEFINED) && (MPT_ASSERT_USE_FRAMEWORK == 1) +#define MPT_ASSERT_NOTREACHED() ASSERT(0) #define MPT_ASSERT(expr) ASSERT((expr)) #define MPT_ASSERT_MSG(expr, msg) ASSERT((expr) && (msg)) #if (MPT_FRAMEWORK_ASSERT_IS_ACTIVE == 1) @@ -340,6 +341,7 @@ #elif defined(NO_ASSERTS) +#define MPT_ASSERT_NOTREACHED() MPT_CHECKER_ASSUME(0) #define MPT_ASSERT(expr) MPT_CHECKER_ASSUME(expr) #define MPT_ASSERT_MSG(expr, msg) MPT_CHECKER_ASSUME(expr) #define MPT_ASSERT_ALWAYS(expr) MPT_DO { if(!(expr)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, #expr); } MPT_CHECKER_ASSUME(expr); } MPT_WHILE_0 @@ -350,6 +352,7 @@ #else // !NO_ASSERTS +#define MPT_ASSERT_NOTREACHED() MPT_DO { MPT_CONSTANT_IF(!(0)) { AssertHandler(__FILE__, __LINE__, __FUNCTION__, "0"); } MPT_CHECKER_ASSUME(0); } MPT_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 Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2015-06-13 16:44:01 UTC (rev 5311) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2015-06-13 16:51:44 UTC (rev 5312) @@ -375,7 +375,7 @@ } } else { // should not happen - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); } m_BufferInfo.resize(m_Settings.GetTotalChannels()); @@ -932,7 +932,7 @@ CopyChannelToInterleaved<SC::Convert<float, double> >(dstFloat, reinterpret_cast<double*>(src), inputChannels, countChunk, inputChannel); break; default: - ASSERT(false); + MPT_ASSERT_NOTREACHED(); break; } } else if(m_Settings.sampleFormat == SampleFormatInt16) @@ -952,7 +952,7 @@ CopyChannelToInterleaved<SC::Convert<int16, int16> >(dstInt16, reinterpret_cast<int16*>(src), inputChannels, countChunk, inputChannel); break; default: - ASSERT(false); + MPT_ASSERT_NOTREACHED(); break; } } else if(m_Settings.sampleFormat == SampleFormatInt24) @@ -972,7 +972,7 @@ CopyChannelToInterleaved<SC::Convert<int24, int24> >(dstInt24, reinterpret_cast<int24*>(src), inputChannels, countChunk, inputChannel); break; default: - ASSERT(false); + MPT_ASSERT_NOTREACHED(); break; } } else if(m_Settings.sampleFormat == SampleFormatInt32) @@ -1024,12 +1024,12 @@ CopyChannelToInterleaved<SC::ConvertShiftUp<int32, int32, 8> >(dstInt32, reinterpret_cast<int32*>(src), inputChannels, countChunk, inputChannel); break; default: - ASSERT(false); + MPT_ASSERT_NOTREACHED(); break; } } else { - ASSERT(false); + MPT_ASSERT_NOTREACHED(); } } if(rendersilence) @@ -1048,7 +1048,7 @@ std::memset(&m_SampleBufferInt32[0], 0, countChunk * outputChannels * sizeof(int32)); } else { - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); } } else { @@ -1067,7 +1067,7 @@ SourceAudioRead(&m_SampleBufferInt32[0], (m_SampleInputBufferInt32.size() > 0) ? &m_SampleInputBufferInt32[0] : nullptr, countChunk); } else { - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); } } for(std::size_t outputChannel = 0; outputChannel < outputChannels; ++outputChannel) @@ -1093,7 +1093,7 @@ CopyInterleavedToChannel<SC::Convert<double, float> >(reinterpret_cast<double*>(dst), srcFloat, outputChannels, countChunk, outputChannel); break; default: - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); break; } } else if(m_Settings.sampleFormat == SampleFormatInt16) @@ -1106,7 +1106,7 @@ CopyInterleavedToChannel<SC::Convert<int16, int16> >(reinterpret_cast<int16*>(dst), srcInt16, outputChannels, countChunk, outputChannel); break; default: - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); break; } } else if(m_Settings.sampleFormat == SampleFormatInt24) @@ -1119,7 +1119,7 @@ CopyInterleavedToChannel<SC::Convert<int24, int24> >(reinterpret_cast<int24*>(dst), srcInt24, outputChannels, countChunk, outputChannel); break; default: - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); break; } } else if(m_Settings.sampleFormat == SampleFormatInt32) @@ -1164,12 +1164,12 @@ CopyInterleavedToChannel<SC::ConvertShift<int32, int32, 8> >(reinterpret_cast<int32*>(dst), srcInt32, outputChannels, countChunk, outputChannel); break; default: - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); break; } } else { - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); } if(IsSampleTypeBigEndian(m_ChannelInfo[channel].type)) { Modified: trunk/OpenMPT/soundlib/ITCompression.cpp =================================================================== --- trunk/OpenMPT/soundlib/ITCompression.cpp 2015-06-13 16:44:01 UTC (rev 5311) +++ trunk/OpenMPT/soundlib/ITCompression.cpp 2015-06-13 16:51:44 UTC (rev 5312) @@ -305,7 +305,7 @@ } else { // How could this happen, anyway? - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); } } Modified: trunk/OpenMPT/soundlib/Load_okt.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_okt.cpp 2015-06-13 16:44:01 UTC (rev 5311) +++ trunk/OpenMPT/soundlib/Load_okt.cpp 2015-06-13 16:51:44 UTC (rev 5312) @@ -274,7 +274,7 @@ default: m->command = m->param = 0; - //MPT_ASSERT(false); + //MPT_ASSERT_NOTREACHED(); break; } } Modified: trunk/OpenMPT/soundlib/Load_umx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_umx.cpp 2015-06-13 16:44:01 UTC (rev 5311) +++ trunk/OpenMPT/soundlib/Load_umx.cpp 2015-06-13 16:51:44 UTC (rev 5312) @@ -273,7 +273,7 @@ // Can't bother to implement property reading, as no UMX files I've seen so far use properties for the relevant objects, // and only the UAX files in the Unreal 1997/98 beta seem to use this and still load just fine when ignoring it. // If it should be necessary to implement this, check CUnProperty.cpp in http://ut-files.com/index.php?dir=Utilities/&file=utcms_source.zip - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); continue; } #else Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2015-06-13 16:44:01 UTC (rev 5311) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2015-06-13 16:51:44 UTC (rev 5312) @@ -2431,7 +2431,7 @@ SampleToFLAC32(sampleData, sample.pSample16, numSamples); } else { - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); } // Do the actual conversion. Modified: trunk/OpenMPT/soundlib/WAVTools.cpp =================================================================== --- trunk/OpenMPT/soundlib/WAVTools.cpp 2015-06-13 16:44:01 UTC (rev 5311) +++ trunk/OpenMPT/soundlib/WAVTools.cpp 2015-06-13 16:51:44 UTC (rev 5312) @@ -400,7 +400,7 @@ } else { // Should never happen - did we calculate a wrong memory size? - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); } } position += numBytes; Modified: trunk/OpenMPT/soundlib/tuning.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuning.cpp 2015-06-13 16:44:01 UTC (rev 5311) +++ trunk/OpenMPT/soundlib/tuning.cpp 2015-06-13 16:51:44 UTC (rev 5312) @@ -261,7 +261,7 @@ if(GetType() == TT_GROUPGEOMETRIC) return m_RatioTableFine[GetRefNote(note) * GetFineStepCount() + sd - 1]; - MPT_ASSERT(false); + MPT_ASSERT_NOTREACHED(); return m_RatioTableFine[0]; //Shouldn't happen. } else //Calculating ratio 'on the fly'. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |