From 0173671fde0e065e16de89e1c034a15eeb4a357b Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Wed, 23 Mar 2022 18:22:38 +0000 Subject: [PATCH] Fix compile error when building on SDK 11.1 SDK 11.1 and SDK 12 have different declaration for MTLDevice::supportsBCTextureCompression. On SDK 11.1 it is marked as API_AVAILABLE for ios and on SDK 12 is marked as API_UNAVAILABLE ios. Guard the API_UNAVAILABLE(ios) declaration to only be included when compiling for SDK 12.0 or above. The compile error message before the fix: renderdoc/driver/metal/metal_device_bridge.mm:158:64: error: method cannot be unavailable on iOS when the protocol method it implements is available [-Werror,-Wavailability] 69 - (BOOL)supportsBCTextureCompression API_AVAILABLE(macos(11.0))API_UNAVAILABLE(ios) --- renderdoc/driver/metal/metal_device_bridge.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/metal/metal_device_bridge.mm b/renderdoc/driver/metal/metal_device_bridge.mm index e033a5fa4..2f5101292 100644 --- a/renderdoc/driver/metal/metal_device_bridge.mm +++ b/renderdoc/driver/metal/metal_device_bridge.mm @@ -161,7 +161,11 @@ return self.real.supportsQueryTextureLOD; } -- (BOOL)supportsBCTextureCompression API_AVAILABLE(macos(11.0))API_UNAVAILABLE(ios) +- (BOOL)supportsBCTextureCompression API_AVAILABLE(macos(11.0)) +// It is available for ios in SDK 11.1 and it is marked as unavailable in SDK 12 +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_12_0 + API_UNAVAILABLE(ios) +#endif // #if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_12_0 { return self.real.supportsBCTextureCompression; }