Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFC: fix hardwired constants
@ 2012-01-19 12:38 Gary Benson
  2012-01-19 12:47 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Benson @ 2012-01-19 12:38 UTC (permalink / raw)
  To: gdb-patches

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

Hi all,

This is a cleanup I made while poking around in the blockvector code.
I think it's obvious but I wanted to check; I've not invoked the
obvious rule before.

Thanks,
Gary

-- 
http://gbenson.net/

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 961 bytes --]

2012-01-19  Gary Benson  <gbenson@redhat.com>

	* mdebugread.c (sort_blocks): Replace integer constants with ones
	derived from FIRST_LOCAL_BLOCK.

diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index c95c09b..e6d3b8c 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -4713,7 +4713,7 @@ sort_blocks (struct symtab *s)
 {
   struct blockvector *bv = BLOCKVECTOR (s);
 
-  if (BLOCKVECTOR_NBLOCKS (bv) <= 2)
+  if (BLOCKVECTOR_NBLOCKS (bv) <= FIRST_LOCAL_BLOCK)
     {
       /* Cosmetic */
       if (BLOCK_END (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)) == 0)
@@ -4728,7 +4728,7 @@ sort_blocks (struct symtab *s)
    * are very different.  It would be nice to find a reliable test
    * to detect -O3 images in advance.
    */
-  if (BLOCKVECTOR_NBLOCKS (bv) > 3)
+  if (BLOCKVECTOR_NBLOCKS (bv) > FIRST_LOCAL_BLOCK + 1)
     qsort (&BLOCKVECTOR_BLOCK (bv, FIRST_LOCAL_BLOCK),
 	   BLOCKVECTOR_NBLOCKS (bv) - FIRST_LOCAL_BLOCK,
 	   sizeof (struct block *),

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

* Re: RFC: fix hardwired constants
  2012-01-19 12:38 RFC: fix hardwired constants Gary Benson
@ 2012-01-19 12:47 ` Pedro Alves
  2012-01-19 15:33   ` [commit] " Gary Benson
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2012-01-19 12:47 UTC (permalink / raw)
  To: gdb-patches

On 01/19/2012 12:00 PM, Gary Benson wrote:
> Hi all,
> 
> This is a cleanup I made while poking around in the blockvector code.
> I think it's obvious but I wanted to check; I've not invoked the
> obvious rule before.

I think is obvious too.  Go ahead and check it in.

-- 
Pedro Alves


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

* [commit] Re: RFC: fix hardwired constants
  2012-01-19 12:47 ` Pedro Alves
@ 2012-01-19 15:33   ` Gary Benson
  0 siblings, 0 replies; 3+ messages in thread
From: Gary Benson @ 2012-01-19 15:33 UTC (permalink / raw)
  To: gdb-patches

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

Pedro Alves wrote:
> On 01/19/2012 12:00 PM, Gary Benson wrote:
> > This is a cleanup I made while poking around in the blockvector
> > code.  I think it's obvious but I wanted to check; I've not
> > invoked the obvious rule before.
> 
> I think is obvious too.  Go ahead and check it in.

Thanks Pedro, I've committed it now.

Cheers,
Gary

-- 
http://gbenson.net/

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1537 bytes --]

Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.13748
retrieving revision 1.13749
diff -u -r1.13748 -r1.13749
--- gdb/ChangeLog	18 Jan 2012 18:58:42 -0000	1.13748
+++ gdb/ChangeLog	19 Jan 2012 12:51:04 -0000	1.13749
@@ -1,3 +1,8 @@
+2012-01-19  Gary Benson  <gbenson@redhat.com>
+
+	* mdebugread.c (sort_blocks): Replace integer constants with ones
+	derived from FIRST_LOCAL_BLOCK.
+
 2012-01-18  Paul Pluzhnikov  <ppluzhnikov@google.com>
 	    Jan Kratochvil  <jan.kratochvil@redhat.com>
 
Index: gdb/mdebugread.c
===================================================================
RCS file: /cvs/src/src/gdb/mdebugread.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -r1.127 -r1.128
--- gdb/mdebugread.c	4 Jan 2012 08:17:06 -0000	1.127
+++ gdb/mdebugread.c	19 Jan 2012 12:51:04 -0000	1.128
@@ -4713,7 +4713,7 @@
 {
   struct blockvector *bv = BLOCKVECTOR (s);
 
-  if (BLOCKVECTOR_NBLOCKS (bv) <= 2)
+  if (BLOCKVECTOR_NBLOCKS (bv) <= FIRST_LOCAL_BLOCK)
     {
       /* Cosmetic */
       if (BLOCK_END (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)) == 0)
@@ -4728,7 +4728,7 @@
    * are very different.  It would be nice to find a reliable test
    * to detect -O3 images in advance.
    */
-  if (BLOCKVECTOR_NBLOCKS (bv) > 3)
+  if (BLOCKVECTOR_NBLOCKS (bv) > FIRST_LOCAL_BLOCK + 1)
     qsort (&BLOCKVECTOR_BLOCK (bv, FIRST_LOCAL_BLOCK),
 	   BLOCKVECTOR_NBLOCKS (bv) - FIRST_LOCAL_BLOCK,
 	   sizeof (struct block *),

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

end of thread, other threads:[~2012-01-19 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-19 12:38 RFC: fix hardwired constants Gary Benson
2012-01-19 12:47 ` Pedro Alves
2012-01-19 15:33   ` [commit] " Gary Benson

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