Skip to content

util+treewide: container_of() cleanup

Rob Clark requested to merge robclark/mesa:wip/container-of-cleanup into master

Replace mesa's slightly different container_of() with one more aligned to the linux kernel's version which takes a type as the 2nd param. This avoids silly warnings like:

freedreno_context.c:396:44: warning: variable 'batch' is uninitialized when used within its own initialization [-Wuninitialized]

At the same time, we can add additional build-time type-checking asserts

@kusma @jenatali I think I've covered the MSVC case sufficiently? At least the vs2019 CI job seems happy..

@majanes I updated my meson args based on what you are using, but can't rule out some difference due to missing -devel pkg, etc.. so you might want to feed this to at least the build-test steps in your CI?

Merge request reports