dmitri.shuralyov.com/gpu/mtl/...

fix "supportsFamily not found" warning on macOS 10.13 and 10.14

Commit 2a3c46a829b9 added support for supportsFamily, an API new to
macOS 10.15. It used an @available check to avoid trying to call it
on macOS 10.13 and 10.14, but despite not running, it still creates
a warning like:

	mtl.m:44:33: warning: instance method '-supportsFamily:' not found
		(return type defaults to 'id') [-Wobjc-method-access]

On those old macOS versions.

Use an #ifdef directive until I find a better to handle this, or drop
this complexity by raising the minimum supported macOS version.

Tested on macOS 10.13.6 and 13.0.1.
dmitshur committed 1 year ago commit 85de2813cf6bd8d6d2f0240fdebf943cbffc2b8a
Collapse all
mtl.m
@@ -38,13 +38,15 @@ struct Devices CopyAllDevices() {
	d.Length = devices.count;
	return d;
}

bool Device_SupportsFamily(void * device, uint16_t gpuFamily) {
#ifdef MAC_OS_X_VERSION_10_15
	if (@available(macOS 10.15, *)) {
		return [(id<MTLDevice>)device supportsFamily:gpuFamily];
	}
#endif // MAC_OS_X_VERSION_10_15
	@throw @"API not available";
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"