public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Warnings
@ 1999-11-18  7:45 Duane Ellis
  1999-11-18 23:45 ` Warnings Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Duane Ellis @ 1999-11-18  7:45 UTC (permalink / raw)
  To: insight

Here at Franklin, we have an internal requirement that *ALL* code we write
is compiles with no warnings or errors and with these options:

     -Wall -Wmissing-prototypes -Wstrict-prototypes

and in most cases, -Werror also.

The *ONLY* exception to the -Werror is when there is a problem system
header file that issues warnings. {ie: X window header files)

One thing that always shows up when building Insight - and it's many
tools is this warning/error:

utils.c:2938: warning: unused parameter `arg'
utils.c:2939: warning: unused parameter `from_tty'

There are *LOTS* of these, sorting through *THESE* warnings and other
warnings/problems that I am introducing is a real P.I.T.A.

------------------------------------------------------------

We have a standard way of getting rid of this here.

Add the following to "defs.h"

#define GDB_UNUSED_PARM( NAME )		(void)(NAME)

Then, in function in this example in utils.c" would look like this:

static void
pagination_off_command (arg, from_tty)
     char *arg;
     int from_tty;
{
  GDB_UNUSED_PARAM( arg );
  GDB_UNUSED_PARAM( from_tty );
  pagination_enabled = 0;
}
------------------------------------------------------------

Have you guys thought of adding these changes to Insight?

-Duane.

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

* Re: Warnings
  1999-11-18  7:45 Warnings Duane Ellis
@ 1999-11-18 23:45 ` Andrew Cagney
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 1999-11-18 23:45 UTC (permalink / raw)
  To: duane; +Cc: insight

Duane Ellis wrote:
> 
> Here at Franklin, we have an internal requirement that *ALL* code we write
> is compiles with no warnings or errors and with these options:
> 
>      -Wall -Wmissing-prototypes -Wstrict-prototypes
> 
> and in most cases, -Werror also.

For GDB, compiling with most warning flags enabled is a long term goal. 
Right now configuring/building using:

--enable-build-warnings="-Werror\
,$Wimplicit\
,-Wreturn-type\
,-Wcomment\
,-Wtrigraphs\
,-Wformat\
,-Wparentheses\
,-Wpointer-arith\
,-Woverloaded-virtual\
"

is known to build on a number of platforms. I believe people are
currently (slowly) chipping away at more of the unitialized and
prototype warnings.  If you've got patches (and an assgnment) then
patches are welcome.

BTW, the warning options enabled by -Wall were chosen according to a
somewhat arbitrary selection criteria.

[...]
> We have a standard way of getting rid of this here.
> 
> Add the following to "defs.h"
> 
> #define GDB_UNUSED_PARM( NAME )         (void)(NAME)
> 
> Then, in function in this example in utils.c" would look like this:
> 
> static void
> pagination_off_command (arg, from_tty)
>      char *arg;
>      int from_tty;
> {
>   GDB_UNUSED_PARAM( arg );
>   GDB_UNUSED_PARAM( from_tty );
>   pagination_enabled = 0;
> }
> ------------------------------------------------------------
> 
> Have you guys thought of adding these changes to Insight?

Not so far.  GDB's code is riddled with #ifdefs that make it difficult,
in general, to eliminate unused variable warnings (parameters or
locals).  What is used on one host/target is not on a second :-(.

As a personal opinion, I think a better way of getting rid of this
particular warning would be to modify GCC so that it differentiated
between local and parameter variables :-)

	enjoy,
		Andrew

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

end of thread, other threads:[~1999-11-18 23:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-18  7:45 Warnings Duane Ellis
1999-11-18 23:45 ` Warnings Andrew Cagney

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).