summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-12-19 12:12:34 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-12-19 12:12:34 +0300
commit6e9495c51d7e5b4febaab3b1f63b9c6b75a68cae (patch)
tree288d36a463e5c9ccc5c3479a9174a58840f1fe05 /src
parent66e49fa506692ceaa917faa3565b3dc3b7f3bbc2 (diff)
downloadlibatomic_ops-6e9495c51d7e5b4febaab3b1f63b9c6b75a68cae.tar.gz
Workaround 'argument to function assert is always 1' cppcheck warnings
* src/atomic_ops_malloc.c (get_chunk): Skip assertion about my_chunk_ptr value alignment if CPPCHECK. * tests/test_malloc.c (DEFAULT_NTHREADS): Add comment about the maximum value. * tests/test_malloc.c (main): Remove assertion of nthreads value which is set to DEFAULT_NTHREADS (ideally there should be a static_assert). * tests/test_stack.c (main): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/atomic_ops_malloc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/atomic_ops_malloc.c b/src/atomic_ops_malloc.c
index 955ff22..07962d3 100644
--- a/src/atomic_ops_malloc.c
+++ b/src/atomic_ops_malloc.c
@@ -233,7 +233,9 @@ get_chunk(void)
> AO_INITIAL_HEAP_SIZE - CHUNK_SIZE)) {
/* We failed. The initial heap is used up. */
my_chunk_ptr = get_mmaped(CHUNK_SIZE);
- assert(((AO_t)my_chunk_ptr & (ALIGNMENT-1)) == 0);
+# if !defined(CPPCHECK)
+ assert(((AO_t)my_chunk_ptr & (ALIGNMENT-1)) == 0);
+# endif
break;
}
if (AO_compare_and_swap(&initial_heap_ptr, (AO_t)my_chunk_ptr,