@@ -3512,7 +3512,7 @@ void CheckOther::unusedLabelError(const Token* tok, bool inSwitch, bool hasIfdef
35123512 if (hasIfdef)
35133513 id += " Configuration" ;
35143514
3515- std::string msg = " $symbol:" + (tok ? tok->str () : emptyString ) + " \n Label '$symbol' is not used." ;
3515+ std::string msg = " $symbol:" + (tok ? tok->str () : " " ) + " \n Label '$symbol' is not used." ;
35163516 if (hasIfdef)
35173517 msg += " There is #if in function body so the label might be used in code that is removed by the preprocessor." ;
35183518 if (inSwitch)
@@ -4325,7 +4325,7 @@ void CheckOther::checkOverlappingWrite()
43254325 constexpr bool follow = true ;
43264326 if (!isSameExpression (macro, ptr1, ptr2, *mSettings , pure, follow, &errorPath))
43274327 continue ;
4328- overlappingWriteFunction (tok);
4328+ overlappingWriteFunction (tok, tok-> str () );
43294329 }
43304330 continue ;
43314331 }
@@ -4351,7 +4351,7 @@ void CheckOther::checkOverlappingWrite()
43514351 constexpr bool follow = true ;
43524352 if (!isSameExpression (macro, buf1, buf2, *mSettings , pure, follow, &errorPath))
43534353 continue ;
4354- overlappingWriteFunction (tok);
4354+ overlappingWriteFunction (tok, tok-> str () );
43554355 }
43564356 }
43574357 }
@@ -4362,9 +4362,8 @@ void CheckOther::overlappingWriteUnion(const Token *tok)
43624362 reportError (tok, Severity::error, " overlappingWriteUnion" , " Overlapping read/write of union is undefined behavior" );
43634363}
43644364
4365- void CheckOther::overlappingWriteFunction (const Token *tok)
4365+ void CheckOther::overlappingWriteFunction (const Token *tok, const std::string& funcname )
43664366{
4367- const std::string &funcname = tok ? tok->str () : emptyString;
43684367 reportError (tok, Severity::error, " overlappingWriteFunction" , " Overlapping read/write in " + funcname + " () is undefined behavior" );
43694368}
43704369
@@ -4430,7 +4429,7 @@ void CheckOther::getErrorMessages(ErrorLogger *errorLogger, const Settings *sett
44304429 c.raceAfterInterlockedDecrementError (nullptr );
44314430 c.invalidFreeError (nullptr , " malloc" , false );
44324431 c.overlappingWriteUnion (nullptr );
4433- c.overlappingWriteFunction (nullptr );
4432+ c.overlappingWriteFunction (nullptr , " funcname " );
44344433
44354434 // performance
44364435 c.redundantCopyError (nullptr , " varname" );
0 commit comments