svn commit: r295768 - head/usr.sbin/iostat

Gleb Smirnoff glebius at FreeBSD.org
Fri Feb 19 23:32:54 UTC 2016


On Sat, Feb 20, 2016 at 12:23:40AM +0100, Dimitry Andric wrote:
D> You got this warning, most likely:
D> 
D> usr.sbin/iostat/iostat.c:122:15: error: missing field 'n_type' initializer [-Werror,-Wmissing-field-initializers]
D>         { "_tty_nin" },
D>                      ^
D> 
D> This warning is only produced when you use -Wall -W, and then initialize
D> structs partially, i.e. you initialize some fields but not others.  I
D> think this is a quite reasonable warning for a high warning level.
D> 
D> On the other hand, if this kind of construct is used throughout the
D> tree, and it is not seen as a big problem, we can simply silence this
D> particular warning using -Wno-missing-field -initializers.  There is
D> already quite a list of warnings which are suppressed by default, even
D> at WARNS=6, namely:
D> 
D> -Wno-empty-body
D> -Wno-format-y2k
D> -Wno-pointer-sign
D> -Wno-string-plus-int
D> -Wno-unused-const-variable
D> -Wno-unused-parameter

I think we should add -Wno-missing-field-initializers there. We use this
feature in the kernel intentionally, since it allows to write code that
is less dependant on API changes.

-- 
Totus tuus, Glebius.


More information about the svn-src-head mailing list