eliminate static analysis complaints about eat.c

This is fairly ridiculous but it prevents the bogus complaints
when compiling eat.c with 'gcc -fanalyzer' about some fields in
gc.context.victual being used without having been initialized.

There's bound to be a better way to handle this and I'm curious
whether it will work with the 'onefile' testing.
This commit is contained in:
PatR
2023-03-05 16:19:32 -08:00
parent b3d5158e64
commit 3ab5e7b380
3 changed files with 17 additions and 0 deletions

View File

@@ -2983,6 +2983,9 @@ use_tin_opener(struct obj *obj)
static int
bite(void)
{
/* hack to pacify static analyzer incorporated into gcc 12.2 */
sa_victual(&gc.context.victual);
if (gc.context.victual.canchoke && u.uhunger >= 2000) {
choke(gc.context.victual.piece);
return 1;