Skip to content

Commit 0ba3847

Browse files
sunyabpixar-oss
authored andcommitted
build: Silence C4996 warnings on Visual Studio due to legacy TBB
The containers in TBB versions prior to oneTBB use iterators that derive from std::iterator. This causes Visual Studio to issue a STL4015 warning noting that std::iterator is deprecated in C++17. Since this warning is due to third-party code, we can't do much about it, so we just silence the warning in our build configuration. This removes 33 out of 63 warnings. Note that these warnings show up even though CMake is (AFAICT) using Visual Studio's /external feature to disable warnings from external headers. Not sure what's going on there... (Internal change: 2389464)
1 parent 45291c6 commit 0ba3847

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

cmake/defaults/msvcdefaults.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ _add_define("_CRT_SECURE_NO_WARNINGS")
9191
# std::copy, std::equal, et al.
9292
_add_define("_SCL_SECURE_NO_WARNINGS")
9393

94+
# Disable warning C4996 regarding use of std::iterator as a base class.
95+
# This warning is emitted from legacy TBB's containers/iterators.
96+
_add_define("_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING")
97+
9498
# Make sure WinDef.h does not define min and max macros which
9599
# will conflict with std::min() and std::max().
96100
_add_define("NOMINMAX")

0 commit comments

Comments
 (0)