List Info

Thread: -Wno-missing-init?




-Wno-missing-init?
country flaguser name
Canada
2007-03-14 21:39:31
I seem to recall that we have people here who are close to
the group of
people who decide what will be bought back by the gcc
folks.

I'm going to add -W{no-,}missing-init, for fine-grained
control over
incomplete initializer warnings.  In particular, I don't
want those
warnings, but I do want the rest of the stuff -W gets me
(some of which
isn't available any other way).  I'm wondering if there's
any point in
my preparing patches to send back to the gcc people, or if
this will
have to remain a private patch.

/~ The ASCII				der Mouse
 / Ribbon Campaign
 X  Against HTML	       mouserodents.montreal.qc.ca
/  Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3
27 4B

Re: -Wno-missing-init?
country flaguser name
South Africa
2007-03-15 01:36:19
On Wed, 14 Mar 2007, der Mouse wrote:
> I'm going to add -W{no-,}missing-init, for fine-grained
control over
> incomplete initializer warnings.  In particular, I
don't want those
> warnings, but I do want the rest of the stuff -W gets
me

That sounds useful.

I'd actually like to get warnings about missing braces and
missing
initialisers in most cases, but not in the case where a
struct is
initialised by .  For example, I want a warning about
missing braces
if I do

	struct s {int i;};
	struct s array[2] = {1, 2}; /* should be {, } */

and I want a warning about incomplete initialisers for
this:

	struct t {int i, j;};
	struct t array[2] = {, }; /* should be {{1, 0}, {2,
0}} */

but I don't want any warning at all if I do

	struct opaque foo = ;
	struct opaque array[2] = {, };


NetBSD's code is riddled with struct assignments that use

	structvar = {.somefield = 0};

to get the effects that should be available from

	structvar = ;

I consider the version with  to be better style, the C99
standard
specifies the same meaning for both, but the version with
 triggers
from warnings from gcc.

--apb (Alan Barrett)

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )