braces warning in DJGPP
Blackbear
therapy@ripco.com
Sun Dec 5 15:12:00 GMT 1999
Hello everyone.
I like to compile using the `-Wall' flag so that
the compiler can catch possible errors for me.
For warnings that I don't want to see, I then
put "-Wno-xxxxx" options after "-Wall" on
the command line -- to turn off those warnings.
But there is one warning that I can't disable. When I
create a structure like so:
struct decoder {
int value;
const char * name;
};
static struct decoder basic_msgs [] = {
1, "first",
2, "second",
3, "third",
.
.
.
};
The compiler issues a warning:
histbase.m:36: warning: missing braces around initializer
histbase.m:36: warning: (near initialization for `basic_msgs[0]')
The compiler wants me to place braces around each element
in the array. I don't want to do that for this type of
array since it's unnecessary.
The info file for gcc says that the option `-W' enables
this warning. This is what info says:
<quote>
The following `-W...' options are not implied by `-Wall'. Some of
them warn about constructions that users generally do not consider
questionable, but which occasionally you might wish to check for;
others warn about constructions that are necessary or hard to avoid in
some cases, and there is no simple way to modify the code to suppress
the warning.
`-W'
Print extra warning messages for these events:
[...]
* An aggregate has a partly bracketed initializer. For
example, the following code would evoke such a warning,
because braces are missing around the initializer for `x.h':
struct s { int f, g; };
struct t { struct s h; int i; };
struct t x = { 1, 2, 3 };
</quote>
So INFO says that "-Wall" does not set this warning option. But
in my experience it seems to. Also, "-W" by itself DOES NOT enable
this warning, and so INFO seems to be wrong. "-Wno" is an invalid
option. How do I disable this warning?
I'm using the GCC 2.95.1 that is a part of DJGPP.
Can anyone help me?
Thanks in advance.
therapy at ripco dot com
--
More information about the Gcc-help
mailing list