On 04.06.26 18:36, Tom Lane wrote:
Zakariyah Ali <[email protected]> writes:
Use C99 designated initializers (.type = T_ErrorSaveContext) instead of the
standard initializer {T_ErrorSaveContext} when initializing ErrorSaveContext.
This avoids missing-field-initializers compiler warnings for the remaining
fields of
the struct (e.g. error_occurred).
What compiler produces such warnings? I'm not really eager to make
invasive, more-typing-required changes like this, especially when
it's not obvious that the modified code is any more correct.
I think -Wmissing-field-initializers was meant here.
It looks like all of the changes are of the form
- ErrorSaveContext escontext = {T_ErrorSaveContext};
+ ErrorSaveContext escontext = {.type = T_ErrorSaveContext};
Maybe we could do this more elegantly and safer with a non-pointer
variant of makeNode/newNode.
Like
#define initNode(_type_) ((_type_){.type = T_##_type_})
ErrorSaveContext escontext = initNode(ErrorSaveContext);
(Or something else instead of "init".)