From 204d0c8572a6397fc0ac778d991f5b7432caea1c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 26 Apr 2016 05:55:18 -0700 Subject: [PATCH] Don't try to define __try/__except on non-MSVC systems They didn't do anything anyway, and can clash with other compilers since they may be used internally (macros and keywords starting with __ are for compiler use). --- src/sound/except.h | 15 +-------------- src/sound/fmodsound.cpp | 4 ++-- src/sound/mpg123_decoder.cpp | 11 ++++++----- src/sound/sndfile_decoder.cpp | 11 ++++++----- 4 files changed, 15 insertions(+), 26 deletions(-) diff --git a/src/sound/except.h b/src/sound/except.h index 023ddb6d4b..f6bef4fc69 100644 --- a/src/sound/except.h +++ b/src/sound/except.h @@ -23,19 +23,6 @@ inline int CheckException(DWORD code) return EXCEPTION_CONTINUE_SEARCH; } - -#else - -#ifdef __try -#undef __try -#endif -#define __try - -#ifdef __except -#undef __except -#endif -#define __except(a) if (0) - #endif -#endif \ No newline at end of file +#endif diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index a62998d3da..3d0f0ba67a 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -3192,8 +3192,8 @@ bool IsFModExPresent() { #ifdef NO_FMOD return false; -#elif !defined _WIN32 - return true; // on non-Windows we cannot delay load the library so it has to be present. +#elif !defined _MSC_VER + return true; // on non-MSVC we cannot delay load the library so it has to be present. #else static bool cached_result; static bool done = false; diff --git a/src/sound/mpg123_decoder.cpp b/src/sound/mpg123_decoder.cpp index 4deab7e5b7..9d1fff97ec 100644 --- a/src/sound/mpg123_decoder.cpp +++ b/src/sound/mpg123_decoder.cpp @@ -56,17 +56,18 @@ bool MPG123Decoder::open(FileReader *reader) { if(!inited) { - __try - { +#ifdef _MSC_VER + __try { +#endif if(mpg123_init() != MPG123_OK) return false; inited = true; - } - __except (CheckException(GetExceptionCode())) - { +#ifdef _MSC_VER + } __except (CheckException(GetExceptionCode())) { // this means that the delay loaded decoder DLL was not found. return false; } +#endif } Reader = reader; diff --git a/src/sound/sndfile_decoder.cpp b/src/sound/sndfile_decoder.cpp index 382b22ab6e..b0c35c2a0c 100644 --- a/src/sound/sndfile_decoder.cpp +++ b/src/sound/sndfile_decoder.cpp @@ -54,8 +54,9 @@ SndFileDecoder::~SndFileDecoder() bool SndFileDecoder::open(FileReader *reader) { - __try - { +#ifdef _MSC_VER + __try { +#endif SF_VIRTUAL_IO sfio = { file_get_filelen, file_seek, file_read, file_write, file_tell }; Reader = reader; @@ -68,11 +69,11 @@ bool SndFileDecoder::open(FileReader *reader) sf_close(SndFile); SndFile = 0; } - } - __except (CheckException(GetExceptionCode())) - { +#ifdef _MSC_VER + } __except (CheckException(GetExceptionCode())) { // this means that the delay loaded decoder DLL was not found. } +#endif return false; }