Skip to content

Commit fe3cdda

Browse files
3405691582compnerd
authored andcommitted
Voucher portability fixes.
* The `VOUCHER_USE_MACH_VOUCHER` branch defines `_voucher_atfork_parent` but the `#else` branch does not. Assume it should look like the implementation for `_voucher_atfork_child` nearby. * Compiler complains about `voucher_process_can_use_arbitrary_personas` not having a previous prototype. This actually isn't used anywhere outside the `VOUCHER_USE_MACH_VOUCHER` branch, so remove it. * Ensure `voucher_needs_adopt` is `static` inline, otherwise the linker gives "multiple definition" errors despite it being marked as inline.
1 parent 6215978 commit fe3cdda

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

dispatch/base.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
#define DISPATCH_CONST __attribute__((__const__))
6363
#define DISPATCH_WARN_RESULT __attribute__((__warn_unused_result__))
6464
#define DISPATCH_MALLOC __attribute__((__malloc__))
65-
#define DISPATCH_ALWAYS_INLINE __attribute__((__always_inline__))
65+
#define DISPATCH_ALWAYS_INLINE __attribute__((unused, __always_inline__))
6666
#define DISPATCH_UNAVAILABLE __attribute__((__unavailable__))
6767
#define DISPATCH_UNAVAILABLE_MSG(msg) __attribute__((__unavailable__(msg)))
6868
#elif defined(_MSC_VER)

os/voucher_private.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,15 @@ voucher_adopt(voucher_t _Nullable voucher OS_OBJECT_CONSUMED);
128128
*/
129129

130130
SPI_AVAILABLE(macos(12.0), ios(15.0))
131-
DISPATCH_ALWAYS_INLINE bool
131+
DISPATCH_ALWAYS_INLINE static bool
132132
voucher_needs_adopt(voucher_t _Nullable voucher)
133133
{
134134
#if __APPLE__
135135
if (_pthread_has_direct_tsd()) {
136136
return (((void *) voucher) != _pthread_getspecific_direct(OS_VOUCHER_TSD_KEY));
137137
}
138138
#endif
139+
(void)voucher;
139140
return true;
140141
}
141142

src/voucher.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -1987,14 +1987,13 @@ voucher_get_current_persona_proximate_info(struct proc_persona_info *persona_inf
19871987
}
19881988
#endif // __has_include(<mach/mach.h>)
19891989

1990-
bool
1991-
voucher_process_can_use_arbitrary_personas(void)
1990+
void
1991+
_voucher_activity_debug_channel_init(void)
19921992
{
1993-
return false;
19941993
}
19951994

19961995
void
1997-
_voucher_activity_debug_channel_init(void)
1996+
_voucher_atfork_parent(void)
19981997
{
19991998
}
20001999

0 commit comments

Comments
 (0)