Avoid (some cases of) compiler warning; mixing declarations and code is incompatible with standards before C99

This commit is contained in:
rfm 2024-07-03 16:21:13 +01:00
parent f7acef2362
commit 0cf5955e00

View file

@ -96,14 +96,14 @@
* Convenience macro to create concurrent dispatch queues for the various * Convenience macro to create concurrent dispatch queues for the various
* -enumerateUsingBlock: methods. Non-concurrent will be run in place. * -enumerateUsingBlock: methods. Non-concurrent will be run in place.
*/ */
#define GS_DISPATCH_CREATE_QUEUE_AND_GROUP_FOR_ENUMERATION(queue, opts)\ #define GS_DISPATCH_CREATE_QUEUE_AND_GROUP_FOR_ENUMERATION(queue, opts) {\
dispatch_queue_t queue = NULL;\ dispatch_queue_t queue = NULL;\
dispatch_group_t queue ## Group = NULL;\ dispatch_group_t queue ## Group = NULL;\
if (opts & NSEnumerationConcurrent)\ if (opts & NSEnumerationConcurrent)\
{\ {\
queue = GS_DISPATCH_GET_DEFAULT_CONCURRENT_QUEUE();\ queue = GS_DISPATCH_GET_DEFAULT_CONCURRENT_QUEUE();\
queue ## Group = GS_DISPATCH_GROUP_CREATE();\ queue ## Group = GS_DISPATCH_GROUP_CREATE();\
} }
/** /**
* Convenience macro to destroy concurrent dispatch queues for the various * Convenience macro to destroy concurrent dispatch queues for the various
@ -114,10 +114,11 @@
GS_DISPATCH_GROUP_FINISH(queue ## Group);\ GS_DISPATCH_GROUP_FINISH(queue ## Group);\
GS_DISPATCH_RELEASE(queue ## Group);\ GS_DISPATCH_RELEASE(queue ## Group);\
if (NO == (opts & NSEnumerationConcurrent))\ if (NO == (opts & NSEnumerationConcurrent))\
{\ {\
GS_DISPATCH_RELEASE(queue);\ GS_DISPATCH_RELEASE(queue);\
}\ }\
} }\
}
#else #else