From: <man...@us...> - 2013-05-19 20:14:04
|
Revision: 2137 http://sourceforge.net/p/modplug/code/2137 Author: manxorist Date: 2013-05-19 20:13:48 +0000 (Sun, 19 May 2013) Log Message: ----------- [Ref] Wrap _MSC_VER and __GNUC__ compiler detection macros into MPT_COMPILER_MSVC and MPT_COMPILER_GCC. Also provide detection macros for clang. This is useful because clang (and icc and probably others as well) try to emulate gcc or msvc and so they also define these respective macros in addition to their own. [Ref] Add MPT_[MSVC|GCC|CLANG]_AT_LEAST and MPT_[MSVC|GCC|CLANG]_BEFORE version test macros. [Ref] Replace all usages of native compiler macros with our own ones (except in openmpt123 (which does not use common/ infrastructure) and except in libopenmpt public header files (which should not depend on other compilcated stuff); Also leave libopenmpt itself alone for now because only libopenmpt_impl.hpp should depend on anything directly from the openmpt source base.). [Ref] Remove dead code in stdafx.cpp while at it. Modified Paths: -------------- trunk/OpenMPT/common/BuildSettings.h trunk/OpenMPT/common/misc_util.h trunk/OpenMPT/common/mptString.cpp trunk/OpenMPT/common/mptString.h trunk/OpenMPT/common/stdafx.cpp trunk/OpenMPT/common/stdafx.h trunk/OpenMPT/common/typedefs.cpp trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters trunk/OpenMPT/sounddsp/DSP.cpp trunk/OpenMPT/soundlib/Endianness.h trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Load_mdl.cpp trunk/OpenMPT/soundlib/Load_ptm.cpp trunk/OpenMPT/soundlib/Load_stm.cpp trunk/OpenMPT/soundlib/ModChannel.h trunk/OpenMPT/soundlib/SampleIO.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/load_j2b.cpp trunk/OpenMPT/soundlib/tuningbase.h trunk/OpenMPT/unarchiver/unlha.cpp Added Paths: ----------- trunk/OpenMPT/common/CompilerDetect.h Modified: trunk/OpenMPT/common/BuildSettings.h =================================================================== --- trunk/OpenMPT/common/BuildSettings.h 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/common/BuildSettings.h 2013-05-19 20:13:48 UTC (rev 2137) @@ -12,6 +12,10 @@ +#include "CompilerDetect.h" + + + // Do not use precompiled headers (prevents include of commonly used headers in stdafx.h) #ifdef MODPLUG_TRACKER //#define NO_PCH @@ -25,7 +29,7 @@ #define ENABLE_ASM // inline assembly requires MSVC compiler -#if defined(ENABLE_ASM) && defined(_MSC_VER) && defined(_M_IX86) +#if defined(ENABLE_ASM) && MPT_COMPILER_MSVC && defined(_M_IX86) // Generate general x86 inline assembly. #define ENABLE_X86 @@ -146,12 +150,12 @@ -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif #ifdef _WIN32 -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#if MPT_COMPILER_MSVC && MPT_MSVC_AT_LEAST(2010,0) #define _WIN32_WINNT 0x0501 // _WIN32_WINNT_WINXP #else #define _WIN32_WINNT 0x0500 // _WIN32_WINNT_WIN2000 @@ -191,7 +195,7 @@ #endif -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #define _CRT_SECURE_NO_WARNINGS // Define to disable the "This function or variable may be unsafe" warnings. #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1 #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT 1 Added: trunk/OpenMPT/common/CompilerDetect.h =================================================================== --- trunk/OpenMPT/common/CompilerDetect.h (rev 0) +++ trunk/OpenMPT/common/CompilerDetect.h 2013-05-19 20:13:48 UTC (rev 2137) @@ -0,0 +1,76 @@ +/* + * CompilerDetect.h + * ---------------- + * Purpose: Detect current compiler and provide readable version test macros. + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + + +#pragma once + + + +#define MPT_COMPILER_MAKE_VERSION2(version,sp) ((version) * 100 + (sp)) +#define MPT_COMPILER_MAKE_VERSION3(major,minor,patch) ((major) * 10000 + (minor) * 100 + (patch)) + + + +#if defined(__clang__) + +#define MPT_COMPILER_CLANG 1 +#define MPT_COMPILER_CLANG_VERSION MPT_COMPILER_MAKE_VERSION3(__clang_major__,__clang_minor__,__clang_patchlevel__) +#define MPT_CLANG_AT_LEAST(major,minor,patch) (MPT_COMPILER_CLANG_VERSION >= MPT_COMPILER_MAKE_VERSION3((major),(minor),(patch))) +#define MPT_CLANG_BEFORE(major,minor,patch) (MPT_COMPILER_CLANG_VERSION < MPT_COMPILER_MAKE_VERSION3((major),(minor),(patch))) + +#if MPT_CLANG_BEFORE(3,0,0) +#pragma message "clang version 3.0 required" +#endif + +#elif defined(__GNUC__) + +#define MPT_COMPILER_GCC 1 +#define MPT_COMPILER_GCC_VERSION MPT_COMPILER_MAKE_VERSION3(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) +#define MPT_GCC_AT_LEAST(major,minor,patch) (MPT_COMPILER_GCC_VERSION >= MPT_COMPILER_MAKE_VERSION3((major),(minor),(patch))) +#define MPT_GCC_BEFORE(major,minor,patch) (MPT_COMPILER_GCC_VERSION < MPT_COMPILER_MAKE_VERSION3((major),(minor),(patch))) + +#if MPT_CLANG_BEFORE(4,4,0) +#pragma message "GCC version 4.4 required" +#endif + +#elif defined(_MSC_VER) + +#define MPT_COMPILER_MSVC 1 +#if (_MSC_VER >= 1600) +#define MPT_COMPILER_MSVC_VERSION MPT_COMPILER_MAKE_VERSION2(2010,0) +#elif (_MSC_VER >= 1500) +#define MPT_COMPILER_MSVC_VERSION MPT_COMPILER_MAKE_VERSION2(2008,0) +#else +#define MPT_COMPILER_MSVC_VERSION MPT_COMPILER_MAKE_VERSION2(2005,0) +#endif +#define MPT_MSVC_AT_LEAST(version,sp) (MPT_COMPILER_MSVC_VERSION >= MPT_COMPILER_MAKE_VERSION2((version),(sp))) +#define MPT_MSVC_BEFORE(version,sp) (MPT_COMPILER_MSVC_VERSION < MPT_COMPILER_MAKE_VERSION2((version),(sp))) + +#if MPT_MSVC_BEFORE(2008,0) +#error "MSVC version 2008 required" +#endif + +#else + +// unsupported compiler +char mpt_unsupported_compiler[-1]; + +#endif + + + +#ifndef MPT_COMPILER_CLANG +#define MPT_COMPILER_CLANG 0 +#endif +#ifndef MPT_COMPILER_GCC +#define MPT_COMPILER_GCC 0 +#endif +#ifndef MPT_COMPILER_MSVC +#define MPT_COMPILER_MSVC 0 +#endif Property changes on: trunk/OpenMPT/common/CompilerDetect.h ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-chdr \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/OpenMPT/common/misc_util.h =================================================================== --- trunk/OpenMPT/common/misc_util.h 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/common/misc_util.h 2013-05-19 20:13:48 UTC (rev 2137) @@ -53,7 +53,7 @@ return static_cast<T>(atof(str)); } -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #define cxx11_strtoll _strtoi64 #define cxx11_strtoull _strtoui64 #else Modified: trunk/OpenMPT/common/mptString.cpp =================================================================== --- trunk/OpenMPT/common/mptString.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/common/mptString.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -19,7 +19,7 @@ // Formats this string, like CString::Format. void String::Format(const CharT* pszFormat, ...) { - #ifdef _MSC_VER + #if MPT_COMPILER_MSVC va_list argList; va_start( argList, pszFormat ); Modified: trunk/OpenMPT/common/mptString.h =================================================================== --- trunk/OpenMPT/common/mptString.h 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/common/mptString.h 2013-05-19 20:13:48 UTC (rev 2137) @@ -11,7 +11,7 @@ #pragma once #include <string> -#ifdef __GNUC__ +#if MPT_COMPILER_GCC || MPT_COMPILER_CLANG #include <strings.h> // for strcasecmp #endif @@ -30,7 +30,7 @@ String(const std::string& other) : BaseClass(other) {} // Move constructors and move assignments. - #if (_MSC_VER >= MSVC_VER_2010) + #if defined(MPT_COMPILER_HAS_RVALUE_REF) String(BaseClass&& str) : BaseClass(std::move(str)) {} String(String&& other) : BaseClass(std::move(static_cast<BaseClass&>(other))) {} String& operator=(BaseClass&& str) {BaseClass::operator=(std::move(str)); return *this;} @@ -93,7 +93,7 @@ static inline int mpt_strnicmp(const char *a, const char *b, size_t count) { - #ifdef _MSC_VER + #if MPT_COMPILER_MSVC return _strnicmp(a, b, count); #else return strncasecmp(a, b, count); Modified: trunk/OpenMPT/common/stdafx.cpp =================================================================== --- trunk/OpenMPT/common/stdafx.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/common/stdafx.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -11,34 +11,3 @@ #include "stdafx.h" - -/*#if (_MSC_VER == MSVC_VER_2008) - -// Fix for VS2008 SP1 bloatage (http://tedwvc.wordpress.com/2011/04/16/static-mfc-code-bloat-problem-from-vc2010-is-now-in-vc2008-sp1security-fix/): - -// this is our own local copy of the AfxLoadSystemLibraryUsingFullPath function -HMODULE AfxLoadSystemLibraryUsingFullPath(const WCHAR *pszLibrary) -{ - WCHAR wszLoadPath[MAX_PATH+1]; - if (::GetSystemDirectoryW(wszLoadPath, _countof(wszLoadPath)) == 0) - { - return NULL; - } - - if (wszLoadPath[wcslen(wszLoadPath)-1] != L'\\') - { - if (wcscat_s(wszLoadPath, _countof(wszLoadPath), L"\\") != 0) - { - return NULL; - } - } - - if (wcscat_s(wszLoadPath, _countof(wszLoadPath), pszLibrary) != 0) - { - return NULL; - } - - return(::AfxCtxLoadLibraryW(wszLoadPath)); -} - -#endif*/ Modified: trunk/OpenMPT/common/stdafx.h =================================================================== --- trunk/OpenMPT/common/stdafx.h 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/common/stdafx.h 2013-05-19 20:13:48 UTC (rev 2137) @@ -27,13 +27,13 @@ #include <windowsx.h> -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(disable:4201) #endif #include <mmsystem.h> #include <mmreg.h> #include <msacm.h> -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(default:4201) #endif Modified: trunk/OpenMPT/common/typedefs.cpp =================================================================== --- trunk/OpenMPT/common/typedefs.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/common/typedefs.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -57,7 +57,7 @@ #endif -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC int c99_vsnprintf(char *str, size_t size, const char *format, va_list args) { Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/common/typedefs.h 2013-05-19 20:13:48 UTC (rev 2137) @@ -12,43 +12,42 @@ -// Definitions for MSVC versions to write more understandable conditional-compilation, -// e.g. #if (_MSC_VER > MSVC_VER_2008) instead of #if (_MSC_VER > 1500) -#define MSVC_VER_VC9 1500 -#define MSVC_VER_2008 MSVC_VER_VC9 -#define MSVC_VER_VC10 1600 -#define MSVC_VER_2010 MSVC_VER_VC10 +#if MPT_COMPILER_MSVC +#pragma warning(error : 4309) // Treat "truncation of constant value"-warning as error. +#endif -#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) - -#if defined(_MSC_VER) -#pragma warning(error : 4309) // Treat "truncation of constant value"-warning as error. +#if MPT_COMPILER_MSVC && MPT_MSVC_AT_LEAST(2010,0) +#define MPT_COMPILER_HAS_RVALUE_REF #endif -#if defined(_MSC_VER) && (_MSC_VER >= MSVC_VER_2010) +#if MPT_COMPILER_MSVC && MPT_MSVC_AT_LEAST(2010,0) #define HAS_TYPE_TRAITS #endif -#if defined(_MSC_VER) -#if (_MSC_VER < MSVC_VER_2010) - #define nullptr 0 +#if MPT_COMPILER_MSVC + +#if MPT_MSVC_BEFORE(2010,0) +#define nullptr 0 #endif -#elif defined(__GNUC__) -#if GCC_VERSION < 40600 + +#elif MPT_COMPILER_GCC + +#if MPT_GCC_BEFORE(4,6,0) #define nullptr 0 #endif + #endif // CountOf macro computes the number of elements in a statically-allocated array. -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #define CountOf(x) _countof(x) #else #define CountOf(x) (sizeof((x))/sizeof((x)[0])) @@ -56,28 +55,28 @@ -#if defined(_MSC_VER) +#if MPT_COMPILER_MSVC #define PACKED __declspec(align(1)) #define NEEDS_PRAGMA_PACK -#elif defined(__GNUC__) +#elif MPT_COMPILER_GCC || MPT_COMPILER_CLANG #define PACKED __attribute__((packed)) __attribute__((aligned(1))) #endif -#if defined(_MSC_VER) +#if MPT_COMPILER_MSVC #define ALIGN(n) __declspec(align(n)) -#elif defined(__GNUC__) +#elif MPT_COMPILER_GCC || MPT_COMPILER_CLANG #define ALIGN(n) __attribute__((aligned(n))) #endif // Advanced inline attributes -#if defined(_MSC_VER) +#if MPT_COMPILER_MSVC #define forceinline __forceinline #define noinline __declspec(noinline) -#elif defined(__GNUC__) +#elif MPT_COMPILER_GCC || MPT_COMPILER_CLANG #define forceinline __attribute__((always_inline)) inline #define noinline __attribute__((noinline)) #else @@ -89,9 +88,9 @@ // Some functions might be deprecated although they are still in use. // Tag them with "DEPRECATED". -#if defined(_MSC_VER) +#if MPT_COMPILER_MSVC #define DEPRECATED __declspec(deprecated) -#elif defined(__GNUC__) +#elif MPT_COMPILER_GCC || MPT_COMPILER_CLANG #define DEPRECATED __attribute__((deprecated)) #else #define DEPRECATED @@ -110,7 +109,7 @@ #include <memory> -#if defined(_MSC_VER) && (_MSC_VER <= MSVC_VER_2008) +#if MPT_COMPILER_MSVC && MPT_MSVC_BEFORE(2010,0) #define MPT_SHARED_PTR std::tr1::shared_ptr #else #define MPT_SHARED_PTR std::shared_ptr @@ -137,7 +136,7 @@ #endif // Compile time assert. -#if defined(_MSC_VER) && (_MSC_VER < MSVC_VER_2010) +#if MPT_COMPILER_MSVC && MPT_MSVC_BEFORE(2010,0) #define static_assert(expr, msg) typedef char OPENMPT_STATIC_ASSERT[(expr)?1:-1] #endif #define STATIC_ASSERT(expr) static_assert((expr), "compile time assertion failed: " #expr) @@ -145,7 +144,7 @@ #include <cstdarg> -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #ifndef va_copy #define va_copy(dst, src) do { (dst) = (src); } while (0) #endif @@ -153,7 +152,7 @@ -#if defined(_MSC_VER) && (_MSC_VER <= MSVC_VER_2008) +#if MPT_COMPILER_MSVC && MPT_MSVC_BEFORE(2010,0) typedef __int8 int8; typedef __int16 int16; @@ -284,7 +283,7 @@ #include <cstdio> #include <stdio.h> -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC int c99_vsnprintf(char *str, size_t size, const char *format, va_list args); int c99_snprintf(char *str, size_t size, const char *format, ...); #define snprintf c99_snprintf Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2013-05-19 20:13:48 UTC (rev 2137) @@ -319,6 +319,7 @@ <ItemGroup> <ClInclude Include="..\common\AudioCriticalSection.h" /> <ClInclude Include="..\common\BuildSettings.h" /> + <ClInclude Include="..\common\CompilerDetect.h" /> <ClInclude Include="..\common\FlagSet.h" /> <ClInclude Include="..\common\misc_util.h" /> <ClInclude Include="..\common\mptString.h" /> Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters 2013-05-19 20:13:48 UTC (rev 2137) @@ -207,6 +207,9 @@ <ClInclude Include="libopenmpt_stream_callbacks.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="..\common\CompilerDetect.h"> + <Filter>Header Files\common</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="..\common\AudioCriticalSection.cpp"> Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -58,14 +58,14 @@ CModDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass, CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass): CMultiDocTemplate(nIDResource, pDocClass, pFrameClass, pViewClass) {} - #if (_MSC_VER < MSVC_VER_2010) + #if MPT_COMPILER_MSVC && MPT_MSVC_BEFORE(2010,0) virtual CDocument* OpenDocumentFile(LPCTSTR path, BOOL makeVisible = TRUE); #else virtual CDocument* OpenDocumentFile(LPCTSTR path, BOOL addToMru = TRUE, BOOL makeVisible = TRUE); #endif }; -#if (_MSC_VER < MSVC_VER_2010) +#if MPT_COMPILER_MSVC && MPT_MSVC_BEFORE(2010,0) CDocument *CModDocTemplate::OpenDocumentFile(LPCTSTR path, BOOL makeVisible) #else CDocument *CModDocTemplate::OpenDocumentFile(LPCTSTR path, BOOL addToMru, BOOL makeVisible) @@ -87,7 +87,7 @@ } } - #if (_MSC_VER < MSVC_VER_2010) + #if MPT_COMPILER_MSVC && MPT_MSVC_BEFORE(2010,0) CDocument *pDoc = CMultiDocTemplate::OpenDocumentFile(path, makeVisible); #else CDocument *pDoc = CMultiDocTemplate::OpenDocumentFile(path, addToMru, makeVisible); @@ -617,7 +617,7 @@ CTrackApp::CTrackApp() //-------------------- { - #ifdef _MSC_VER + #if MPT_COMPILER_MSVC _CrtSetDebugFillThreshold(0); // Disable buffer filling in secure enhanced CRT functions. #endif Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/mptrack/Mptrack.h 2013-05-19 20:13:48 UTC (rev 2137) @@ -98,7 +98,7 @@ static MEMORYSTATUS gMemStatus; static std::vector<CDLSBank *> gpDLSBanks; -#if (_MSC_VER < MSVC_VER_2010) +#if MPT_COMPILER_MSVC && MPT_MSVC_BEFORE(2010,0) virtual CDocument* OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToMRU = TRUE) { CDocument* pDoc = CWinApp::OpenDocumentFile(lpszFileName); Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-05-19 20:13:48 UTC (rev 2137) @@ -841,6 +841,10 @@ > </File> <File + RelativePath="..\common\CompilerDetect.h" + > + </File> + <File RelativePath=".\ChildFrm.h" > </File> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-05-19 20:13:48 UTC (rev 2137) @@ -508,6 +508,7 @@ <ItemGroup> <ClInclude Include="..\common\AudioCriticalSection.h" /> <ClInclude Include="..\common\BuildSettings.h" /> + <ClInclude Include="..\common\CompilerDetect.h" /> <ClInclude Include="..\common\FlagSet.h" /> <ClInclude Include="..\common\Logging.h" /> <ClInclude Include="..\common\misc_util.h" /> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2013-05-19 20:13:48 UTC (rev 2137) @@ -915,6 +915,9 @@ <ClInclude Include="..\common\versionNumber.h"> <Filter>Header Files\common</Filter> </ClInclude> + <ClInclude Include="..\common\CompilerDetect.h"> + <Filter>Header Files\common</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="res\bitmap1.bmp"> Modified: trunk/OpenMPT/sounddsp/DSP.cpp =================================================================== --- trunk/OpenMPT/sounddsp/DSP.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/sounddsp/DSP.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -14,7 +14,7 @@ #include "../sounddsp/DSP.h" #include <math.h> -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(disable: 4725) // instruction may be inaccurate on some Pentiums #endif Modified: trunk/OpenMPT/soundlib/Endianness.h =================================================================== --- trunk/OpenMPT/soundlib/Endianness.h 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/soundlib/Endianness.h 2013-05-19 20:13:48 UTC (rev 2137) @@ -19,11 +19,11 @@ // endian architecture or value x in format of current architecture to little endian // format. -#ifdef __GNUC__ -#if GCC_VERSION >= 40300 +#if MPT_COMPILER_GCC +#if MPT_GCC_AT_LEAST(4,3,0) #define bswap32 __builtin_bswap32 #endif -#elif defined(_MSC_VER) +#elif MPT_COMPILER_MSVC #include <intrin.h> #define bswap16 _byteswap_ushort #define bswap32 _byteswap_ulong Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -1814,11 +1814,6 @@ } -#ifdef _MSC_VER -#pragma warning (disable:4100) -#endif - - #ifdef ENABLE_X86 static DWORD X86_Convert32To8(LPVOID lp16, int *pBuffer, DWORD lSampleCount) //-------------------------------------------------------------------------- @@ -2113,7 +2108,7 @@ ////////////////////////////////////////////////////////////////////////// // Noise Shaping (Dither) -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(disable:4731) // ebp modified #endif Modified: trunk/OpenMPT/soundlib/Load_mdl.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mdl.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/soundlib/Load_mdl.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -14,7 +14,7 @@ //#define MDL_LOG -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(disable:4244) //"conversion from 'type1' to 'type2', possible loss of data" #endif Modified: trunk/OpenMPT/soundlib/Load_ptm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ptm.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/soundlib/Load_ptm.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -13,7 +13,7 @@ #include "stdafx.h" #include "Loaders.h" -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(disable:4244) //"conversion from 'type1' to 'type2', possible loss of data" #endif Modified: trunk/OpenMPT/soundlib/Load_stm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_stm.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/soundlib/Load_stm.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -12,7 +12,7 @@ #include "stdafx.h" #include "Loaders.h" -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(disable:4244) //"conversion from 'type1' to 'type2', possible loss of data" #endif Modified: trunk/OpenMPT/soundlib/ModChannel.h =================================================================== --- trunk/OpenMPT/soundlib/ModChannel.h 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/soundlib/ModChannel.h 2013-05-19 20:13:48 UTC (rev 2137) @@ -12,7 +12,7 @@ class CSoundFile; -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(disable:4324) //structure was padded due to __declspec(align()) #endif @@ -204,6 +204,6 @@ } }; -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(default:4324) //structure was padded due to __declspec(align()) #endif Modified: trunk/OpenMPT/soundlib/SampleIO.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleIO.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/soundlib/SampleIO.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -23,7 +23,7 @@ extern int DMFUnpack(LPBYTE psample, const uint8 *ibuf, const uint8 *ibufmax, uint32 maxlen); -#if defined(__GNUC__) +#if MPT_COMPILER_GCC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wswitch" #endif @@ -397,7 +397,7 @@ return bytesRead; } -#if defined(__GNUC__) +#if MPT_COMPILER_GCC #pragma GCC diagnostic pop #endif Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -22,7 +22,7 @@ #include "tuning.h" #include "Tables.h" -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(disable:4244) #endif Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -384,7 +384,7 @@ CTuningCollection* CSoundFile::s_pTuningsSharedLocal(0); #endif -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(disable : 4355) // "'this' : used in base member initializer list" #endif CSoundFile::CSoundFile() : @@ -397,7 +397,7 @@ #endif visitedSongRows(*this), m_pCustomLog(nullptr) -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(default : 4355) // "'this' : used in base member initializer list" #endif //---------------------- Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-05-19 20:13:48 UTC (rev 2137) @@ -788,7 +788,7 @@ }; -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(default : 4324) //structure was padded due to __declspec(align()) #endif Modified: trunk/OpenMPT/soundlib/load_j2b.cpp =================================================================== --- trunk/OpenMPT/soundlib/load_j2b.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/soundlib/load_j2b.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -14,7 +14,7 @@ #include "stdafx.h" #include "Loaders.h" #include "ChunkReader.h" -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #ifndef ZLIB_WINAPI #define ZLIB_WINAPI #endif // ZLIB_WINAPI Modified: trunk/OpenMPT/soundlib/tuningbase.h =================================================================== --- trunk/OpenMPT/soundlib/tuningbase.h 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/soundlib/tuningbase.h 2013-05-19 20:13:48 UTC (rev 2137) @@ -37,11 +37,7 @@ namespace srlztn {class Ssb;}; -#ifdef _MSC_VER -#pragma warning(disable:4100) //"unreferenced formal parameter" -#endif - #ifdef BUILD_TUNINGBASE_AS_TEMPLATE #define CLASSTEMPLATEDEC template<class TNOTEINDEXTYPE = int16, class TUNOTEINDEXTYPE = uint16, class TRATIOTYPE = float32, class TSTEPINDEXTYPE = int32, class TUSTEPINDEXTYPE = uint32> #define TEMPLATEDEC template<class A, class B, class C, class D, class E> @@ -318,10 +314,6 @@ static void DefaultMessageHandler(const char*, const char*) {} }; -#ifdef _MSC_VER -#pragma warning(default:4100) //"unreferenced formal parameter" -#endif - #define NOTEINDEXTYPE_MIN (std::numeric_limits<NOTEINDEXTYPE>::min)() #define NOTEINDEXTYPE_MAX (std::numeric_limits<NOTEINDEXTYPE>::max)() #define UNOTEINDEXTYPE_MAX (std::numeric_limits<UNOTEINDEXTYPE>::max)() Modified: trunk/OpenMPT/unarchiver/unlha.cpp =================================================================== --- trunk/OpenMPT/unarchiver/unlha.cpp 2013-05-19 17:37:45 UTC (rev 2136) +++ trunk/OpenMPT/unarchiver/unlha.cpp 2013-05-19 20:13:48 UTC (rev 2137) @@ -15,7 +15,7 @@ #undef USHRT_MAX #undef SHRT_MIN -#ifdef _MSC_VER +#if MPT_COMPILER_MSVC #pragma warning(disable: 4244) // conversion from 'type1' to 'type2', possible loss of data #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |