| 1 | /* |
| 2 | Copyright (c) 2005-2019 Intel Corporation |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef tbb_test_harness_allocator_overload_H |
| 18 | #define tbb_test_harness_allocator_overload_H |
| 19 | |
| 20 | #include "../tbbmalloc/proxy.h" // for MALLOC_UNIXLIKE_OVERLOAD_ENABLED, MALLOC_ZONE_OVERLOAD_ENABLED |
| 21 | #include "tbb/tbb_config.h" // for __TBB_WIN8UI_SUPPORT |
| 22 | |
| 23 | // Skip configurations with unsupported system malloc overload: |
| 24 | // skip unsupported MSVCs, WIN8UI and MINGW (it doesn't define _MSC_VER), |
| 25 | // no support for MSVC 2015 and greater in debug for now, |
| 26 | // don't use defined(_MSC_VER), because result of using defined() in macro expansion is undefined |
| 27 | #define MALLOC_WINDOWS_OVERLOAD_ENABLED ((_WIN32||_WIN64) && !__TBB_WIN8UI_SUPPORT && _MSC_VER >= 1500 && !(_MSC_VER >= 1900 && _DEBUG)) |
| 28 | |
| 29 | // Skip configurations with unsupported system malloc overload: |
| 30 | // * overload via linking with -lmalloc_proxy is broken in offload, |
| 31 | // as the library is loaded too late in that mode, |
| 32 | // * LD_PRELOAD mechanism is broken in offload |
| 33 | #define HARNESS_SKIP_TEST ((!MALLOC_WINDOWS_OVERLOAD_ENABLED && !MALLOC_UNIXLIKE_OVERLOAD_ENABLED && !MALLOC_ZONE_OVERLOAD_ENABLED) || __TBB_MIC_OFFLOAD) |
| 34 | |
| 35 | #endif // tbb_test_harness_allocator_overload_H |
| 36 | |