From: Doug Evans <dje@google.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] symtab.c: Set "first" to zero.
Date: Thu, 12 Jul 2012 21:33:00 -0000 [thread overview]
Message-ID: <CADPb22RKufnCNSFXkc3kLX2-Gt9n6ZSQbJugHf5jmWEBdSnM_w@mail.gmail.com> (raw)
In-Reply-To: <87629vip17.fsf@fleche.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 565 bytes --]
On Tue, Jul 10, 2012 at 9:01 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>
> Doug> 2012-07-09 Doug Evans <dje@google.com>
> Doug> * symtab.c (maybe_add_partial_symtab_filename): Set "first" to zero
> Doug> after calling filename_seen.
> Doug> (make_source_files_completion_list): Ditto.
>
> I wonder whether filename_seen should clear *first.
>
> Tom
Any preference?
2012-07-12 Doug Evans <dje@google.com>
* symtab.c (filename_seen): Set *first to 0.
(output_source_filename): Update.
[-- Attachment #2: gdb-120712-filename-seen-first-2.patch.txt --]
[-- Type: text/plain, Size: 1924 bytes --]
2012-07-12 Doug Evans <dje@google.com>
* symtab.c (filename_seen): Set *first to 0.
(output_source_filename): Update.
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.316
diff -u -p -r1.316 symtab.c
--- symtab.c 29 Jun 2012 22:46:45 -0000 1.316
+++ symtab.c 12 Jul 2012 21:29:52 -0000
@@ -3108,7 +3108,7 @@ operator_chars (char *p, char **end)
/* If FILE is not already in the table of files, return zero;
otherwise return non-zero. Optionally add FILE to the table if ADD
is non-zero. If *FIRST is non-zero, forget the old table
- contents. */
+ contents and then set *FIRST = 0. */
static int
filename_seen (const char *file, int add, int *first)
@@ -3128,6 +3128,7 @@ filename_seen (const char *file, int add
if (tab == NULL)
tab = (const char **) xmalloc (tab_alloc_size * sizeof (*tab));
tab_cur_size = 0;
+ *first = 0;
}
/* Is FILE in tab? */
@@ -3157,6 +3158,8 @@ filename_seen (const char *file, int add
static void
output_source_filename (const char *name, int *first)
{
+ int is_first = *first;
+
/* Since a single source file can result in several partial symbol
tables, we need to avoid printing it more than once. Note: if
some of the psymtabs are read in and some are not, it gets
@@ -3166,18 +3169,15 @@ output_source_filename (const char *name
situation. I'm not sure whether this can also happen for
symtabs; it doesn't hurt to check. */
- /* Was NAME already seen? */
+ /* Was NAME already seen?
+ Note: filename_seen resets *first. */
if (filename_seen (name, 1, first))
{
/* Yes; don't print it again. */
return;
}
- /* No; print it and reset *FIRST. */
- if (*first)
- {
- *first = 0;
- }
- else
+
+ if (! is_first)
{
printf_filtered (", ");
}
next prev parent reply other threads:[~2012-07-12 21:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-10 0:33 Doug Evans
2012-07-10 16:01 ` Tom Tromey
2012-07-10 17:26 ` Doug Evans
2012-07-12 21:33 ` Doug Evans [this message]
2012-07-13 14:57 ` Tom Tromey
2012-07-13 17:39 ` Doug Evans
2012-07-13 17:48 ` Tom Tromey
2012-07-13 18:41 ` Doug Evans
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=CADPb22RKufnCNSFXkc3kLX2-Gt9n6ZSQbJugHf5jmWEBdSnM_w@mail.gmail.com \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.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