From: Syd Polk <spolk@redhat.com>
To: tromey@cygnus.com
Cc: Insight List <insight@sourceware.cygnus.com>
Subject: Re: Patch: fixlet in gdbtk-cmds.c
Date: Tue, 28 Nov 2000 23:51:00 -0000 [thread overview]
Message-ID: <3A245282.C01BFEE6@redhat.com> (raw)
In-Reply-To: <87wvdn4krn.fsf@creche.cygnus.com>
This all seems quite wacky. I don't know enough about the code to
comment, but it smells really bad.
I would rather have a global variable for whether a gdbtk command
generated the error as opposed to Tcl itself rather than messing with
interp result flags. This is just asking to break when the interp data
structure is changed.
I will examine this more in a couple of weeks.
Tom Tromey wrote:
>
> Syd> Approved, although I would have preferred using
> Syd> Tcl_WrongNumArgs. That would give a slightly different error
> Syd> message, however, and that might break some tests.
>
> I looked at this some more.
>
> No gdbtk tests test any command for the wrong number of arguments. So
> we're free to change this however we want.
>
> Some of the code in gdbtk-cmds.c is quite bad. For instance there are
> functions which do no checking, or incorrect checking, of the number
> of arguments they are given.
>
> I discovered that if I just use Tcl_WrongNumArgs and return TCL_ERROR,
> I don't get the right result, because you also have to do this:
>
> result_ptr->flags |= GDBTK_IN_TCL_RESULT;
>
> Note that I changed all the functions in gdbtk-cmds.c that did any
> argument number checking to use Tcl_WrongNumArgs. However this issue
> has to be resolved first :-(. I didn't bother fixing all the
> commands, since my time on Insight is limited and I doubt this sort of
> cleanup is very high priority.
>
> If we really do have to set result_ptr->flags, that's fine --
> but I'd like to add a macro like this:
>
> #define RETURN_TCL_ERROR \
> result_ptr->flags |= GDBTK_IN_TCL_RESULT; \
> return TCL_ERROR
>
> Then we can just use `RETURN_TCL_ERROR;' all over. This is ugly, but
> imho more maintainable than remembering to put an assignment
> everywhere we return TCL_ERROR.
>
> OTOH I don't understand this comment in call_wrapper:
>
> /*
> * Now copy the result over to the true Tcl result. If GDBTK_TO_RESULT flag
> * bit is set , this just copies a null object over to the Tcl result,
> * which is fine because we should reset the result in this case anyway.
> */
>
> First, the comment seems to lie. It mentions GDBTK_TO_RESULT, which
> makes sense, but the code actually checks for GDBTK_IN_TCL_RESULT.
>
> Ok, I just read the comments in gdbtk.h and it makes a bit more
> sense. But wouldn't it be easier to adopt the heuristic that if a
> wrapped command returns TCL_ERROR then we should assume that the
> interpreter's result is already correctly set? Are there cases where
> we explicitly (as opposed to via error()) return TCL_ERROR but rely on
> the call wrapper to set the result? That seems strange.
>
> Tom
next prev parent reply other threads:[~2000-11-28 23:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-28 10:34 Tom Tromey
2000-11-28 12:55 ` Syd Polk
2000-11-28 13:46 ` Tom Tromey
2000-11-28 14:47 ` Syd Polk
2000-11-28 17:32 ` Tom Tromey
2000-11-28 23:51 ` Syd Polk [this message]
2000-11-29 13:48 ` Tom Tromey
2000-11-29 18:41 ` Syd Polk
2000-11-29 20:07 ` Fernando Nasser
2000-11-30 9:09 ` Tom Tromey
2000-11-30 9:57 ` Fernando Nasser
[not found] <Syd>
[not found] ` <Polk's>
[not found] ` <message>
[not found] ` <of>
[not found] ` <"Wed,>
[not found] ` <"28>
[not found] ` <"Tue,>
[not found] ` <"Mon,>
[not found] ` <01>
[not found] ` <May>
[not found] ` <2000>
[not found] ` <09:07:18>
[not found] ` <-0700>
2000-04-29 7:21 ` make check in itcl Andreas Jaeger
2000-05-01 9:05 ` Syd Polk
2000-05-01 9:27 ` Andreas Jaeger
2000-05-01 10:15 ` Syd Polk
2000-05-01 10:58 ` Andreas Jaeger
2000-05-01 11:21 ` Syd Polk
2000-05-03 10:37 ` Syd Polk
2000-05-03 12:05 ` Andreas Jaeger
2000-05-03 12:37 ` Syd Polk
2000-05-04 2:34 ` Andrew Cagney
[not found] ` <09:17:35>
[not found] ` <-0800>
2000-11-21 16:03 ` rename to insight Tom Tromey
[not found] ` <mailpost.974851789.4627@postal.sibyte.com>
2000-11-22 9:42 ` Chris G. Demetriou
2000-11-22 10:29 ` Tom Tromey
2000-11-28 9:18 ` Chris G. Demetriou
2000-11-28 9:34 ` Tom Tromey
2000-11-28 12:52 ` Syd Polk
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=3A245282.C01BFEE6@redhat.com \
--to=spolk@redhat.com \
--cc=insight@sourceware.cygnus.com \
--cc=tromey@cygnus.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).