From: Ivan Maidanski Date: Thu, 26 Sep 2019 08:31:27 +0000 (+0300) Subject: Workaround 'condition appendToFile is always false' cppcheck false positive X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a507ddddc74b613982ca0107bf1ea634b368237a;p=gc Workaround 'condition appendToFile is always false' cppcheck false positive * misc.c [(MSWIN32 && !CONSOLE_LOG || MSWINCE) && !MSWINRT_FLAVOR && NO_GETENV_WIN32 && CPPCHECK] (GC_CreateLogFile): Define appendToFile as macro (to FALSE) instead of a local variable; undefine appendToFile at the function. --- diff --git a/misc.c b/misc.c index faa64e63..3247dfc4 100644 --- a/misc.c +++ b/misc.c @@ -1552,7 +1552,11 @@ GC_API void GC_CALL GC_enable_incremental(void) # else TCHAR *logPath; - BOOL appendToFile = FALSE; +# if defined(NO_GETENV_WIN32) && defined(CPPCHECK) +# define appendToFile FALSE +# else + BOOL appendToFile = FALSE; +# endif # if !defined(NO_GETENV_WIN32) || !defined(OLD_WIN32_LOG_FILE) TCHAR pathBuf[_MAX_PATH + 0x10]; /* buffer for path + ext */ @@ -1597,6 +1601,7 @@ GC_API void GC_CALL GC_enable_incremental(void) /* Seek to file end (ignoring any error) */ } # endif +# undef appendToFile # endif return hFile; }