From bcb7b119ae5240632b7f8b07f926c230f3c48daf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2022 12:26:48 +1000 Subject: [PATCH] Cleanup: remove workarounds and version checks for unsupported compilers Match minimum supported versions from the WIKI [0] by raising them to: - GCC 9.3.1 - CLANG 8.0 - MVCS 2019 (16.9.16 / 1928) Details: - Add CMake checks that ensure supported compiler versions early on. - Previously GCC per-processor version checks served to exclude `__clang__`, in some cases this has been replaced by explicitly excluding `__clang__`. This was needed as CLANG treated some of these flags differently to GCC, causing the build to fail. - Remove USE_APPLE_OMP_FIX GCC-4.2 OpenMP workaround. - Remove linking error workaround for old MSVC versions. [0]: https://wiki.blender.org/wiki/Building_Blender Reviewed by: brecht, LazyDodo Ref D16068 --- CMakeLists.txt | 64 +++++++++---------- build_files/cmake/macros.cmake | 2 - .../cmake/platform/platform_unix.cmake | 5 -- .../cmake/platform/platform_win32.cmake | 37 ++--------- extern/gflags/CMakeLists.txt | 4 +- intern/atomic/intern/atomic_ops_utils.h | 3 +- intern/atomic/tests/atomic_test.cc | 8 +-- source/blender/blenlib/BLI_assert.h | 2 +- source/blender/blenlib/BLI_compiler_attrs.h | 8 +-- .../blenlib/BLI_endian_switch_inline.h | 2 +- source/blender/blenlib/BLI_math_inline.h | 4 +- source/blender/blenlib/BLI_strict_flags.h | 10 +-- source/blender/blenlib/BLI_winstuff.h | 5 -- source/blender/blenlib/intern/threads.cc | 28 +------- .../imbuf/intern/openexr/openexr_api.cpp | 9 --- 15 files changed, 52 insertions(+), 139 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a48caa4eae..ef3309ded48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,6 +111,25 @@ blender_project_hack_post() enable_testing() +# ----------------------------------------------------------------------------- +# Test Compiler Support +# +# Keep in sync with: https://wiki.blender.org/wiki/Building_Blender + +if(CMAKE_COMPILER_IS_GNUCC) + if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "9.3.1") + message(FATAL_ERROR "The minimum supported version of GCC is 9.3.1") + endif() +elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") + if(CMAKE_COMPILER_IS_GNUCC AND ("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "8.0")) + message(FATAL_ERROR "The minimum supported version of CLANG is 8.0") + endif() +elseif(CMAKE_CXX_COMPILER_ID MATCHES MSVC) + if(MSVC_VERSION VERSION_LESS "1928") + message(FATAL_ERROR "The minimum supported version of MSVC is 2019 (16.9.16)") + endif() +endif() + # ----------------------------------------------------------------------------- # Test Compiler/Library Features @@ -1428,22 +1447,13 @@ if(CMAKE_COMPILER_IS_GNUCC) add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_NULL -Wnonnull) add_check_c_compiler_flag(C_WARNINGS C_WARN_ABSOLUTE_VALUE -Wabsolute-value) - # gcc 4.2 gives annoying warnings on every file with this - if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3") - add_check_c_compiler_flag(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized) - add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized) - endif() + add_check_c_compiler_flag(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized) + add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized) - # versions before gcc4.6 give many BLI_math warnings - if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.6") - add_check_c_compiler_flag(C_WARNINGS C_WARN_REDUNDANT_DECLS -Wredundant-decls) - add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_REDUNDANT_DECLS -Wredundant-decls) - endif() + add_check_c_compiler_flag(C_WARNINGS C_WARN_REDUNDANT_DECLS -Wredundant-decls) + add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_REDUNDANT_DECLS -Wredundant-decls) - # versions before gcc4.8 include global name-space. - if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.8") - add_check_c_compiler_flag(C_WARNINGS C_WARN_SHADOW -Wshadow) - endif() + add_check_c_compiler_flag(C_WARNINGS C_WARN_SHADOW -Wshadow) # disable because it gives warnings for printf() & friends. # add_check_c_compiler_flag(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion) @@ -1470,11 +1480,7 @@ if(CMAKE_COMPILER_IS_GNUCC) add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_FORMAT_SIGN -Wformat-signedness) add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_RESTRICT -Wrestrict) add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_SUGGEST_OVERRIDE -Wno-suggest-override) - - # gcc 4.2 gives annoying warnings on every file with this - if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3") - add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized) - endif() + add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized) # causes too many warnings if(NOT APPLE) @@ -1483,11 +1489,8 @@ if(CMAKE_COMPILER_IS_GNUCC) endif() # Use 'ATTR_FALLTHROUGH' macro to suppress. - if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0")) - add_check_c_compiler_flag(C_WARNINGS C_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5) - add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5) - endif() - + add_check_c_compiler_flag(C_WARNINGS C_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5) + add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5) # --------------------- # Suppress Strict Flags @@ -1517,9 +1520,7 @@ if(CMAKE_COMPILER_IS_GNUCC) add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable) add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_VARIABLE -Wno-uninitialized) - if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0")) - add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough) - endif() + add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough) if(NOT APPLE) add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable) @@ -1609,6 +1610,8 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") "/w34062" # switch statement contains 'default' but no 'case' labels "/w34115" # 'type' : named type definition in parentheses "/w34189" # local variable is initialized but not referenced + # see https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5038?view=vs-2017 + "/w35038" # order of initialization in c++ constructors # disable: "/wd4018" # signed/unsigned mismatch "/wd4146" # unary minus operator applied to unsigned type, result still unsigned @@ -1630,11 +1633,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") "/we4431" # missing type specifier - int assumed ) - if(MSVC_VERSION GREATER_EQUAL 1911) - # see https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5038?view=vs-2017 - string(APPEND _WARNINGS " /w35038") # order of initialization in c++ constructors - endif() - string(REPLACE ";" " " _WARNINGS "${_WARNINGS}") set(C_WARNINGS "${_WARNINGS}") set(CXX_WARNINGS "${_WARNINGS}") @@ -1686,7 +1684,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) # Make MSVC properly report the value of the __cplusplus preprocessor macro # Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless # of the C++ standard chosen above. -if(MSVC AND MSVC_VERSION GREATER 1913) +if(MSVC) string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus") endif() diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index d41024759fc..3acea19079b 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1190,8 +1190,6 @@ macro(openmp_delayload if(WITH_OPENMP) if(MSVC_CLANG) set(OPENMP_DLL_NAME "libomp") - elseif(MSVC_VERSION EQUAL 1800) - set(OPENMP_DLL_NAME "vcomp120") else() set(OPENMP_DLL_NAME "vcomp140") endif() diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index bfbc6b76b40..f640f7f7650 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -26,11 +26,6 @@ if(NOT DEFINED LIBDIR) else() set(WITH_LIBC_MALLOC_HOOK_WORKAROUND True) endif() - - if(CMAKE_COMPILER_IS_GNUCC AND - CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3) - message(FATAL_ERROR "GCC version must be at least 9.3 for precompiled libraries, found ${CMAKE_C_COMPILER_VERSION}") - endif() endif() # Avoid namespace pollustion. diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index eeec4760b80..866d0bede3d 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -74,27 +74,6 @@ add_definitions(-DWIN32) add_compile_options("$<$:/utf-8>") add_compile_options("$<$:/utf-8>") -# Minimum MSVC Version -if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) - if(MSVC_VERSION EQUAL 1800) - set(_min_ver "18.0.31101") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_min_ver}) - message(FATAL_ERROR - "Visual Studio 2013 (Update 4, ${_min_ver}) required, " - "found (${CMAKE_CXX_COMPILER_VERSION})") - endif() - endif() - if(MSVC_VERSION EQUAL 1900) - set(_min_ver "19.0.24210") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_min_ver}) - message(FATAL_ERROR - "Visual Studio 2015 (Update 3, ${_min_ver}) required, " - "found (${CMAKE_CXX_COMPILER_VERSION})") - endif() - endif() -endif() -unset(_min_ver) - # needed for some MSVC installations # 4099 : PDB 'filename' was not found with 'object/library' string(APPEND CMAKE_EXE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099") @@ -158,7 +137,7 @@ endif() # C++ standards conformace (/permissive-) is available on msvc 15.5 (1912) and up -if(MSVC_VERSION GREATER 1911 AND NOT MSVC_CLANG) +if(NOT MSVC_CLANG) string(APPEND CMAKE_CXX_FLAGS " /permissive-") # Two-phase name lookup does not place nicely with OpenMP yet, so disable for now string(APPEND CMAKE_CXX_FLAGS " /Zc:twoPhase-") @@ -218,7 +197,7 @@ unset(SYMBOL_FORMAT) unset(SYMBOL_FORMAT_RELEASE) # JMC is available on msvc 15.8 (1915) and up -if(MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG) +if(NOT MSVC_CLANG) string(APPEND CMAKE_CXX_FLAGS_DEBUG " /JMC") endif() @@ -251,9 +230,6 @@ if(NOT DEFINED LIBDIR) elseif(MSVC_VERSION GREATER 1919) message(STATUS "Visual Studio 2019 detected.") set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15) - elseif(MSVC_VERSION GREATER 1909) - message(STATUS "Visual Studio 2017 detected.") - set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15) endif() else() message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}") @@ -264,10 +240,8 @@ endif() include(platform_old_libs_update) -if(CMAKE_GENERATOR MATCHES "^Visual Studio.+" AND # Only supported in the VS IDE - MSVC_VERSION GREATER_EQUAL 1924 AND # Supported for 16.4+ - WITH_CLANG_TIDY # And Clang Tidy needs to be on - ) +# Only supported in the VS IDE & Clang Tidy needs to be on. +if(CMAKE_GENERATOR MATCHES "^Visual Studio.+" AND WITH_CLANG_TIDY) set(CMAKE_VS_GLOBALS "RunCodeAnalysis=false" "EnableMicrosoftCodeAnalysis=false" @@ -278,8 +252,7 @@ endif() # Mark libdir as system headers with a lower warn level, to resolve some warnings # that we have very little control over -if(MSVC_VERSION GREATER_EQUAL 1914 AND # Available with 15.7+ - NOT MSVC_CLANG AND # But not for clang +if(NOT MSVC_CLANG AND # Available with MSVC 15.7+ but not for CLANG. NOT WITH_WINDOWS_SCCACHE AND # And not when sccache is enabled NOT VS_CLANG_TIDY) # Clang-tidy does not like these options add_compile_options(/experimental:external /external:templates- /external:I "${LIBDIR}" /external:W0) diff --git a/extern/gflags/CMakeLists.txt b/extern/gflags/CMakeLists.txt index 4f2fce3778b..63749aad46d 100644 --- a/extern/gflags/CMakeLists.txt +++ b/extern/gflags/CMakeLists.txt @@ -3,9 +3,7 @@ # Too noisy for code we don't maintain. if(CMAKE_COMPILER_IS_GNUCC) - if(NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "8.0") - add_cxx_flag("-Wno-cast-function-type") - endif() + add_cxx_flag("-Wno-cast-function-type") endif() set(INC diff --git a/intern/atomic/intern/atomic_ops_utils.h b/intern/atomic/intern/atomic_ops_utils.h index 533cfbe9e1f..1c4cef564c3 100644 --- a/intern/atomic/intern/atomic_ops_utils.h +++ b/intern/atomic/intern/atomic_ops_utils.h @@ -106,8 +106,7 @@ /* Copied from BLI_utils... */ /* C++ can't use _Static_assert, expects static_assert() but c++0x only, * Coverity also errors out. */ -#if (!defined(__cplusplus)) && (!defined(__COVERITY__)) && \ - (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) /* gcc4.6+ only */ +#if (!defined(__cplusplus)) && (!defined(__COVERITY__)) && (defined(__GNUC__)) /* GCC only. */ # define ATOMIC_STATIC_ASSERT(a, msg) __extension__ _Static_assert(a, msg); #else /* Code adapted from http://www.pixelbeat.org/programming/gcc/static_assert.html */ diff --git a/intern/atomic/tests/atomic_test.cc b/intern/atomic/tests/atomic_test.cc index 37a66cf0e9c..6c0e96b9d91 100644 --- a/intern/atomic/tests/atomic_test.cc +++ b/intern/atomic/tests/atomic_test.cc @@ -6,12 +6,8 @@ #include "testing/testing.h" #ifdef __GNUC__ -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ -# pragma GCC diagnostic error "-Wsign-compare" -# endif -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 -# pragma GCC diagnostic error "-Wsign-conversion" -# endif +# pragma GCC diagnostic error "-Wsign-compare" +# pragma GCC diagnostic error "-Wsign-conversion" #endif /* -------------------------------------------------------------------- */ diff --git a/source/blender/blenlib/BLI_assert.h b/source/blender/blenlib/BLI_assert.h index 4a7fae6e98c..4292620e462 100644 --- a/source/blender/blenlib/BLI_assert.h +++ b/source/blender/blenlib/BLI_assert.h @@ -67,7 +67,7 @@ void _BLI_assert_unreachable_print(const char *file, int line, const char *funct # define BLI_STATIC_ASSERT(a, msg) static_assert(a, msg); #elif defined(_MSC_VER) /* Visual Studio */ -# if (_MSC_VER > 1910) && !defined(__clang__) +# if !defined(__clang__) # define BLI_STATIC_ASSERT(a, msg) static_assert(a, msg); # else # define BLI_STATIC_ASSERT(a, msg) _STATIC_ASSERT(a); diff --git a/source/blender/blenlib/BLI_compiler_attrs.h b/source/blender/blenlib/BLI_compiler_attrs.h index 99f0aa9f049..9ee626296cb 100644 --- a/source/blender/blenlib/BLI_compiler_attrs.h +++ b/source/blender/blenlib/BLI_compiler_attrs.h @@ -25,7 +25,7 @@ #endif /* never returns NULL */ -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 /* gcc4.9+ only */ +#ifdef __GNUC__ # define ATTR_RETURNS_NONNULL __attribute__((returns_nonnull)) #else # define ATTR_RETURNS_NONNULL @@ -39,14 +39,14 @@ #endif /* hint to treat any non-null function return value cannot alias any other pointer */ -#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) +#ifdef __GNUC__ # define ATTR_MALLOC __attribute__((malloc)) #else # define ATTR_MALLOC #endif /* the function return value points to memory (2 args for 'size * tot') */ -#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) +#ifdef __GNUC__ # define ATTR_ALLOC_SIZE(args...) __attribute__((alloc_size(args))) #else # define ATTR_ALLOC_SIZE(...) @@ -69,7 +69,7 @@ /* Use to suppress '-Wimplicit-fallthrough' (in place of 'break'). */ #ifndef ATTR_FALLTHROUGH -# if defined(__GNUC__) && (__GNUC__ >= 7) /* gcc7.0+ only */ +# ifdef __GNUC__ # define ATTR_FALLTHROUGH __attribute__((fallthrough)) # else # define ATTR_FALLTHROUGH ((void)0) diff --git a/source/blender/blenlib/BLI_endian_switch_inline.h b/source/blender/blenlib/BLI_endian_switch_inline.h index ce44348d4dd..32cb0f234f2 100644 --- a/source/blender/blenlib/BLI_endian_switch_inline.h +++ b/source/blender/blenlib/BLI_endian_switch_inline.h @@ -26,7 +26,7 @@ BLI_INLINE void BLI_endian_switch_int16(short *val) } BLI_INLINE void BLI_endian_switch_uint16(unsigned short *val) { -#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 408)) /* gcc4.8+ only */ +#ifdef __GNUC__ *val = __builtin_bswap16(*val); #else unsigned short tval = *val; diff --git a/source/blender/blenlib/BLI_math_inline.h b/source/blender/blenlib/BLI_math_inline.h index bf91c9108a9..b190b022a88 100644 --- a/source/blender/blenlib/BLI_math_inline.h +++ b/source/blender/blenlib/BLI_math_inline.h @@ -28,8 +28,8 @@ extern "C" { # define MALWAYS_INLINE #endif -/* gcc 4.6 (supports push/pop) */ -#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) +/* Check for GCC push/pop pragma support. */ +#ifdef __GNUC__ # define BLI_MATH_GCC_WARN_PRAGMA 1 #endif diff --git a/source/blender/blenlib/BLI_strict_flags.h b/source/blender/blenlib/BLI_strict_flags.h index 8489871d5da..cc5b5dce363 100644 --- a/source/blender/blenlib/BLI_strict_flags.h +++ b/source/blender/blenlib/BLI_strict_flags.h @@ -9,16 +9,12 @@ */ #ifdef __GNUC__ -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ +/* NOTE(@campbellbarton): CLANG behaves slightly differently to GCC, + * these can be enabled but do so carefully as they can introduce build-errors. */ +# if !defined(__clang__) # pragma GCC diagnostic error "-Wsign-compare" -# endif -# if __GNUC__ >= 6 /* gcc6+ only */ # pragma GCC diagnostic error "-Wconversion" -# endif -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 -/* gcc4.8+ only (behavior changed to ignore globals). */ # pragma GCC diagnostic error "-Wshadow" -/* older gcc changed behavior with ternary */ # pragma GCC diagnostic error "-Wsign-conversion" # endif /* pedantic gives too many issues, developers can define this for own use */ diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index 7201e1bb4a1..34f1b1a68f1 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -48,11 +48,6 @@ extern "C" { # define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR) #endif -/* Defines for using ISO C++ conferment names. */ -#if !defined(_MSC_VER) || _MSC_VER < 1900 -# define snprintf _snprintf -#endif - #if defined(_MSC_VER) # define R_OK 4 # define W_OK 2 diff --git a/source/blender/blenlib/intern/threads.cc b/source/blender/blenlib/intern/threads.cc index 156f2a7b338..f99a27c2475 100644 --- a/source/blender/blenlib/intern/threads.cc +++ b/source/blender/blenlib/intern/threads.cc @@ -37,17 +37,6 @@ #include "atomic_ops.h" -#if defined(__APPLE__) && defined(_OPENMP) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2) && \ - !defined(__clang__) -# define USE_APPLE_OMP_FIX -#endif - -#ifdef USE_APPLE_OMP_FIX -/* ************** libgomp (Apple gcc 4.2.1) TLS bug workaround *************** */ -extern pthread_key_t gomp_tls_key; -static void *thread_tls_data; -#endif - /** * Basic Thread Control API * ======================== @@ -153,15 +142,7 @@ void BLI_threadpool_init(ListBase *threadbase, void *(*do_thread)(void *), int t } } - uint level = atomic_fetch_and_add_u(&thread_levels, 1); - if (level == 0) { -#ifdef USE_APPLE_OMP_FIX - /* Workaround for Apple gcc 4.2.1 OMP vs background thread bug, - * we copy GOMP thread local storage pointer to setting it again - * inside the thread that we start. */ - thread_tls_data = pthread_getspecific(gomp_tls_key); -#endif - } + atomic_fetch_and_add_u(&thread_levels, 1); } int BLI_available_threads(ListBase *threadbase) @@ -194,13 +175,6 @@ int BLI_threadpool_available_thread_index(ListBase *threadbase) static void *tslot_thread_start(void *tslot_p) { ThreadSlot *tslot = (ThreadSlot *)tslot_p; - -#ifdef USE_APPLE_OMP_FIX - /* Workaround for Apple gcc 4.2.1 OMP vs background thread bug, - * set GOMP thread local storage pointer which was copied beforehand */ - pthread_setspecific(gomp_tls_key, thread_tls_data); -#endif - return tslot->do_thread(tslot->callerdata); } diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 7a94a938861..8468aaa70b9 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -73,15 +73,6 @@ #include "MEM_guardedalloc.h" -extern "C" { - -/* The following prevents a linking error in debug mode for MSVC using the libs in SVN. */ -#if defined(WITH_OPENEXR) && defined(_WIN32) && defined(DEBUG) && _MSC_VER < 1900 -_CRTIMP void __cdecl _invalid_parameter_noinfo(void) -{ -} -#endif -} #include "BLI_blenlib.h" #include "BLI_fileops.h" #include "BLI_math_color.h"