Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83408 - trunk/tools/build/v2/engine
From: steven_at_[hidden]
Date: 2013-03-11 13:23:07


Author: steven_watanabe
Date: 2013-03-11 13:23:07 EDT (Mon, 11 Mar 2013)
New Revision: 83408
URL: http://svn.boost.org/trac/boost/changeset/83408

Log:
Prevent incorrect reordering with xlc -qalias=ansi. Fixes #7093.
Text files modified:
   trunk/tools/build/v2/engine/lists.c | 21 +++++++++------------
   trunk/tools/build/v2/engine/lists.h | 1 +
   2 files changed, 10 insertions(+), 12 deletions(-)

Modified: trunk/tools/build/v2/engine/lists.c
==============================================================================
--- trunk/tools/build/v2/engine/lists.c (original)
+++ trunk/tools/build/v2/engine/lists.c 2013-03-11 13:23:07 EDT (Mon, 11 Mar 2013)
@@ -13,10 +13,7 @@
 
 #include <assert.h>
 
-
-struct freelist_node { struct freelist_node * next; };
-
-static struct freelist_node * freelist[ 32 ]; /* junkpile for list_dealloc() */
+static LIST * freelist[ 32 ]; /* junkpile for list_dealloc() */
 
 static unsigned get_bucket( unsigned size )
 {
@@ -30,9 +27,9 @@
     unsigned const bucket = get_bucket( size );
     if ( freelist[ bucket ] )
     {
- struct freelist_node * result = freelist[ bucket ];
- freelist[ bucket ] = result->next;
- return (LIST *)result;
+ LIST * result = freelist[ bucket ];
+ freelist[ bucket ] = result->impl.next;
+ return result;
     }
     return (LIST *)BJAM_MALLOC( sizeof( LIST ) + ( 1u << bucket ) *
         sizeof( OBJECT * ) );
@@ -42,7 +39,7 @@
 {
     unsigned size = list_length( l );
     unsigned bucket;
- struct freelist_node * node = (struct freelist_node *)l;
+ LIST * node = l;
 
     if ( size == 0 ) return;
 
@@ -51,7 +48,7 @@
 #ifdef BJAM_NO_MEM_CACHE
     BJAM_FREE( node );
 #else
- node->next = freelist[ bucket ];
+ node->impl.next = freelist[ bucket ];
     freelist[ bucket ] = node;
 #endif
 }
@@ -372,11 +369,11 @@
     int i;
     for ( i = 0; i < sizeof( freelist ) / sizeof( freelist[ 0 ] ); ++i )
     {
- struct freelist_node * l = freelist[ i ];
+ LIST * l = freelist[ i ];
         while ( l )
         {
- struct freelist_node * const tmp = l;
- l = l->next;
+ LIST * const tmp = l;
+ l = l->impl.next;
             BJAM_FREE( tmp );
         }
     }

Modified: trunk/tools/build/v2/engine/lists.h
==============================================================================
--- trunk/tools/build/v2/engine/lists.h (original)
+++ trunk/tools/build/v2/engine/lists.h 2013-03-11 13:23:07 EDT (Mon, 11 Mar 2013)
@@ -54,6 +54,7 @@
 typedef struct _list {
     union {
         int size;
+ struct _list * next;
         OBJECT * align;
     } impl;
 } LIST;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk