From 3a66bae1d8f05f812dcc1be30af4ce878343530b Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 14 Feb 2010 14:40:58 -0500 Subject: [svn-r18253] Description: Bring r18252 from trunk to 1.8 branch: Rename test macros that are [nearly] identical to source code macros to have "TEST" in their names, to avoid conflicts during compilation. (And add comment to originals in source code, to keep them in sync). Tested on: Mac OS X/32 10.6.2 (amazon) w/debug & production up041 machines (at Sandia) --- src/H5Cpkg.h | 3 +++ test/cache_common.c | 2 +- test/cache_common.h | 21 ++++++++++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index bd2ea8e..b76a91a 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -1812,6 +1812,7 @@ if ( ( (cache_ptr) == NULL ) || \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Pre HT remove SC failed") \ } +/* (Keep in sync w/H5C_TEST__PRE_HT_SEARCH_SC macro in test/cache_common.h -QAK) */ #define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ @@ -1823,6 +1824,7 @@ if ( ( (cache_ptr) == NULL ) || \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "Pre HT search SC failed") \ } +/* (Keep in sync w/H5C_TEST__POST_SUC_HT_SEARCH_SC macro in test/cache_common.h -QAK) */ #define H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k, fail_val) \ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ @@ -1846,6 +1848,7 @@ if ( ( (cache_ptr) == NULL ) || \ "Post successful HT search SC failed") \ } +/* (Keep in sync w/H5C_TEST__POST_HT_SHIFT_TO_FRONT macro in test/cache_common.h -QAK) */ #define H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \ if ( ( (cache_ptr) == NULL ) || \ ( ((cache_ptr)->index)[k] != (entry_ptr) ) || \ diff --git a/test/cache_common.c b/test/cache_common.c index 9e27c80..b623bac 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -1563,7 +1563,7 @@ entry_in_cache(H5C_t * cache_ptr, HDassert( entry_ptr->type == type ); HDassert( entry_ptr == entry_ptr->self ); - H5C__SEARCH_INDEX(cache_ptr, entry_ptr->addr, test_ptr) + H5C_TEST__SEARCH_INDEX(cache_ptr, entry_ptr->addr, test_ptr) if ( test_ptr != NULL ) { diff --git a/test/cache_common.h b/test/cache_common.h index eb24964..e692a33 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -308,21 +308,25 @@ typedef struct test_entry_t #define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3) #define H5C__HASH_FCN(x) (int)(((x) & H5C__HASH_MASK) >> 3) -#define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr) \ +#define H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ + ( (cache_ptr)->index_size != \ + ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ ( ! H5F_addr_defined(Addr) ) || \ ( H5C__HASH_FCN(Addr) < 0 ) || \ ( H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN ) ) { \ HDfprintf(stdout, "Pre HT search SC failed.\n"); \ } -#define H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \ +#define H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ ( (cache_ptr)->index_len < 1 ) || \ ( (entry_ptr) == NULL ) || \ ( (cache_ptr)->index_size < (entry_ptr)->size ) || \ + ( (cache_ptr)->index_size != \ + ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ ( H5F_addr_ne((entry_ptr)->addr, (Addr)) ) || \ ( (entry_ptr)->size <= 0 ) || \ ( ((cache_ptr)->index)[k] == NULL ) || \ @@ -337,12 +341,18 @@ if ( ( (cache_ptr) == NULL ) || \ HDfprintf(stdout, "Post successful HT search SC failed.\n"); \ } +#define H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \ +if ( ( (cache_ptr) == NULL ) || \ + ( ((cache_ptr)->index)[k] != (entry_ptr) ) || \ + ( (entry_ptr)->ht_prev != NULL ) ) { \ + HDfprintf(stdout, "Post HT shift to front failed.\n"); \ +} -#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \ +#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \ { \ int k; \ int depth = 0; \ - H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr) \ + H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \ k = H5C__HASH_FCN(Addr); \ entry_ptr = ((cache_ptr)->index)[k]; \ while ( ( entry_ptr ) && ( H5F_addr_ne(Addr, (entry_ptr)->addr) ) ) \ @@ -352,7 +362,7 @@ if ( ( (cache_ptr) == NULL ) || \ } \ if ( entry_ptr ) \ { \ - H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \ + H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \ if ( entry_ptr != ((cache_ptr)->index)[k] ) \ { \ if ( (entry_ptr)->ht_next ) \ @@ -365,6 +375,7 @@ if ( ( (cache_ptr) == NULL ) || \ (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ (entry_ptr)->ht_prev = NULL; \ ((cache_ptr)->index)[k] = (entry_ptr); \ + H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \ } \ } \ } -- cgit v0.12