Mark Dilger <hornschnor...@gmail.com> writes:
> On 10/2/19 8:46 AM, Tom Lane wrote:
>> Right.  I think that in general it's bad practice for an initializer
>> to not specify all fields/elements of the target.

> There are numerous locations in the code that raise warnings when
> -Wmissing-field-initializers is handed to gcc.  See, for example, 
> src/backend/utils/adt/formatting.c where
>    static const KeyWord NUM_keywords[]
> is initialized, and the code comment above that disclaims the need to 
> initialize is_digit and date_mode.  Are you proposing cleaning up all 
> such incomplete initializations within the project?

Hmm.  Maybe it's worth doing as a code beautification effort, but
I'm not volunteering.  At the same time, I wouldn't like to make a
change like this, if it introduces dozens/hundreds of new cases.

> I understand that your INIT_ALL_ZEROS macro does nothing to change
> whether -Wmissing-field-initializers would raise a warning.

Not sure --- the name of that option suggests that maybe it only
complains about omitted *struct fields* not omitted *array elements*.

If it does complain, is there any way that we could extend the macro
to annotate usages of it to suppress the warning?

                        regards, tom lane


Reply via email to