Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit] cli/cli-script.c, script_from_file, add a break stmt for lint
@ 2011-03-03  0:16 Michael Snyder
  2011-03-03  9:48 ` Pedro Alves
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Snyder @ 2011-03-03  0:16 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 13 bytes --]

checked in.


[-- Attachment #2: break8.txt --]
[-- Type: text/plain, Size: 712 bytes --]

2011-03-02  Michael Snyder  <msnyder@vmware.com>

	* cli/cli-script.c (script_from_file): Add break for lint.

Index: cli/cli-script.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-script.c,v
retrieving revision 1.66
diff -u -p -u -p -r1.66 cli-script.c
--- cli/cli-script.c	6 Jan 2011 00:57:02 -0000	1.66
+++ cli/cli-script.c	3 Mar 2011 00:11:55 -0000
@@ -1641,6 +1641,7 @@ script_from_file (FILE *stream, const ch
 	throw_error (e.error,
 		     _("%s:%d: Error in sourced command file:\n%s"),
 		     source_file_name, source_line_number, e.message);
+	break;	/* lint */
       default:
 	internal_error (__FILE__, __LINE__, _("bad reason"));
       }

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

* Re: [commit] cli/cli-script.c, script_from_file, add a break stmt for lint
  2011-03-03  0:16 [commit] cli/cli-script.c, script_from_file, add a break stmt for lint Michael Snyder
@ 2011-03-03  9:48 ` Pedro Alves
  2011-03-03 17:33   ` Michael Snyder
  0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2011-03-03  9:48 UTC (permalink / raw)
  To: gdb-patches; +Cc: Michael Snyder

On Thursday 03 March 2011 00:15:55, Michael Snyder wrote:
> checked in.

>   2011-03-02  Michael Snyder  <msnyder@vmware.com>
> 
>         * cli/cli-script.c (script_from_file): Add break for lint.

>         throw_error (e.error,
>                      _("%s:%d: Error in sourced command file:\n%s"),
>                      source_file_name, source_line_number, e.message);
> +       break;  /* lint */

Please don't.  Teach lint about the no-return property of throw_error instead.

>        default:
>         internal_error (__FILE__, __LINE__, _("bad reason"));
>        }

-- 
Pedro Alves


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

* Re: [commit] cli/cli-script.c, script_from_file, add a break stmt for lint
  2011-03-03  9:48 ` Pedro Alves
@ 2011-03-03 17:33   ` Michael Snyder
  2011-03-03 17:48     ` Tom Tromey
  2011-03-03 17:59     ` Pedro Alves
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Snyder @ 2011-03-03 17:33 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Pedro Alves wrote:
> On Thursday 03 March 2011 00:15:55, Michael Snyder wrote:
>> checked in.
> 
>>   2011-03-02  Michael Snyder  <msnyder@vmware.com>
>>
>>         * cli/cli-script.c (script_from_file): Add break for lint.
> 
>>         throw_error (e.error,
>>                      _("%s:%d: Error in sourced command file:\n%s"),
>>                      source_file_name, source_line_number, e.message);
>> +       break;  /* lint */
> 
> Please don't.  Teach lint about the no-return property of throw_error instead.
> 
>>        default:
>>         internal_error (__FILE__, __LINE__, _("bad reason"));
>>        }
> 

I used "lint" loosely, to mean any checker including a human.
It makes things clearer.  There is plenty of precident in gdb:

language.c:  return (struct type *) 0;  /* For lint */
mt-tdep.c:          default:            /* lint */
valarith.c:  return 0;                  /* For lint -- never reached */
valops.c:  return 0;                    /* For lint -- never reached.  */
value.c:  return 0;                     /* Placate lint.  */


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

* Re: [commit] cli/cli-script.c, script_from_file, add a break stmt for lint
  2011-03-03 17:33   ` Michael Snyder
@ 2011-03-03 17:48     ` Tom Tromey
  2011-03-03 17:59     ` Pedro Alves
  1 sibling, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2011-03-03 17:48 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Pedro Alves, gdb-patches

>>>>> "Michael" == Michael Snyder <msnyder@vmware.com> writes:

Michael> I used "lint" loosely, to mean any checker including a human.

Which one was it in this case?

I think people reading GDB absolutely must know that error,
throw_exception, and some other things cannot return.  Otherwise many
areas of the code will make no sense.

If there is a code checker that doesn't realize this, then it is also
going to spit out a lot of bad reports about GDB.

Michael> It makes things clearer.  There is plenty of precident in gdb:

If we had to choose, I would say these should be removed, rather than
new ones added.

Tom


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

* Re: [commit] cli/cli-script.c, script_from_file, add a break stmt for lint
  2011-03-03 17:33   ` Michael Snyder
  2011-03-03 17:48     ` Tom Tromey
@ 2011-03-03 17:59     ` Pedro Alves
  2011-03-04 18:21       ` Michael Snyder
  1 sibling, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2011-03-03 17:59 UTC (permalink / raw)
  To: gdb-patches; +Cc: Michael Snyder

On Thursday 03 March 2011 17:33:05, Michael Snyder wrote:
> > Please don't.  Teach lint about the no-return property of throw_error instead.
> > 
> >>        default:
> >>         internal_error (__FILE__, __LINE__, _("bad reason"));
> >>        }
> > 
> 
> I used "lint" loosely, to mean any checker including a human.

Well, so did I then.  :-)

> It makes things clearer.

I disagree.

-- 
Pedro Alves


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

* Re: [commit] cli/cli-script.c, script_from_file, add a break stmt for lint
  2011-03-03 17:59     ` Pedro Alves
@ 2011-03-04 18:21       ` Michael Snyder
  2011-03-04 18:24         ` Tom Tromey
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Snyder @ 2011-03-04 18:21 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Pedro Alves wrote:
> On Thursday 03 March 2011 17:33:05, Michael Snyder wrote:
>>> Please don't.  Teach lint about the no-return property of throw_error instead.
>>>
>>>>        default:
>>>>         internal_error (__FILE__, __LINE__, _("bad reason"));
>>>>        }
>> I used "lint" loosely, to mean any checker including a human.
> 
> Well, so did I then.  :-)
> 
>> It makes things clearer.
> 
> I disagree.
> 

OK then.  Reverting this patch.



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

* Re: [commit] cli/cli-script.c, script_from_file, add a break stmt for lint
  2011-03-04 18:21       ` Michael Snyder
@ 2011-03-04 18:24         ` Tom Tromey
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2011-03-04 18:24 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Pedro Alves, gdb-patches

Michael> OK then.  Reverting this patch.

There was another one as well.

Tom


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

end of thread, other threads:[~2011-03-04 18:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-03  0:16 [commit] cli/cli-script.c, script_from_file, add a break stmt for lint Michael Snyder
2011-03-03  9:48 ` Pedro Alves
2011-03-03 17:33   ` Michael Snyder
2011-03-03 17:48     ` Tom Tromey
2011-03-03 17:59     ` Pedro Alves
2011-03-04 18:21       ` Michael Snyder
2011-03-04 18:24         ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox