diff options
author | Chris Robinson <[email protected]> | 2023-05-27 08:49:48 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-05-27 08:49:48 -0700 |
commit | 6cd3d2414ac40a94713c84a0703d3e021bf9a570 (patch) | |
tree | acb66ba1390a5d1d6934105bc77df49a5a5c74d7 /common/threads.cpp | |
parent | 17b1b31320079d88bb80ba7da9504fd91231cd85 (diff) |
Use [[maybe_unused]] instead of std::ignore
Diffstat (limited to 'common/threads.cpp')
-rw-r--r-- | common/threads.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/common/threads.cpp b/common/threads.cpp index 19a6bbf0..136c4813 100644 --- a/common/threads.cpp +++ b/common/threads.cpp @@ -97,7 +97,6 @@ bool semaphore::try_wait() noexcept #ifdef HAVE_PTHREAD_NP_H #include <pthread_np.h> #endif -#include <tuple> namespace { @@ -106,33 +105,27 @@ using setname_t2 = int(*)(pthread_t, const char*); using setname_t3 = void(*)(pthread_t, const char*); using setname_t4 = int(*)(pthread_t, const char*, void*); -void setname_caller(setname_t1 func, const char *name) +[[maybe_unused]] void setname_caller(setname_t1 func, const char *name) { func(name); } -void setname_caller(setname_t2 func, const char *name) +[[maybe_unused]] void setname_caller(setname_t2 func, const char *name) { func(pthread_self(), name); } -void setname_caller(setname_t3 func, const char *name) +[[maybe_unused]] void setname_caller(setname_t3 func, const char *name) { func(pthread_self(), name); } -void setname_caller(setname_t4 func, const char *name) +[[maybe_unused]] void setname_caller(setname_t4 func, const char *name) { func(pthread_self(), "%s", static_cast<void*>(const_cast<char*>(name))); } } // namespace -void althrd_setname(const char *name) +void althrd_setname(const char *name [[maybe_unused]]) { #if defined(HAVE_PTHREAD_SET_NAME_NP) setname_caller(pthread_set_name_np, name); #elif defined(HAVE_PTHREAD_SETNAME_NP) setname_caller(pthread_setname_np, name); #endif - /* Avoid unused function/parameter warnings. */ - std::ignore = name; - std::ignore = static_cast<void(*)(setname_t1,const char*)>(&setname_caller); - std::ignore = static_cast<void(*)(setname_t2,const char*)>(&setname_caller); - std::ignore = static_cast<void(*)(setname_t3,const char*)>(&setname_caller); - std::ignore = static_cast<void(*)(setname_t4,const char*)>(&setname_caller); } #ifdef __APPLE__ |