From: smccam Date: Sat, 18 Dec 2010 02:32:20 +0000 (+0000) Subject: Silence some legitimate warnings about int to pointer casts that would X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=082c2486f793fc31e5e6139565ae5d6f77454e55;p=francis%2Fstp.git Silence some legitimate warnings about int to pointer casts that would fail on 64-bit systems by turning them into runtime assertions instead. git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@1037 e59a4935-1847-0410-ae03-e826735625c1 --- diff --git a/src/extlib-abc/vecAtt.h b/src/extlib-abc/vecAtt.h index bef4f9f..d2df497 100644 --- a/src/extlib-abc/vecAtt.h +++ b/src/extlib-abc/vecAtt.h @@ -137,9 +137,13 @@ static inline void * Vec_AttFree( Vec_Att_t * p, int fFreeMan ) int i; if ( p->pArrayInt ) { + /* This code would not work on a 64-bit platform, + so let's hope it's unused. Though I've added a (long) + cast below to silence a relevant GCC warning. */ + assert(sizeof(int) == sizeof(void *)); for ( i = 0; i < p->nCap; i++ ) if ( p->pArrayInt[i] ) - p->pFuncFreeObj( p->pMan, (void *)p->pArrayInt[i] ); + p->pFuncFreeObj( p->pMan, (void *)(long)p->pArrayInt[i] ); } else { @@ -177,10 +181,15 @@ static inline void Vec_AttClear( Vec_Att_t * p ) int i; if ( p->pArrayInt ) { - if ( p->pFuncFreeObj ) + if ( p->pFuncFreeObj ) { + /* This code would not work on a 64-bit platform, + so let's hope it's unused. Though I've added a (long) + cast below to silence a relevant GCC warning. */ + assert(sizeof(int) == sizeof(void *)); for ( i = 0; i < p->nCap; i++ ) if ( p->pArrayInt[i] ) - p->pFuncFreeObj( p->pMan, (void *)p->pArrayInt[i] ); + p->pFuncFreeObj( p->pMan, (void *)(long)p->pArrayInt[i] ); + } } else { @@ -214,8 +223,13 @@ static inline void Vec_AttFreeEntry( Vec_Att_t * p, int i ) return; if ( p->pMan ) { - if ( p->pArrayInt[i] && p->pFuncFreeObj ) - p->pFuncFreeObj( p->pMan, (void *)p->pArrayInt[i] ); + if ( p->pArrayInt[i] && p->pFuncFreeObj ) { + /* This code would not work on a 64-bit platform, + so let's hope it's unused. Though I've added a (long) + cast below to silence a relevant GCC warning. */ + assert(sizeof(int) == sizeof(void *)); + p->pFuncFreeObj( p->pMan, (void *)(long)p->pArrayInt[i] ); + } if ( p->pArrayPtr[i] && p->pFuncFreeObj ) p->pFuncFreeObj( p->pMan, (void *)p->pArrayPtr[i] ); }