2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 00:12:11 +00:00

Prevent incorrect reordering with xlc -qalias=ansi. Fixes #7093.

[SVN r83408]
This commit is contained in:
Steven Watanabe
2013-03-11 17:23:07 +00:00
parent 3f27cb14b2
commit 2a4cd854da
2 changed files with 10 additions and 12 deletions

View File

@@ -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 @@ static LIST * list_alloc( unsigned const size )
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 @@ static void list_dealloc( LIST * l )
{
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 @@ static void list_dealloc( LIST * l )
#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 @@ void list_done()
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 );
}
}

View File

@@ -54,6 +54,7 @@
typedef struct _list {
union {
int size;
struct _list * next;
OBJECT * align;
} impl;
} LIST;