NFC: Ignore some -Wcast-qual warnings in swift-reflection-test.c.

This commit is contained in:
Allan Shortlidge
2024-01-16 11:18:06 -08:00
parent 72e0fc2af1
commit 11165f3ef1

View File

@@ -187,7 +187,10 @@ static int PipeMemoryReader_queryDataLayout(void *Context,
static void PipeMemoryReader_freeBytes(void *reader_context, const void *bytes,
void *context) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-qual"
free((void *)bytes);
#pragma clang diagnostic pop
}
static
@@ -652,10 +655,13 @@ int reflectEnumValue(SwiftReflectionContextRef RC,
void *outFreeContext = NULL;
// !!! FIXME !!! obtain the pointer by properly projecting the enum value
// Next lines are a hack to prove the concept.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-qual"
const void *rawPtr
= PipeMemoryReader_readBytes((void *)&Pipe, EnumInstance, 8, &outFreeContext);
uintptr_t instance = *(uintptr_t *)rawPtr & 0xffffffffffffff8ULL;
PipeMemoryReader_freeBytes((void *)&Pipe, rawPtr, outFreeContext);
#pragma clang diagnostic pop
// Indirect enum stores the payload as the first field of a closure context
swift_typeinfo_t TI = swift_reflection_infoForInstance(RC, instance);