Skip to content

Commit ecc678d

Browse files
authored
Merge pull request #764 from bnbarham/ignore-no-spins
Prevent unused but set variable warning
2 parents 1ffe399 + 915f251 commit ecc678d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Diff for: src/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11

2-
# Remove once underlying clang warning is fixed (rdar://93596069)
3-
set_source_files_properties(shims/yield.c PROPERTIES COMPILE_FLAGS -Wno-error=unused-but-set-variable)
4-
52
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
63
add_subdirectory(BlocksRuntime)
74
endif()

Diff for: src/shims/yield.c

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ static void *
2525
__DISPATCH_WAIT_FOR_ENQUEUER__(void **ptr)
2626
{
2727
int spins = 0;
28+
// Different platforms may expand `_dispatch_preemption_yield` to a
29+
// no-op, but `(void)++spins` is not considered a use like
30+
// `(void)spins` is. Add a use to avoid unused var warnings.
31+
(void)spins;
32+
2833
void *value;
2934
while ((value = os_atomic_load(ptr, relaxed)) == NULL) {
3035
_dispatch_preemption_yield(++spins);

0 commit comments

Comments
 (0)