radv: Fix custom build id with C90 compilation.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sat, 19 Nov 2022 02:28:56 +0000 (03:28 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 21 Nov 2022 12:57:41 +0000 (12:57 +0000)
Seems some build configurations have problems with VLAs still.

Fixes: 97641e5c942 ("radv: Add ability to override the build id for the cache.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19869>

src/amd/vulkan/radv_device.c

index a909ac5..1958816 100644 (file)
@@ -117,9 +117,10 @@ radv_device_get_cache_uuid(struct radv_physical_device *pdevice, void *uuid)
 
 #ifdef RADV_BUILD_ID_OVERRIDE
    {
-      char data[strlen(RADV_BUILD_ID_OVERRIDE) / 2];
-      parse_hex(data, RADV_BUILD_ID_OVERRIDE, ARRAY_SIZE(data));
-      _mesa_sha1_update(&ctx, data, ARRAY_SIZE(data));
+      unsigned size = strlen(RADV_BUILD_ID_OVERRIDE) / 2;
+      char *data = alloca(size);
+      parse_hex(data, RADV_BUILD_ID_OVERRIDE, size);
+      _mesa_sha1_update(&ctx, data, size);
    }
 #else
    if (!disk_cache_get_function_identifier(radv_device_get_cache_uuid, &ctx))