Skip to content

Commit

Permalink
Workaround 'uninitialized variable' cppcheck FP in LOAD_WORD_OR_CONTINUE
Browse files Browse the repository at this point in the history
(fix of commit 9ddbbae)

Issue #411 (bdwgc).

* include/private/gc_priv.h (LOCAL_VAR_INIT_OK): Define macro (to "=0"
if CPPCHECK).
* include/private/gc_priv.h [E2K && USE_PTR_HWTAG]
(LOAD_WORD_OR_CONTINUE): Attribute tag local variable with
LOCAL_VAR_INIT_OK.
  • Loading branch information
ivmai committed Jan 13, 2022
1 parent 5d831bf commit 8c549d3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/private/gc_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ typedef int GC_bool;
#if defined(CPPCHECK)
# define MACRO_BLKSTMT_BEGIN {
# define MACRO_BLKSTMT_END }
# define LOCAL_VAR_INIT_OK =0 /* to avoid "uninit var" false positive */
#else
# define MACRO_BLKSTMT_BEGIN do {
# define MACRO_BLKSTMT_END } while (0)
# define LOCAL_VAR_INIT_OK /* empty */
#endif

#if defined(M68K) && defined(__GNUC__)
Expand Down Expand Up @@ -2004,7 +2006,7 @@ GC_INNER void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *),

# define LOAD_WORD_OR_CONTINUE(v, p) \
{ \
int tag; \
int tag LOCAL_VAR_INIT_OK; \
LOAD_TAGGED_VALUE(v, tag, p); \
if (tag != 0) continue; \
}
Expand Down

0 comments on commit 8c549d3

Please sign in to comment.