diff --git a/repertory/librepertory/include/common.hpp b/repertory/librepertory/include/common.hpp index 8c7cb131..e370ef20 100644 --- a/repertory/librepertory/include/common.hpp +++ b/repertory/librepertory/include/common.hpp @@ -22,7 +22,7 @@ #ifndef REPERTORY_INCLUDE_COMMON_HPP_ #define REPERTORY_INCLUDE_COMMON_HPP_ -#if defined(__GNUC__) +#if defined(__GNUC__) && !defined(PROJECT_IS_DARWIN) // clang-format off #define REPERTORY_IGNORE_WARNINGS_ENABLE() \ _Pragma("GCC diagnostic push") \ diff --git a/repertory/librepertory/include/utils/tasks.hpp b/repertory/librepertory/include/utils/tasks.hpp index 390084b1..8c97a1b3 100644 --- a/repertory/librepertory/include/utils/tasks.hpp +++ b/repertory/librepertory/include/utils/tasks.hpp @@ -98,7 +98,7 @@ private: std::condition_variable notify_; std::mutex start_stop_mutex_; stop_type stop_requested_{false}; - std::vector> task_threads_; + std::vector> task_threads_; std::deque tasks_; private: diff --git a/repertory/librepertory/src/utils/tasks.cpp b/repertory/librepertory/src/utils/tasks.cpp index f2184bc6..060c6399 100644 --- a/repertory/librepertory/src/utils/tasks.cpp +++ b/repertory/librepertory/src/utils/tasks.cpp @@ -86,8 +86,9 @@ void tasks::start(app_config *config) { for (std::uint32_t idx = 0U; idx < std::thread::hardware_concurrency() * 2U; ++idx) { - task_threads_.emplace_back( - std::make_unique([this]() { task_thread(); })); + auto thread{std::make_unique([this]() { task_thread(); })}; + thread->detach(); + task_threads_.emplace_back(std::move(thread)); } } @@ -100,7 +101,7 @@ void tasks::stop() { stop_requested_ = true; unique_mutex_lock lock(mutex_); - std::vector> threads; + std::vector> threads; std::swap(threads, task_threads_); std::deque task_list; diff --git a/repertory/librepertory/src/utils/unix/unix_utils.cpp b/repertory/librepertory/src/utils/unix/unix_utils.cpp index f04bc7e9..80c297d1 100644 --- a/repertory/librepertory/src/utils/unix/unix_utils.cpp +++ b/repertory/librepertory/src/utils/unix/unix_utils.cpp @@ -118,10 +118,10 @@ auto to_api_error(int err) -> api_error { #if defined(__APPLE__) case EBADMSG: return api_error::download_failed; -#else +#else // !defined(__APPLE__) case EREMOTEIO: return api_error::download_failed; -#endif +#endif // defined(__APPLE__) case EIO: return api_error::error; case EEXIST: @@ -130,8 +130,6 @@ auto to_api_error(int err) -> api_error { return api_error::file_in_use; case EINVAL: return api_error::invalid_operation; - case ENAMETOOLONG: - return api_error::name_too_long; case ENOENT: return api_error::item_not_found; case ENOMEM: @@ -151,17 +149,19 @@ auto to_api_error(int err) -> api_error { #if defined(__APPLE__) case ENOATTR: return api_error::xattr_not_found; -#else +#else // !defined(__APPLE__) case ENODATA: return api_error::xattr_not_found; -#endif +#endif // defined(__APPLE__) #if defined(__APPLE__) case ENAMETOOLONG: return api_error::xattr_too_big; -#else +#else // !defined(__APPLE__) + case ENAMETOOLONG: + return api_error::name_too_long; case E2BIG: return api_error::xattr_too_big; -#endif +#endif // defined(__APPLE__) default: return api_error::error; } diff --git a/scripts/env.sh b/scripts/env.sh index 1ff99a46..8923261d 100755 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -182,7 +182,11 @@ if [ "${PROJECT_STATIC_LINK}" == "ON" ]; then PROJECT_BUILD_SHARED_LIBS=OFF PROJECT_ENABLE_BACKWARD_CPP=OFF PROJECT_LINK_TYPE=static - PROJECT_REQUIRE_ALPINE=ON + if [ "${PROJECT_IS_DARWIN}" == "0" ]; then + PROJECT_REQUIRE_ALPINE=ON + else + PROJECT_REQUIRE_ALPINE=OFF + fi else PROJECT_BUILD_SHARED_LIBS=ON PROJECT_LINK_TYPE=shared