Skip to content

Commit a974a14

Browse files
Moving sys/queue.h stubs to src/shims/android_stubs.h
Missing TAILQ macros from `sys/queue.h` are now defined in `src/shims/android_stubs.h` instead of `src/internal.h`
1 parent 6b7c72e commit a974a14

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ libdispatch_la_SOURCES= \
4141
trace.h \
4242
voucher_internal.h \
4343
firehose/firehose_internal.h \
44+
shims/android_stubs.h \
4445
shims/atomic.h \
4546
shims/atomic_sfb.h \
4647
shims/getprogname.h \

src/internal.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -374,17 +374,6 @@ DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_child(void);
374374
TRASHIT((head)->tqh_last); \
375375
} while (0)
376376

377-
#ifndef TAILQ_FOREACH_SAFE
378-
# define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
379-
for ((var) = TAILQ_FIRST((head)); \
380-
(var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
381-
(var) = (tvar))
382-
#endif /* TAILQ_FOREACH_SAFE */
383-
384-
#ifndef TRASHIT
385-
# define TRASHIT(x) do {(x) = (void *)-1;} while (0)
386-
#endif /* TRASHIT */
387-
388377
DISPATCH_EXPORT DISPATCH_NOINLINE
389378
void _dispatch_bug(size_t line, long val);
390379

src/shims/android_stubs.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* This source file is part of the Swift.org open source project
3+
*
4+
* Copyright (c) 2015 Apple Inc. and the Swift project authors
5+
*
6+
* Licensed under Apache License v2.0 with Runtime Library Exception
7+
*
8+
* See http://swift.org/LICENSE.txt for license information
9+
* See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
*
11+
*/
12+
13+
// forward declarations for functions we are stubbing out
14+
// in the intial android port.
15+
16+
#ifndef __DISPATCH__ANDROID__STUBS__INTERNAL
17+
#define __DISPATCH__ANDROID__STUBS__INTERNAL
18+
19+
/*
20+
* Missing sys/queue.h macro stubs
21+
*/
22+
23+
#ifndef TAILQ_FOREACH_SAFE
24+
# define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
25+
for ((var) = TAILQ_FIRST((head)); \
26+
(var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
27+
(var) = (tvar))
28+
#endif /* TAILQ_FOREACH_SAFE */
29+
30+
#ifndef TRASHIT
31+
# define TRASHIT(x) do {(x) = (void *)-1;} while (0)
32+
#endif /* TRASHIT */
33+
34+
#endif /* __DISPATCH__ANDROID__STUBS__INTERNAL */

0 commit comments

Comments
 (0)