mesa/src/broadcom
Alyssa Rosenzweig b824ef83ab util/dynarray: infer type in append
Most of the time, we can infer the type to append in
util_dynarray_append using __typeof__, which is standardized in C23 and
support in Jesse's MSMSVCV. This patch drops the type argument most of
the time, making util_dynarray a little more ergonomic to use.

This is done in four steps.

First, rename util_dynarray_append -> util_dynarray_append_typed

    bash -c "find . -type f -exec sed -i -e 's/util_dynarray_append(/util_dynarray_append_typed(/g' \{} \;"

Then, add a new append that infers the type. This is much more ergonomic
for what you want most of the time.

Next, use type-inferred append as much as possible, via Coccinelle
patch (plus manual fixup):

    @@
    expression dynarray, element;
    type type;
    @@

    -util_dynarray_append_typed(dynarray, type, element);
    +util_dynarray_append(dynarray, element);

Finally, hand fixup cases that Coccinelle missed or incorrectly
translated, of which there were several because we can't used the
untyped append with a literal (since the sizeof won't do what you want).

All four steps are squashed to produce a single patch changing every
util_dynarray_append call site in tree to either drop a type parameter
(if possible) or insert a _typed suffix (if we can't infer). As such,
the final patch is best reviewed by hand even though it was
tool-assisted.

No Long Linguine Meals were involved in the making of this patch.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38038>
2025-10-24 18:32:07 +00:00
..
ci broadcom/ci: unlock more CI-Tron jobs 2025-10-24 10:00:26 +00:00
cle v3d: use Texture Data Formats enum in Texture Shader State struct 2025-09-26 07:35:15 +00:00
clif build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
common broadcom/common: Add subgroup support to CSD super-group packing 2025-10-13 08:25:24 +02:00
compiler broadcom/common: Add subgroup support to CSD super-group packing 2025-10-13 08:25:24 +02:00
drm-shim v3d/drm-shim: add support for multisync 2025-08-04 08:06:36 +02:00
ds broadcom: Add perfetto data source 2024-12-13 12:29:11 +00:00
perfcntrs broadcom: Add perfcount library 2024-12-02 14:13:24 +00:00
qpu v3d/compiler: Add unpacking instructions for normalised 16bit formats. 2025-09-30 12:48:41 +00:00
simulator util/dynarray: infer type in append 2025-10-24 18:32:07 +00:00
vulkan util/dynarray: infer type in append 2025-10-24 18:32:07 +00:00
.editorconfig
meson.build broadcom: Add perfetto data source 2024-12-13 12:29:11 +00:00