Skip to content

Commit 34e7495

Browse files
authored
Fix compilation on macOS with GCC (#1603)
1 parent ed141f3 commit 34e7495

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

cmake/compilers/GNU.cmake

+12-10
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,18 @@ execute_process(
5555
ERROR_STRIP_TRAILING_WHITESPACE
5656
)
5757
set(ASSEMBLER_VERSION_LINE ${ASSEMBLER_VERSION_LINE_OUT}${ASSEMBLER_VERSION_LINE_ERR})
58-
string(REGEX REPLACE ".*GNU assembler version ([0-9]+)\\.([0-9]+).*" "\\1" _tbb_gnu_asm_major_version "${ASSEMBLER_VERSION_LINE}")
59-
string(REGEX REPLACE ".*GNU assembler version ([0-9]+)\\.([0-9]+).*" "\\2" _tbb_gnu_asm_minor_version "${ASSEMBLER_VERSION_LINE}")
60-
unset(ASSEMBLER_VERSION_LINE_OUT)
61-
unset(ASSEMBLER_VERSION_LINE_ERR)
62-
unset(ASSEMBLER_VERSION_LINE)
63-
message(TRACE "Extracted GNU assembler version: major=${_tbb_gnu_asm_major_version} minor=${_tbb_gnu_asm_minor_version}")
64-
65-
math(EXPR _tbb_gnu_asm_version_number "${_tbb_gnu_asm_major_version} * 1000 + ${_tbb_gnu_asm_minor_version}")
66-
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} "-D__TBB_GNU_ASM_VERSION=${_tbb_gnu_asm_version_number}")
67-
message(STATUS "GNU Assembler version: ${_tbb_gnu_asm_major_version}.${_tbb_gnu_asm_minor_version} (${_tbb_gnu_asm_version_number})")
58+
if ("${ASSEMBLER_VERSION_LINE}" MATCHES "GNU assembler version")
59+
string(REGEX REPLACE ".*GNU assembler version ([0-9]+)\\.([0-9]+).*" "\\1" _tbb_gnu_asm_major_version "${ASSEMBLER_VERSION_LINE}")
60+
string(REGEX REPLACE ".*GNU assembler version ([0-9]+)\\.([0-9]+).*" "\\2" _tbb_gnu_asm_minor_version "${ASSEMBLER_VERSION_LINE}")
61+
unset(ASSEMBLER_VERSION_LINE_OUT)
62+
unset(ASSEMBLER_VERSION_LINE_ERR)
63+
unset(ASSEMBLER_VERSION_LINE)
64+
message(TRACE "Extracted GNU assembler version: major=${_tbb_gnu_asm_major_version} minor=${_tbb_gnu_asm_minor_version}")
65+
66+
math(EXPR _tbb_gnu_asm_version_number "${_tbb_gnu_asm_major_version} * 1000 + ${_tbb_gnu_asm_minor_version}")
67+
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} "-D__TBB_GNU_ASM_VERSION=${_tbb_gnu_asm_version_number}")
68+
message(STATUS "GNU Assembler version: ${_tbb_gnu_asm_major_version}.${_tbb_gnu_asm_minor_version} (${_tbb_gnu_asm_version_number})")
69+
endif()
6870

6971
# Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors
7072
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86)" AND NOT EMSCRIPTEN)

include/oneapi/tbb/detail/_config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@
337337

338338
#define __TBB_TSX_INTRINSICS_PRESENT (__RTM__ || __INTEL_COMPILER || (_MSC_VER>=1700 && (__TBB_x86_64 || __TBB_x86_32)))
339339

340-
#define __TBB_WAITPKG_INTRINSICS_PRESENT ((__INTEL_COMPILER >= 1900 || (__TBB_GCC_VERSION >= 110000 && __TBB_GNU_ASM_VERSION >= 2032) || __TBB_CLANG_VERSION >= 120000) \
340+
#define __TBB_WAITPKG_INTRINSICS_PRESENT ((__INTEL_COMPILER >= 1900 || (__TBB_GCC_VERSION >= 110000 && (__APPLE__ || __TBB_GNU_ASM_VERSION >= 2032)) || __TBB_CLANG_VERSION >= 120000) \
341341
&& (_WIN32 || _WIN64 || __unix__ || __APPLE__) && (__TBB_x86_32 || __TBB_x86_64) && !__ANDROID__)
342342

343343
/** Internal TBB features & modes **/

src/tbb/co_context.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2005-2022 Intel Corporation
2+
Copyright (c) 2005-2025 Intel Corporation
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -43,9 +43,9 @@
4343
#if __INTEL_COMPILER
4444
#pragma warning(push)
4545
#pragma warning(disable:1478)
46-
#elif __clang__
47-
#pragma clang diagnostic push
48-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
46+
#elif __GNUC__
47+
#pragma GCC diagnostic push
48+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
4949
#endif
5050
#endif // __APPLE__
5151

@@ -362,8 +362,8 @@ inline void destroy_coroutine(coroutine_type& c) {
362362
#if __APPLE__
363363
#if __INTEL_COMPILER
364364
#pragma warning(pop) // 1478 warning
365-
#elif __clang__
366-
#pragma clang diagnostic pop // "-Wdeprecated-declarations"
365+
#elif __GNUC__
366+
#pragma GCC diagnostic pop // "-Wdeprecated-declarations"
367367
#endif
368368
#endif
369369

0 commit comments

Comments
 (0)