public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* braces warning in DJGPP
@ 1999-12-05 15:12 Blackbear
  1999-12-06  6:04 ` Blackbear
  1999-12-31 22:24 ` Blackbear
  0 siblings, 2 replies; 6+ messages in thread
From: Blackbear @ 1999-12-05 15:12 UTC (permalink / raw)
  To: help-gcc

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


--

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: braces warning in DJGPP
  1999-12-05 15:12 braces warning in DJGPP Blackbear
@ 1999-12-06  6:04 ` Blackbear
  1999-12-11 17:28   ` passing options through g++/gcc to linker Dave Topham
  1999-12-31 22:24   ` braces warning in DJGPP Blackbear
  1999-12-31 22:24 ` Blackbear
  1 sibling, 2 replies; 6+ messages in thread
From: Blackbear @ 1999-12-06  6:04 UTC (permalink / raw)
  To: help-gcc

I've solved the problem. I looked at the compiler
souce to find "-Wno-missing-braces".

Blackbear (therapy@ripco.com) wrote:
: 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]')

^ permalink raw reply	[flat|nested] 6+ messages in thread

* passing options through g++/gcc to linker
  1999-12-06  6:04 ` Blackbear
@ 1999-12-11 17:28   ` Dave Topham
  1999-12-31 22:24     ` Dave Topham
  1999-12-31 22:24   ` braces warning in DJGPP Blackbear
  1 sibling, 1 reply; 6+ messages in thread
From: Dave Topham @ 1999-12-11 17:28 UTC (permalink / raw)
  To: help-gcc

I would like to compile/link a program on Unix (SunOS) using g++/gcc
that specifies where the runtime library resides on the host machine. I
read in these pages a suggestion to pass options to the linker in one of
these ways:

g++ -Wl,-rpath,<path>
or
g++ -Xlinker -rpath -Xlinker <path>

Yet, when I try that (although there are no messages from complier or
linker that I see)
and then do the "ldd" command to see what libs the runtime file (a.out)
will use,
it is the same as if I don't specify the path.

e.g.  <path> (in above commands) set to    /mydir/lib    (where my
libstdc++.so.2.8.1 resides)
I thought would change the output of:
ldd a.out
from
/opt/gnu/lib/libstdc++.so.2.8.1
 to
/mydir/lib/libstdc++.so.2.8.1

I still don't understand how this works yet. Can anyone enlighten me?
Thank you, Dave


^ permalink raw reply	[flat|nested] 6+ messages in thread

* braces warning in DJGPP
  1999-12-05 15:12 braces warning in DJGPP Blackbear
  1999-12-06  6:04 ` Blackbear
@ 1999-12-31 22:24 ` Blackbear
  1 sibling, 0 replies; 6+ messages in thread
From: Blackbear @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

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


--

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: braces warning in DJGPP
  1999-12-06  6:04 ` Blackbear
  1999-12-11 17:28   ` passing options through g++/gcc to linker Dave Topham
@ 1999-12-31 22:24   ` Blackbear
  1 sibling, 0 replies; 6+ messages in thread
From: Blackbear @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

I've solved the problem. I looked at the compiler
souce to find "-Wno-missing-braces".

Blackbear (therapy@ripco.com) wrote:
: 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]')

^ permalink raw reply	[flat|nested] 6+ messages in thread

* passing options through g++/gcc to linker
  1999-12-11 17:28   ` passing options through g++/gcc to linker Dave Topham
@ 1999-12-31 22:24     ` Dave Topham
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Topham @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

I would like to compile/link a program on Unix (SunOS) using g++/gcc
that specifies where the runtime library resides on the host machine. I
read in these pages a suggestion to pass options to the linker in one of
these ways:

g++ -Wl,-rpath,<path>
or
g++ -Xlinker -rpath -Xlinker <path>

Yet, when I try that (although there are no messages from complier or
linker that I see)
and then do the "ldd" command to see what libs the runtime file (a.out)
will use,
it is the same as if I don't specify the path.

e.g.  <path> (in above commands) set to    /mydir/lib    (where my
libstdc++.so.2.8.1 resides)
I thought would change the output of:
ldd a.out
from
/opt/gnu/lib/libstdc++.so.2.8.1
 to
/mydir/lib/libstdc++.so.2.8.1

I still don't understand how this works yet. Can anyone enlighten me?
Thank you, Dave


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-12-31 22:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-05 15:12 braces warning in DJGPP Blackbear
1999-12-06  6:04 ` Blackbear
1999-12-11 17:28   ` passing options through g++/gcc to linker Dave Topham
1999-12-31 22:24     ` Dave Topham
1999-12-31 22:24   ` braces warning in DJGPP Blackbear
1999-12-31 22:24 ` Blackbear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).