C99 structure initialisers and Samba3

Stefan (metze) Metzmacher metze at samba.org
Wed Aug 23 11:10:50 GMT 2006

Hash: SHA1

tridge at samba.org schrieb:
> It's around 130 lines of carefully ordered initialisation in
> Samba3. That also hasn't been converted to C99 style in Samba4 yet,
> but I think it should be. It would be so easy to get that one wrong,
> and I wouldn't be at all confident our test suite would catch it (as
> the test suite tends to test protocols functions, not configure
> options).

I think we should start using -Wmissing-field-initializers in samba3 and
samba4. So that we at least notice when the number of members don't match.

- -Wmissing-field-initializers
  Warn if a structure's initializer has some fields missing.
  For example, the following code would cause such
  a warning, because "x.h" is implicitly zero:

                   struct s { int f, g, h; };
                   struct s x = { 3, 4 };

  This option does not warn about designated initializers, so the
  following modification would not trigger a warning:

                   struct s { int f, g, h; };
                   struct s x = { .f = 3, .g = 4 };

  This warning is included in -Wextra.  To get other -Wextra warnings
  without this one, use -Wextra -Wno-miss-ing-field-initializers.

Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org


More information about the samba-technical mailing list