4 x warning: suggest explicit braces to avoid ambiguous 'else'

Give compiler the extra braces it recommends.

DBio.c edited as my original change was caught out by the incorrect
indention of the 'else' keyword and my modification would have caused a
NULL deref.   Exactly the kind of issue this warning is trying to prevent.

CmdTZ.c:417:20: warning: suggest explicit braces to avoid ambiguous 'else'
DBio.c:1422:12: warning: suggest explicit braces to avoid ambiguous 'else'
DBpaint2.c:285:12: warning: suggest explicit braces to avoid ambiguous 'else'
DBpaint2.c:384:12: warning: suggest explicit braces to avoid ambiguous 'else'

GCC14 -Wall cleanup series [-Wdangling-else]
This commit is contained in:
Darryl L. Miles 2024-10-04 17:13:24 +01:00 committed by Tim Edwards
parent 7dfdf5aa63
commit 9225fa6cf1
3 changed files with 9 additions and 2 deletions

View File

@ -415,10 +415,12 @@ CmdTech(w, cmd)
for (ctype = TT_TECHDEPBASE; ctype < DBNumUserLayers; ctype++)
if (DBIsContact(ctype))
{
if (TTMaskHasType(&DBActiveLayerBits, ctype))
DBUnlockContact(ctype);
else
DBLockContact(ctype);
}
for (ctype = DBNumUserLayers; ctype < DBNumTypes; ctype++)
{

View File

@ -1420,9 +1420,10 @@ dbReadOpen(cellDef, setFileName, dereference, errptr)
pptr = strrchr(sptr, '.');
if (pptr != NULL)
{
if (strcmp(pptr, DBSuffix)) pptr = NULL;
else
*pptr = '\0';
else *pptr = '\0';
}
/* If dereferencing, then use search paths first */
if (!dereference)

View File

@ -283,6 +283,7 @@ DBPaintValid(cellDef, rect, mask, dinfo)
for (t = TT_SELECTBASE; t < DBNumUserLayers; t++)
if (TTMaskHasType(&mmask, t))
{
if (DBIsContact(t))
{
tMask = DBResidueMask(t);
@ -310,6 +311,7 @@ DBPaintValid(cellDef, rect, mask, dinfo)
(t << 14) : t) : t);
DBPaint(cellDef, rect, tloc);
}
}
}
/*
@ -382,6 +384,7 @@ DBEraseValid(cellDef, rect, mask, dinfo)
for (t = TT_SELECTBASE; t < DBNumUserLayers; t++)
if (TTMaskHasType(&mmask, t))
{
if (DBIsContact(t))
{
tMask = DBResidueMask(t);
@ -409,4 +412,5 @@ DBEraseValid(cellDef, rect, mask, dinfo)
(t << 14) : t) : t);
DBErase(cellDef, rect, tloc);
}
}
}