Patchwork tree-object-size.c: mark "unknown" as const

login
register
mail settings
Submitter David Malcolm
Date June 7, 2013, 5:40 p.m.
Message ID <1370626800.2126.21.camel@surprise>
Download mbox | patch
Permalink /patch/249778/
State New
Headers show

Comments

David Malcolm - June 7, 2013, 5:40 p.m.
The array "unknown" within tree-object-size.c is only ever read from,
not written to, so it can be marked as const.

Successfully bootstrapped on x86_64-unknown-linux-gnu (using
gcc-4.7.2-2.fc17.x86_64).

OK for trunk?

2013-06-07  David Malcolm  <dmalcolm@redhat.com>

	* tree-object-size.c (unknown): Make const.
Jakub Jelinek - June 7, 2013, 6:49 p.m.
On Fri, Jun 07, 2013 at 01:40:00PM -0400, David Malcolm wrote:
> The array "unknown" within tree-object-size.c is only ever read from,
> not written to, so it can be marked as const.
> 
> Successfully bootstrapped on x86_64-unknown-linux-gnu (using
> gcc-4.7.2-2.fc17.x86_64).
> 
> OK for trunk?
> 
> 2013-06-07  David Malcolm  <dmalcolm@redhat.com>
> 
> 	* tree-object-size.c (unknown): Make const.

Ok, thanks.

	Jakub
David Malcolm - June 7, 2013, 7:15 p.m.
On Fri, 2013-06-07 at 20:49 +0200, Jakub Jelinek wrote:
> On Fri, Jun 07, 2013 at 01:40:00PM -0400, David Malcolm wrote:
> > The array "unknown" within tree-object-size.c is only ever read from,
> > not written to, so it can be marked as const.
> > 
> > Successfully bootstrapped on x86_64-unknown-linux-gnu (using
> > gcc-4.7.2-2.fc17.x86_64).
> > 
> > OK for trunk?
> > 
> > 2013-06-07  David Malcolm  <dmalcolm@redhat.com>
> > 
> > 	* tree-object-size.c (unknown): Make const.
> 
> Ok, thanks.

Thanks; committed to SVN trunk as r199832.
Jeff Law - June 11, 2013, 4:23 p.m.
On 06/07/13 11:40, David Malcolm wrote:
> The array "unknown" within tree-object-size.c is only ever read from,
> not written to, so it can be marked as const.
>
> Successfully bootstrapped on x86_64-unknown-linux-gnu (using
> gcc-4.7.2-2.fc17.x86_64).
>
> OK for trunk?
>
> 2013-06-07  David Malcolm  <dmalcolm@redhat.com>
>
> 	* tree-object-size.c (unknown): Make const.
OK for the trunk.

Thanks,

jeff

Patch

Index: gcc/tree-object-size.c
===================================================================
--- gcc/tree-object-size.c	(revision 199816)
+++ gcc/tree-object-size.c	(working copy)
@@ -39,7 +39,7 @@ 
   unsigned int *stack, *tos;
 };
 
-static unsigned HOST_WIDE_INT unknown[4] = { -1, -1, 0, 0 };
+static const unsigned HOST_WIDE_INT unknown[4] = { -1, -1, 0, 0 };
 
 static tree compute_object_offset (const_tree, const_tree);
 static unsigned HOST_WIDE_INT addr_object_size (struct object_size_info *,