Commit: 626a79204ee2a9023cca1f7b9dfd88aa8d25cfc6 Author: Ray Molenkamp Date: Tue Nov 10 08:48:18 2020 -0700 Branches: master https://developer.blender.org/rB626a79204ee2a9023cca1f7b9dfd88aa8d25cfc6
MSVC: Fix build warning If a define of NOMINMAX was made before BLI_task.hh was included, the compiler would emit a warning C4005: 'NOMINMAX': macro redefinition warning, to work around this only define it if it is not already defined, and only undefine it if we were the ones that made the define earlier. =================================================================== M source/blender/blenlib/BLI_task.hh =================================================================== diff --git a/source/blender/blenlib/BLI_task.hh b/source/blender/blenlib/BLI_task.hh index 8a0d77745c8..0da03d84793 100644 --- a/source/blender/blenlib/BLI_task.hh +++ b/source/blender/blenlib/BLI_task.hh @@ -24,16 +24,20 @@ /* Quiet top level deprecation message, unrelated to API usage here. */ # define TBB_SUPPRESS_DEPRECATED_MESSAGES 1 -# ifdef WIN32 +# if defined(WIN32) && !defined(NOMINMAX) /* TBB includes Windows.h which will define min/max macros causing issues * when we try to use std::min and std::max later on. */ # define NOMINMAX +# define TBB_MIN_MAX_CLEANUP # endif # include <tbb/tbb.h> # ifdef WIN32 -/* We cannot keep this defined, since other parts of the code deal with this on their own leading - * to multiple define warnings unless we un-define this. */ -# undef NOMINMAX +/* We cannot keep this defined, since other parts of the code deal with this on their own, leading + * to multiple define warnings unless we un-define this, however we can only undefine this if we + * were the ones that made the definition earlier. */ +# ifdef TBB_MIN_MAX_CLEANUP +# undef NOMINMAX +# endif # endif #endif _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
