mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-19 09:18:10 +02:00
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>
|
||
|---|---|---|
| .. | ||
| pds | ||
| winsys | ||
| meson.build | ||
| pvr_blit.c | ||
| pvr_blit.h | ||
| pvr_bo.c | ||
| pvr_bo.h | ||
| pvr_border.c | ||
| pvr_border.h | ||
| pvr_buffer.h | ||
| pvr_clear.c | ||
| pvr_clear.h | ||
| pvr_cmd_buffer.c | ||
| pvr_cmd_buffer.h | ||
| pvr_common.h | ||
| pvr_csb.c | ||
| pvr_csb.h | ||
| pvr_csb_enum_helpers.h | ||
| pvr_descriptor_set.c | ||
| pvr_descriptor_set.h | ||
| pvr_device.c | ||
| pvr_device.h | ||
| pvr_dump_bo.c | ||
| pvr_dump_bo.h | ||
| pvr_dump_csb.c | ||
| pvr_formats.c | ||
| pvr_formats.h | ||
| pvr_framebuffer.h | ||
| pvr_hw_pass.c | ||
| pvr_hw_pass.h | ||
| pvr_image.c | ||
| pvr_image.h | ||
| pvr_job_common.c | ||
| pvr_job_common.h | ||
| pvr_job_compute.c | ||
| pvr_job_compute.h | ||
| pvr_job_context.c | ||
| pvr_job_context.h | ||
| pvr_job_render.c | ||
| pvr_job_render.h | ||
| pvr_job_transfer.c | ||
| pvr_job_transfer.h | ||
| pvr_macros.h | ||
| pvr_pass.c | ||
| pvr_pass.h | ||
| pvr_pipeline.c | ||
| pvr_pipeline.h | ||
| pvr_query.c | ||
| pvr_query.h | ||
| pvr_query_compute.c | ||
| pvr_queue.c | ||
| pvr_queue.h | ||
| pvr_robustness.c | ||
| pvr_robustness.h | ||
| pvr_spm.c | ||
| pvr_spm.h | ||
| pvr_tex_state.c | ||
| pvr_tex_state.h | ||
| pvr_transfer_frag_store.c | ||
| pvr_transfer_frag_store.h | ||
| pvr_usc.c | ||
| pvr_usc.h | ||
| pvr_wsi.c | ||
| pvr_wsi.h | ||