Skip to content

Commit 7c93881

Browse files
committed
[RemoteMirror] Fix various interop warnings in the headers.
1 parent 47be50c commit 7c93881

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

include/swift/SwiftRemoteMirror/SwiftRemoteMirror.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extern "C" {
3939

4040
/// Get the metadata version supported by the Remote Mirror library.
4141
SWIFT_REMOTE_MIRROR_LINKAGE
42-
uint16_t swift_reflection_getSupportedMetadataVersion();
42+
uint16_t swift_reflection_getSupportedMetadataVersion(void);
4343

4444
/// \returns An opaque reflection context.
4545
SWIFT_REMOTE_MIRROR_LINKAGE

include/swift/SwiftRemoteMirror/SwiftRemoteMirrorLegacyInterop.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "SwiftRemoteMirrorLegacyInteropTypes.h"
2626
#include "SwiftRemoteMirror.h"
2727

28+
#include <string.h>
2829
#include <dlfcn.h>
2930
#include <mach-o/getsect.h>
3031

@@ -678,14 +679,14 @@ swift_reflection_interop_addImageLegacy(
678679
}
679680

680681
info.LocalStartAddress = (uintptr_t)Buf;
681-
info.RemoteStartAddress = ImageStart;
682+
info.RemoteStartAddress = (uintptr_t)ImageStart;
682683

683684
Library->Functions.addReflectionInfoLegacy(Library->Context, info);
684685

685686
// Find the data segment and add it to our list.
686687
unsigned long DataSize;
687688
const uint8_t *DataSegment = getsegmentdata(Header, "__DATA", &DataSize);
688-
uintptr_t DataSegmentStart = DataSegment - (const uint8_t *)Buf + ImageStart;
689+
uintptr_t DataSegmentStart = (uintptr_t)(DataSegment - (const uint8_t *)Buf + ImageStart);
689690

690691
struct SwiftReflectionInteropContextLegacyImageRangeList *Node =
691692
(struct SwiftReflectionInteropContextLegacyImageRangeList *)malloc(sizeof(*Node));
@@ -697,12 +698,12 @@ swift_reflection_interop_addImageLegacy(
697698
// If the buffer needs to be freed, save buffer and free context to free it when the
698699
// reflection context is destroyed.
699700
if (ContextRef->FreeBytes != NULL) {
700-
struct SwiftReflectionInteropContextFreeList *Node =
701-
(struct SwiftReflectionInteropContextFreeList *)malloc(sizeof(*Node));
702-
Node->Next = ContextRef->FreeList;
703-
Node->Pointer = Buf;
704-
Node->Context = FreeContext;
705-
ContextRef->FreeList = Node;
701+
struct SwiftReflectionInteropContextFreeList *FreeListNode =
702+
(struct SwiftReflectionInteropContextFreeList *)malloc(sizeof(*FreeListNode));
703+
FreeListNode->Next = ContextRef->FreeList;
704+
FreeListNode->Pointer = Buf;
705+
FreeListNode->Context = FreeContext;
706+
ContextRef->FreeList = FreeListNode;
706707
}
707708

708709
return 1;
@@ -746,7 +747,7 @@ swift_reflection_interop_lookupMetadata(SwiftReflectionInteropContextRef Context
746747
swift_reflection_interop_libraryForAddress(ContextRef, Metadata);
747748
if (Library != NULL) {
748749
Result.Metadata = Metadata;
749-
Result.Library = LIBRARY_INDEX;
750+
Result.Library = (int)LIBRARY_INDEX;
750751
}
751752
return Result;
752753
}
@@ -772,7 +773,7 @@ swift_reflection_interop_typeRefForInstance(SwiftReflectionInteropContextRef Con
772773
swift_typeref_t Typeref = Library->Functions.typeRefForInstance(Library->Context,
773774
Object);
774775
Result.Typeref = Typeref;
775-
Result.Library = LIBRARY_INDEX;
776+
Result.Library = (int)LIBRARY_INDEX;
776777
}
777778
return Result;
778779
}
@@ -790,7 +791,7 @@ swift_reflection_interop_typeRefForMangledTypeName(
790791
continue;
791792

792793
Result.Typeref = Typeref;
793-
Result.Library = LIBRARY_INDEX;
794+
Result.Library = (int)LIBRARY_INDEX;
794795
return Result;
795796
}
796797

@@ -877,7 +878,7 @@ swift_reflection_interop_childOfInstance(SwiftReflectionInteropContextRef Contex
877878
Result.Offset = LibResult.Offset;
878879
Result.Kind = LibResult.Kind;
879880
Result.TR.Typeref = LibResult.TR;
880-
Result.TR.Library = LIBRARY_INDEX;
881+
Result.TR.Library = (int)LIBRARY_INDEX;
881882
} else {
882883
Result.Kind = SWIFT_UNKNOWN;
883884
}

include/swift/SwiftRemoteMirror/SwiftRemoteMirrorTypes.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ typedef enum swift_layout_kind {
108108

109109
// References to other objects in the heap.
110110
SWIFT_STRONG_REFERENCE,
111-
#define REF_STORAGE(Name, name, NAME) \
112-
SWIFT_##NAME##_REFERENCE,
113-
#include "swift/AST/ReferenceStorage.def"
111+
SWIFT_UNOWNED_REFERENCE,
112+
SWIFT_WEAK_REFERENCE,
113+
SWIFT_UNMANAGED_REFERENCE,
114114

115115
// Layouts of heap objects. These are only ever returned from
116116
// swift_reflection_infoFor{Instance,Metadata}(), and not

0 commit comments

Comments
 (0)