Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions stdlib/public/SwiftShims/LibcShims.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ static inline __swift_size_t _swift_stdlib_strlen_unsigned(const unsigned char *
SWIFT_READONLY
static inline int _swift_stdlib_memcmp(const void *s1, const void *s2,
__swift_size_t n) {
#if defined(__APPLE__)
extern int memcmp(const void * _Nullable, const void * _Nullable, __swift_size_t);
#else
extern int memcmp(const void *, const void *, __swift_size_t);
#endif
return memcmp(s1, s2, n);
}

Expand Down
12 changes: 12 additions & 0 deletions validation-test/ClangImporter/memcmp-definitions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// rdar://69876253
// REQUIRES: VENDOR=apple
// RUN: %target-build-swift %s -o %t.out

import SwiftShims
import Foundation

func foo () {
let a = UnsafeMutableRawPointer.allocate(byteCount: 4, alignment: 4)
let b = UnsafeMutableRawPointer.allocate(byteCount: 4, alignment: 4)
memcmp(a, b, 4)
}