Patchwork tsan.c: mark tsan_atomic_table as constant

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

Comments

David Malcolm - June 5, 2013, 2:40 a.m.
The table of struct tsan_map_atomic within tsan.c is never modified, 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-05  David Malcolm  <dmalcolm@redhat.com>

	* tsan.c (tsan_atomic_table): Make const.
Konstantin Serebryany - June 5, 2013, 9:27 a.m.
On Wed, Jun 5, 2013 at 6:40 AM, David Malcolm <dmalcolm@redhat.com> wrote:
> The table of struct tsan_map_atomic within tsan.c is never modified, 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?

Looks good, thanks.

--kcc

>
> 2013-06-05  David Malcolm  <dmalcolm@redhat.com>
>
>         * tsan.c (tsan_atomic_table): Make const.
>
David Malcolm - June 5, 2013, 10:15 a.m.
On Wed, 2013-06-05 at 13:27 +0400, Konstantin Serebryany wrote:
> On Wed, Jun 5, 2013 at 6:40 AM, David Malcolm <dmalcolm@redhat.com> wrote:
> > The table of struct tsan_map_atomic within tsan.c is never modified, 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?
> 
> Looks good, thanks.

Thanks; committed to SVN trunk as r199690.

Patch

Index: gcc/tsan.c
===================================================================
--- gcc/tsan.c	(revision 199679)
+++ gcc/tsan.c	(working copy)
@@ -198,7 +198,7 @@ 
 
 /* Table how to map sync/atomic builtins to their corresponding
    tsan equivalents.  */
-static struct tsan_map_atomic
+static const struct tsan_map_atomic
 {
   enum built_in_function fcode, tsan_fcode;
   enum tsan_atomic_action action;