It is common to zero-initialize not only scalar variables,
but also structs. This is also defensive programming and
we shouldn't complain about that.
rdar://34122265
Differential D99262
[analyzer] Fix dead store checker false positive vsavchenko on Mar 24 2021, 6:53 AM. Authored by
Details It is common to zero-initialize not only scalar variables, rdar://34122265
Diff Detail
Event TimelineComment Actions I see your point. Would it report this issue? int test() { struct Foo foo = {0, 0}; // I would expect a warning here, that 'foo' was initialized but never read. (void)foo; return 0; } Only nits besides this.
Comment Actions We should at least document it as testcase.
Comment Actions Looks great and I'm also curious about nested initializers.
Comment Actions Looks good. Thank you.
Comment Actions I guess it will do for PODs, but for regular C++ types we have an early exit until we learn about side effects from constructors. Comment Actions Thanks for addressing the nested lists! (And sorry for the late reply, I was on vacation) |
I don't see any new code that would depend on this header.