[Mesa-dev] [PATCH 0/3] Fix missing initializer errors in generated tables

Benedikt Schemmer ben at besd.de
Sun Jun 4 20:27:19 UTC 2017


Hi all,

my reasoning wasn't based on how c handles partial initializations,
but on how the generated files look like: like something is missing.

Also I don't want to suppress these warnings, because I don't have
the experience you have with the codebase and would kind of like to
see if my changes have an negative impact or I forgot something.

Benedikt


Am 04.06.2017 um 22:20 schrieb Bas Nieuwenhuizen:
> Hi Marek,
> 
> Do you have any other reasons besides it not improving correctness?
> I'd like to pick at least the radv one, as the code doesn't get less
> clear, and using 5 zeros for struct with 6 members is just plain
> silly.
> 
> - Bas
> 
> 
> On Sun, Jun 4, 2017 at 9:57 PM, Marek Olšák <maraeo at gmail.com> wrote:
>> NAK.
>>
>> In C/C++, the initializer is used to clear the memory to 0s, thus,
>> adding 0s to the initializer is redundant and unnecessary. Empty
>> initializer {} is also commonly used instead of memset.
>>
>> You need to suppress this warning if you don't want to see it.
>>
>> Marek
>>
>> On Sun, Jun 4, 2017 at 9:45 AM, Benedikt Schemmer <ben at besd.de> wrote:
>>>
>>> I send these patches as a series because they share the same problem:
>>> all have missing fields in the default initialization path for field/register
>>> definitions.
>>>
>>> This causes several hundreds (thousands?) of "missing initializer" warnings
>>> from the compiler making it hard to spot less frequent errors.
>>>
>>> This also fixes a small copy and paste error in vk_format_table.py where
>>> it isnt clear how it is autogenerated from where.
>>>
>>> Please kindly review and push if you find this useful.
>>>
>>> Thanks,
>>> Benedikt
>>>
>>> Benedikt Schemmer (3):
>>>   Fix missing initializer warning in sid_tables.h by adding appropriate
>>>     default fields in sid_tables.py
>>>   Fix missing initializer warning in egd_tables.h by adding appropriate
>>>     default fields in egd_tables.py
>>>   Fix missing initializer warning in vk_format_table.h by adding
>>>     appropriate default fields in vk_format_table.py
>>>
>>>  src/amd/common/sid_tables.py           | 4 ++--
>>>  src/amd/vulkan/vk_format_table.py      | 4 ++--
>>>  src/gallium/drivers/r600/egd_tables.py | 4 ++--
>>>  3 files changed, 6 insertions(+), 6 deletions(-)
>>>
>>> --
>>> 2.11.0
>>>


More information about the mesa-dev mailing list