From: <man...@us...> - 2015-05-23 11:04:49
|
Revision: 5140 http://sourceforge.net/p/modplug/code/5140 Author: manxorist Date: 2015-05-23 11:04:43 +0000 (Sat, 23 May 2015) Log Message: ----------- [Ref] Work-around MSVC LNK4221 warning: "no public symbols found; archive member will be inaccessible" by introducing a dummy symbol in the affected compilation units. Modified Paths: -------------- trunk/OpenMPT/common/AudioCriticalSection.cpp trunk/OpenMPT/common/Profiler.cpp trunk/OpenMPT/common/mptFileIO.cpp trunk/OpenMPT/common/stdafx.cpp trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/Tagging.cpp Modified: trunk/OpenMPT/common/AudioCriticalSection.cpp =================================================================== --- trunk/OpenMPT/common/AudioCriticalSection.cpp 2015-05-23 10:32:25 UTC (rev 5139) +++ trunk/OpenMPT/common/AudioCriticalSection.cpp 2015-05-23 11:04:43 UTC (rev 5140) @@ -16,6 +16,8 @@ #ifdef MODPLUG_TRACKER CRITICAL_SECTION g_csAudio; int g_csAudioLockCount = 0; +#else +MPT_MSVC_WORKAROUND_LNK4221(AudioCriticalSection) #endif OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/common/Profiler.cpp =================================================================== --- trunk/OpenMPT/common/Profiler.cpp 2015-05-23 10:32:25 UTC (rev 5139) +++ trunk/OpenMPT/common/Profiler.cpp 2015-05-23 11:04:43 UTC (rev 5140) @@ -211,6 +211,10 @@ } +#else // !USE_PROFILER + +MPT_MSVC_WORKAROUND_LNK4221(Profiler) + #endif // USE_PROFILER Modified: trunk/OpenMPT/common/mptFileIO.cpp =================================================================== --- trunk/OpenMPT/common/mptFileIO.cpp 2015-05-23 10:32:25 UTC (rev 5139) +++ trunk/OpenMPT/common/mptFileIO.cpp 2015-05-23 11:04:43 UTC (rev 5140) @@ -220,6 +220,10 @@ #endif +#else // !MPT_WITH_FILEIO + +MPT_MSVC_WORKAROUND_LNK4221(mptFileIO) + #endif // MPT_WITH_FILEIO Modified: trunk/OpenMPT/common/stdafx.cpp =================================================================== --- trunk/OpenMPT/common/stdafx.cpp 2015-05-23 10:32:25 UTC (rev 5139) +++ trunk/OpenMPT/common/stdafx.cpp 2015-05-23 11:04:43 UTC (rev 5140) @@ -11,3 +11,10 @@ #include "stdafx.h" + + +OPENMPT_NAMESPACE_BEGIN + +MPT_MSVC_WORKAROUND_LNK4221(stdafx) + +OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2015-05-23 10:32:25 UTC (rev 5139) +++ trunk/OpenMPT/common/typedefs.h 2015-05-23 11:04:43 UTC (rev 5140) @@ -581,4 +581,25 @@ +#if MPT_COMPILER_MSVC +// warning LNK4221: no public symbols found; archive member will be inaccessible +// There is no way to selectively disable linker warnings. +// #pragma warning does not apply and a command line option does not exist. +// Some options: +// 1. Macro which generates a variable with a unique name for each file (which means we have to pass the filename to the macro) +// 2. unnamed namespace containing any symbol (does not work for c++11 compilers because they actually have internal linkage now) +// 3. An unused trivial inline function. +// Option 3 does not actually solve the problem though, which leaves us with option 1. +// In any case, for optimized builds, the linker will just remove the useless symbol. +#define MPT_MSVC_WORKAROUND_LNK4221_CONCAT_DETAIL(x,y) x##y +#define MPT_MSVC_WORKAROUND_LNK4221_CONCAT(x,y) MPT_MSVC_WORKAROUND_LNK4221_CONCAT_DETAIL(x,y) +#define MPT_MSVC_WORKAROUND_LNK4221(x) int MPT_MSVC_WORKAROUND_LNK4221_CONCAT(mpt_msvc_workaround_lnk4221_,x) = 0; +#endif + +#ifndef MPT_MSVC_WORKAROUND_LNK4221 +#define MPT_MSVC_WORKAROUND_LNK4221(x) +#endif + + + OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2015-05-23 10:32:25 UTC (rev 5139) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2015-05-23 11:04:43 UTC (rev 5140) @@ -1994,6 +1994,10 @@ } +#else // !MODPLUG_TRACKER + +MPT_MSVC_WORKAROUND_LNK4221(Dlsbank) + #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/soundlib/Tagging.cpp =================================================================== --- trunk/OpenMPT/soundlib/Tagging.cpp 2015-05-23 10:32:25 UTC (rev 5139) +++ trunk/OpenMPT/soundlib/Tagging.cpp 2015-05-23 11:04:43 UTC (rev 5140) @@ -22,6 +22,10 @@ encoder = mpt::ToUnicode(mpt::CharsetASCII, MptVersion::GetOpenMPTVersionStr()); } +#else // MODPLUG_NO_FILESAVE + +MPT_MSVC_WORKAROUND_LNK4221(Tagging) + #endif // MODPLUG_NO_FILESAVE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |