From cdf6fa3702d118250e75c63641945cbb2c668a23 Mon Sep 17 00:00:00 2001 From: dhewg Date: Thu, 22 Dec 2011 03:02:29 +0100 Subject: [PATCH] New define IDSTR_NO_REDIRECT The defines in idlib/Str.h won't be set to redirect the low level c string functions to idStr when IDSTR_NO_REDIRECT is set. Fixes compilation for MSVC: error C2761: 'Cmp' : member function redeclaration not allowed Reported by spiral. --- neo/idlib/Str.h | 2 ++ neo/sys/cpu.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/neo/idlib/Str.h b/neo/idlib/Str.h index 9b2d1030..35d037c3 100644 --- a/neo/idlib/Str.h +++ b/neo/idlib/Str.h @@ -40,6 +40,7 @@ If you have questions concerning this license or the applicable additional terms */ // these library functions should not be used for cross platform compatibility +#ifndef IDSTR_NO_REDIRECT #define strcmp idStr::Cmp // use_idStr_Cmp #define strncmp use_idStr_Cmpn @@ -76,6 +77,7 @@ If you have questions concerning this license or the applicable additional terms #define _snprintf use_idStr_snPrintf #define vsnprintf use_idStr_vsnPrintf #define _vsnprintf use_idStr_vsnPrintf +#endif class idVec4; diff --git a/neo/sys/cpu.cpp b/neo/sys/cpu.cpp index 4baf53c4..507b79ed 100644 --- a/neo/sys/cpu.cpp +++ b/neo/sys/cpu.cpp @@ -28,6 +28,9 @@ If you have questions concerning this license or the applicable additional terms #include +// MSVC header intrin.h uses strcmp and errors out when not set +#define IDSTR_NO_REDIRECT + #include "sys/platform.h" #include "framework/Common.h"