Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: drow@false.org
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: Warning fixes
Date: Thu, 28 Dec 2006 22:56:00 -0000	[thread overview]
Message-ID: <200612282256.kBSMu65R022410@brahms.sibelius.xs4all.nl> (raw)
In-Reply-To: <20061228195828.GA18628@nevyn.them.org> (message from Daniel 	Jacobowitz on Thu, 28 Dec 2006 14:58:28 -0500)

> Date: Thu, 28 Dec 2006 14:58:28 -0500
> From: Daniel Jacobowitz <drow@false.org>
> 
> Any comments on these, or shall I commit them?  Regardless of the configure
> patch, we might as well fix the bugs.

Some of these are really scary.  Can you check for regressions on i386 Linux?

The only thing that bothers me is this one:

> Index: signals/signals.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/signals/signals.c,v
> retrieving revision 1.11
> diff -u -p -r1.11 signals.c
> --- signals/signals.c	28 Nov 2006 19:45:07 -0000	1.11
> +++ signals/signals.c	28 Dec 2006 19:42:04 -0000
> @@ -219,7 +219,7 @@ static struct {
>  char *
>  target_signal_to_string (enum target_signal sig)
>  {
> -  if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST))
> +  if (sig <= TARGET_SIGNAL_LAST)
>      return signals[sig].string;
>    else
>      return signals[TARGET_SIGNAL_UNKNOWN].string;
> @@ -229,8 +229,7 @@ target_signal_to_string (enum target_sig
>  char *
>  target_signal_to_name (enum target_signal sig)
>  {
> -  if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST)
> -      && signals[sig].name != NULL)
> +  if (sig <= TARGET_SIGNAL_LAST && signals[sig].name != NULL)
>      return signals[sig].name;
>    else
>      /* I think the code which prints this will always print it along

ISO C clearly states that enumeration constants have type 'int', so
sig could be negative, and we defenitely want to catch that case.  If
GCC thinks it knows that (sig >= TARGET_SIGNAL_FIRST), I think it is
being too smart for its own good.

Mark


  reply	other threads:[~2006-12-28 22:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-28 19:58 Daniel Jacobowitz
2006-12-28 22:56 ` Mark Kettenis [this message]
2006-12-28 23:08   ` Andreas Schwab
2006-12-28 23:09   ` Daniel Jacobowitz
2006-12-29  3:48     ` Daniel Jacobowitz
2007-01-03 19:01       ` Daniel Jacobowitz
2006-12-29 12:15     ` Eli Zaretskii
2007-01-03 18:47       ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200612282256.kBSMu65R022410@brahms.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox