pan/genxml: Make sure pan_pack() evaluates 'dst' only once

Will be useful for the cs_builder, where we have

and we don't want cs_alloc_ins() to be called more than once.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Antonino Maniscalco <antonino.maniscalco@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26358>
This commit is contained in:
Boris Brezillon 2024-02-18 15:26:31 +01:00 committed by Marge Bot
parent 2d44800079
commit 8e303b9350

View file

@ -120,7 +120,7 @@ __gen_unpack_padded(const uint8_t *restrict cl, uint32_t start, uint32_t end)
#define pan_pack(dst, T, name) \\
for (struct PREFIX1(T) name = { PREFIX2(T, header) }, \\
*_loop_terminate = (void *) (dst); \\
*_loop_terminate = &name; \\
__builtin_expect(_loop_terminate != NULL, 1); \\
({ PREFIX2(T, pack)((uint32_t *) (dst), &name); \\
_loop_terminate = NULL; }))