From d6637c91fb36bd165a227b5f75d470d2e7cd1960 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 18 Oct 2016 13:19:09 +0300 Subject: [PATCH] Workaround 'variable hides enumerator with same name' cppcheck warnings * include/new_gc_alloc.h (GC_bytes_per_word, GC_word_alignment): Define as const unsigned (instead of single-item enum) if CPPCHECK. --- include/new_gc_alloc.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/new_gc_alloc.h b/include/new_gc_alloc.h index 9d00cff..0833fd8 100644 --- a/include/new_gc_alloc.h +++ b/include/new_gc_alloc.h @@ -98,11 +98,15 @@ enum { GC_PTRFREE = 0, GC_NORMAL = 1, GC_UNCOLLECTABLE = 2, enum { GC_max_fast_bytes = 255 }; -enum { GC_bytes_per_word = sizeof(char *) }; - enum { GC_byte_alignment = 8 }; -enum { GC_word_alignment = GC_byte_alignment/GC_bytes_per_word }; +#if defined(CPPCHECK) + const unsigned GC_bytes_per_word = sizeof(char *); + const unsigned GC_word_alignment = GC_byte_alignment/GC_bytes_per_word; +#else + enum { GC_bytes_per_word = sizeof(char *) }; + enum { GC_word_alignment = GC_byte_alignment/GC_bytes_per_word }; +#endif inline void * &GC_obj_link(void * p) { return *reinterpret_cast(p); } -- 2.7.4