From: therapy AT ripco DOT com (Blackbear) Newsgroups: comp.os.msdos.djgpp,gnu.gcc.help,gnu.g++.help Subject: braces warning in DJGPP Date: 5 Dec 1999 23:05:48 GMT Organization: None Lines: 76 Message-ID: <82er4c$b06$1@gail.ripco.com> NNTP-Posting-Host: foley.ripco.com X-Trace: gail.ripco.com 944435148 11270 209.100.227.6 (5 Dec 1999 23:05:48 GMT) X-Complaints-To: usenet AT gail DOT ripco DOT com NNTP-Posting-Date: 5 Dec 1999 23:05:48 GMT X-Newsreader: TIN [version 1.2 PL2] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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: 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 }; 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 --