Skip to content

Commit 33bae19

Browse files
committed
SwiftShims: memcmp parameters are non-optional on Apple platforms
Fix the SwiftShims local declaration of memcmp for its parameters to have the same optionality as the SDK version. They should be `_Nonnull` to mirror the `_string` version. Follow-up to swiftlang#77964 rdar://140596571
1 parent a619daf commit 33bae19

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

stdlib/public/SwiftShims/swift/shims/LibcShims.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,8 @@ static inline __swift_size_t _swift_stdlib_strlen_unsigned(const unsigned char *
6060
SWIFT_READONLY
6161
static inline int _swift_stdlib_memcmp(const void *s1, const void *s2,
6262
__swift_size_t n) {
63-
#if defined(__APPLE__)
64-
// Darwin defines memcmp with optional pointers, preserve the same type here.
65-
extern int memcmp(const void * _Nullable, const void * _Nullable, __swift_size_t);
6663
// FIXME: Is there a way to identify Glibc specifically?
67-
#elif (defined(__gnu_linux__) || defined(__ANDROID__)) && !defined(__musl__)
64+
#if (defined(__APPLE__) || defined(__gnu_linux__) || defined(__ANDROID__)) && !defined(__musl__)
6865
extern int memcmp(const void * _Nonnull, const void * _Nonnull, __swift_size_t);
6966
#else
7067
extern int memcmp(const void * _Null_unspecified, const void * _Null_unspecified, __swift_size_t);

0 commit comments

Comments
 (0)