diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-11-23 11:49:31 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-11-23 11:49:31 +0300 |
commit | a613b15ce446f0926b9d0c5232ebd140bfdca9ec (patch) | |
tree | 878abde9a03eaa75b573814afe2717e33da47734 | |
parent | 20cfa75b7b552284c7ec201ed56a11be68a34dd7 (diff) | |
download | bdwgc-a613b15ce446f0926b9d0c5232ebd140bfdca9ec.tar.gz |
Workaround '*_stubborn function is never used' cppcheck warnings
* dbg_mlc.c (GC_debug_malloc_stubborn, GC_debug_change_stubborn): Do
not define if CPPCHECK.
* mallocx.c (GC_malloc_stubborn, GC_end_stubborn_change): Likewise.
* include/gc.h (GC_debug_change_stubborn): Always mark as
GC_ATTR_DEPRECATED (regardless of CPPCHECK).
* tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK]
(main): Remove UNTESTED(GC_debug_change_stubborn).
-rw-r--r-- | dbg_mlc.c | 10 | ||||
-rw-r--r-- | include/gc.h | 6 | ||||
-rw-r--r-- | mallocx.c | 18 | ||||
-rw-r--r-- | tests/test.c | 1 |
4 files changed, 17 insertions, 18 deletions
@@ -619,13 +619,15 @@ STATIC void * GC_debug_generic_malloc(size_t lb, int knd, GC_EXTRA_PARAMS) } #endif /* DBG_HDRS_ALL */ -GC_API void * GC_CALL GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS) -{ +#ifndef CPPCHECK + GC_API void * GC_CALL GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS) + { return GC_debug_malloc(lb, OPT_RA s, i); -} + } -GC_API void GC_CALL GC_debug_change_stubborn( + GC_API void GC_CALL GC_debug_change_stubborn( const void * p GC_ATTR_UNUSED) {} +#endif /* !CPPCHECK */ GC_API void GC_CALL GC_debug_end_stubborn_change(const void *p) { diff --git a/include/gc.h b/include/gc.h index 753b5c9a..b46ebab2 100644 --- a/include/gc.h +++ b/include/gc.h @@ -914,11 +914,7 @@ GC_API void GC_CALL GC_debug_free(void *); GC_API void * GC_CALL GC_debug_realloc(void * /* old_object */, size_t /* new_size_in_bytes */, GC_EXTRA_PARAMS) /* 'realloc' attr */ GC_ATTR_ALLOC_SIZE(2); -GC_API -#if !defined(CPPCHECK) - GC_ATTR_DEPRECATED -#endif -void GC_CALL GC_debug_change_stubborn(const void *); +GC_API GC_ATTR_DEPRECATED void GC_CALL GC_debug_change_stubborn(const void *); GC_API void GC_CALL GC_debug_end_stubborn_change(const void *) GC_ATTR_NONNULL(1); @@ -610,15 +610,17 @@ GC_API GC_ATTR_MALLOC char * GC_CALL GC_strndup(const char *str, size_t size) } #endif /* GC_REQUIRE_WCSDUP */ -GC_API void * GC_CALL GC_malloc_stubborn(size_t lb) -{ - return GC_malloc(lb); -} +#ifndef CPPCHECK + GC_API void * GC_CALL GC_malloc_stubborn(size_t lb) + { + return GC_malloc(lb); + } -GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED) -{ - /* Empty. */ -} + GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED) + { + /* Empty. */ + } +#endif /* !CPPCHECK */ GC_API void GC_CALL GC_end_stubborn_change(const void *p) { diff --git a/tests/test.c b/tests/test.c index 8ec8c13f..bccc8382 100644 --- a/tests/test.c +++ b/tests/test.c @@ -1969,7 +1969,6 @@ void GC_CALLBACK warn_proc(char *msg, GC_word p) UNTESTED(GC_set_stop_func); UNTESTED(GC_set_time_limit); UNTESTED(GC_malloc_explicitly_typed_ignore_off_page); - UNTESTED(GC_debug_change_stubborn); UNTESTED(GC_debug_strndup); UNTESTED(GC_deinit); UNTESTED(GC_strndup); |