Skip to content

Commit

Permalink
Merge pull request #764 from bnbarham/ignore-no-spins
Browse files Browse the repository at this point in the history
Prevent unused but set variable warning
  • Loading branch information
bnbarham committed Jun 6, 2022
2 parents 1ffe399 + 915f251 commit ecc678d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@

# Remove once underlying clang warning is fixed (rdar://93596069)
set_source_files_properties(shims/yield.c PROPERTIES COMPILE_FLAGS -Wno-error=unused-but-set-variable)

if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
add_subdirectory(BlocksRuntime)
endif()
Expand Down
5 changes: 5 additions & 0 deletions src/shims/yield.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ static void *
__DISPATCH_WAIT_FOR_ENQUEUER__(void **ptr)
{
int spins = 0;
// Different platforms may expand `_dispatch_preemption_yield` to a
// no-op, but `(void)++spins` is not considered a use like
// `(void)spins` is. Add a use to avoid unused var warnings.
(void)spins;

void *value;
while ((value = os_atomic_load(ptr, relaxed)) == NULL) {
_dispatch_preemption_yield(++spins);
Expand Down

0 comments on commit ecc678d

Please sign in to comment.