From: Ivan Maidanski Date: Tue, 18 Oct 2016 10:19:09 +0000 (+0300) Subject: Workaround 'variable hides enumerator with same name' cppcheck warnings X-Git-Tag: v7.6.2~397 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e54a2810dc2e507970e5cbbfa83da7b5a6505a9;p=gc 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. --- diff --git a/include/new_gc_alloc.h b/include/new_gc_alloc.h index 8255b11b..fba2bfde 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); }