mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
vulkan/util: Make STACK_ARRAY() C++-friendly
C++ doesn't like the {0} initializer pattern when the first
field is not an integer, let's use the {} when __cplusplus is
defined.
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
This commit is contained in:
parent
8d30204ca4
commit
f0667be8b5
1 changed files with 7 additions and 1 deletions
|
|
@ -278,8 +278,14 @@ vk_spec_info_to_nir_spirv(const VkSpecializationInfo *spec_info,
|
|||
|
||||
#define STACK_ARRAY_SIZE 8
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define STACK_ARRAY_ZERO_INIT {}
|
||||
#else
|
||||
#define STACK_ARRAY_ZERO_INIT {0}
|
||||
#endif
|
||||
|
||||
#define STACK_ARRAY(type, name, size) \
|
||||
type _stack_##name[STACK_ARRAY_SIZE] = {0}; \
|
||||
type _stack_##name[STACK_ARRAY_SIZE] = STACK_ARRAY_ZERO_INIT; \
|
||||
type *const name = \
|
||||
((size) <= STACK_ARRAY_SIZE ? _stack_##name : (type *)malloc((size) * sizeof(type)))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue