37 x warning: array subscript has type 'char'

Compiler is expressing range concern with the warning mitigated by using
unsigned C array offsets.  This also draws attention to the range concern
when reading the code and making changes.

DBundo.c:263:45: warning: array subscript has type 'char'
DBundo.c:279:49: warning: array subscript has type 'char'
DBundo.c:317:52: warning: array subscript has type 'char'
DBundo.c:318:64: warning: array subscript has type 'char'
DBundo.c:324:52: warning: array subscript has type 'char'
DBundo.c:325:64: warning: array subscript has type 'char'
DBundo.c:329:50: warning: array subscript has type 'char'
DBundo.c:330:58: warning: array subscript has type 'char'
DBundo.c:338:52: warning: array subscript has type 'char'
DBundo.c:339:64: warning: array subscript has type 'char'
DBundo.c:345:52: warning: array subscript has type 'char'
DBundo.c:346:64: warning: array subscript has type 'char'
DBundo.c:350:50: warning: array subscript has type 'char'
DBundo.c:351:58: warning: array subscript has type 'char'
DBundo.c:371:52: warning: array subscript has type 'char'
DBundo.c:372:64: warning: array subscript has type 'char'
DBundo.c:378:52: warning: array subscript has type 'char'
DBundo.c:379:64: warning: array subscript has type 'char'
DBundo.c:383:50: warning: array subscript has type 'char'
DBundo.c:384:58: warning: array subscript has type 'char'
DBundo.c:392:52: warning: array subscript has type 'char'
DBundo.c:393:57: warning: array subscript has type 'char'
DBundo.c:399:52: warning: array subscript has type 'char'
DBundo.c:400:57: warning: array subscript has type 'char'
DBundo.c:403:53: warning: array subscript has type 'char'
DBundo.c:407:50: warning: array subscript has type 'char'
DBundo.c:408:58: warning: array subscript has type 'char'
EFbuild.c:1048:32: warning: array subscript has type 'char'
EFbuild.c:1056:32: warning: array subscript has type 'char'
ExtBasic.c:2358:43: warning: array subscript has type 'char'
ExtBasic.c:2493:43: warning: array subscript has type 'char'
ExtBasic.c:2519:43: warning: array subscript has type 'char'
ExtBasic.c:2644:43: warning: array subscript has type 'char'
ExtBasic.c:2678:43: warning: array subscript has type 'char'
ResPrint.c:143:43: warning: array subscript has type 'char'
plotRutils.c:713:34: warning: array subscript has type 'char'
plotRutils.c:786:29: warning: array subscript has type 'char'

GCC14 -Wall cleanup series [-Wchar-subscripts]
This commit is contained in:
Darryl L. Miles 2024-10-04 17:15:21 +01:00 committed by Tim Edwards
parent 9225fa6cf1
commit d94cd72538
5 changed files with 37 additions and 37 deletions

View File

@ -260,7 +260,7 @@ dbUndoSplitForw(us)
{
/* Create internal fracture */
if (dbUndoLastCell == NULL) return;
DBSplitTile(dbUndoLastCell->cd_planes[us->sue_plane], &us->sue_point,
DBSplitTile(dbUndoLastCell->cd_planes[(unsigned char)us->sue_plane], &us->sue_point,
us->sue_splitx);
}
@ -276,7 +276,7 @@ dbUndoSplitBack(us)
srect.r_ur.p_y = us->sue_point.p_y + 1;
/* Remove internal fracture and restore original split tile */
DBMergeNMTiles0(dbUndoLastCell->cd_planes[us->sue_plane], &srect,
DBMergeNMTiles0(dbUndoLastCell->cd_planes[(unsigned char)us->sue_plane], &srect,
(PaintUndoInfo *)NULL, TRUE);
}
@ -314,20 +314,20 @@ dbUndoPaintForw(up)
loctype = (up->pue_oldtype & TT_LEFTMASK);
dinfo = TT_DIAGONAL | (up->pue_oldtype & TT_DIRECTION);
DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane],
dinfo, &up->pue_rect, DBStdEraseTbl(loctype, up->pue_plane),
DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane],
dinfo, &up->pue_rect, DBStdEraseTbl(loctype, (unsigned char)up->pue_plane),
(PaintUndoInfo *) NULL);
loctype = (up->pue_oldtype & TT_RIGHTMASK) >> 14;
dinfo |= TT_SIDE;
DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane],
dinfo, &up->pue_rect, DBStdEraseTbl(loctype, up->pue_plane),
DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane],
dinfo, &up->pue_rect, DBStdEraseTbl(loctype, (unsigned char)up->pue_plane),
(PaintUndoInfo *) NULL);
}
else
DBPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], &up->pue_rect,
DBStdEraseTbl(up->pue_oldtype, up->pue_plane),
DBPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect,
DBStdEraseTbl(up->pue_oldtype, (unsigned char)up->pue_plane),
(PaintUndoInfo *) NULL);
if (up->pue_newtype & TT_DIAGONAL)
@ -335,20 +335,20 @@ dbUndoPaintForw(up)
loctype = (up->pue_newtype & TT_LEFTMASK);
dinfo = TT_DIAGONAL | (up->pue_newtype & TT_DIRECTION);
DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane],
dinfo, &up->pue_rect, DBStdPaintTbl(loctype, up->pue_plane),
DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane],
dinfo, &up->pue_rect, DBStdPaintTbl(loctype, (unsigned char)up->pue_plane),
(PaintUndoInfo *) NULL);
loctype = (up->pue_newtype & TT_RIGHTMASK) >> 14;
dinfo |= TT_SIDE;
DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane],
dinfo, &up->pue_rect, DBStdPaintTbl(loctype, up->pue_plane),
DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane],
dinfo, &up->pue_rect, DBStdPaintTbl(loctype, (unsigned char)up->pue_plane),
(PaintUndoInfo *) NULL);
}
else
DBPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], &up->pue_rect,
DBStdPaintTbl(up->pue_newtype, up->pue_plane),
DBPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect,
DBStdPaintTbl(up->pue_newtype, (unsigned char)up->pue_plane),
(PaintUndoInfo *) NULL);
endPaintFor:
dbUndoUndid = TRUE;
@ -368,20 +368,20 @@ dbUndoPaintBack(up)
loctype = (up->pue_newtype & TT_LEFTMASK);
dinfo = TT_DIAGONAL | (up->pue_newtype & TT_DIRECTION);
DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane],
dinfo, &up->pue_rect, DBStdEraseTbl(loctype, up->pue_plane),
DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane],
dinfo, &up->pue_rect, DBStdEraseTbl(loctype, (unsigned char)up->pue_plane),
(PaintUndoInfo *) NULL);
loctype = (up->pue_newtype & TT_RIGHTMASK) >> 14;
dinfo |= TT_SIDE;
DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane],
dinfo, &up->pue_rect, DBStdEraseTbl(loctype, up->pue_plane),
DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane],
dinfo, &up->pue_rect, DBStdEraseTbl(loctype, (unsigned char)up->pue_plane),
(PaintUndoInfo *) NULL);
}
else
DBPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], &up->pue_rect,
DBStdEraseTbl(up->pue_newtype, up->pue_plane),
DBPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect,
DBStdEraseTbl(up->pue_newtype, (unsigned char)up->pue_plane),
(PaintUndoInfo *) NULL);
if (up->pue_oldtype & TT_DIAGONAL)
@ -389,23 +389,23 @@ dbUndoPaintBack(up)
loctype = (up->pue_oldtype & TT_LEFTMASK);
dinfo = TT_DIAGONAL | (up->pue_oldtype & TT_DIRECTION);
DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], dinfo,
&up->pue_rect, DBStdPaintTbl(loctype, up->pue_plane),
DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], dinfo,
&up->pue_rect, DBStdPaintTbl(loctype, (unsigned char)up->pue_plane),
(PaintUndoInfo *) NULL);
loctype = (up->pue_oldtype & TT_RIGHTMASK) >> 14;
dinfo |= TT_SIDE;
DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], dinfo,
&up->pue_rect, DBStdPaintTbl(loctype, up->pue_plane),
DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], dinfo,
&up->pue_rect, DBStdPaintTbl(loctype, (unsigned char)up->pue_plane),
(PaintUndoInfo *) NULL);
DBMergeNMTiles0(dbUndoLastCell->cd_planes[up->pue_plane],
DBMergeNMTiles0(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane],
&up->pue_rect, (PaintUndoInfo *)NULL, TRUE);
}
else
DBPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], &up->pue_rect,
DBStdPaintTbl(up->pue_oldtype, up->pue_plane),
DBPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect,
DBStdPaintTbl(up->pue_oldtype, (unsigned char)up->pue_plane),
(PaintUndoInfo *) NULL);
endPaintBack:

View File

@ -1045,7 +1045,7 @@ efBuildDevice(def, class, type, r, argc, argv)
&& (ttype != extGetDevType(EFDevTypes[newdev->dev_type]))))
{
TxError("Device %s %s at (%d, %d) overlaps incompatible device %s %s!\n",
extDevTable[class], type, r->r_xbot, r->r_ybot,
extDevTable[(unsigned char)class], type, r->r_xbot, r->r_ybot,
extDevTable[newdev->dev_class], EFDevTypes[newdev->dev_type]);
return 0;
}
@ -1053,7 +1053,7 @@ efBuildDevice(def, class, type, r, argc, argv)
{
TxError("Device %s %s at (%d, %d) overlaps device with incompatible"
" number of terminals (%d vs. %d)!\n",
extDevTable[class], type, r->r_xbot, r->r_ybot, nterminals,
extDevTable[(unsigned char)class], type, r->r_xbot, r->r_ybot, nterminals,
newdev->dev_nterm);
return 0;
}

View File

@ -2355,7 +2355,7 @@ extOutputDevices(def, transList, outFile)
{
case DEV_FET: /* old style, perimeter & area */
fprintf(outFile, "%s %s",
extDevTable[devptr->exts_deviceClass],
extDevTable[(unsigned char)devptr->exts_deviceClass],
devptr->exts_deviceName);
fprintf(outFile, " %d %d %d %d",
@ -2490,7 +2490,7 @@ extOutputDevices(def, transList, outFile)
devptr = extDevFindParamMatch(devptr, length, width);
fprintf(outFile, "%s %s",
extDevTable[devptr->exts_deviceClass],
extDevTable[(unsigned char)devptr->exts_deviceClass],
devptr->exts_deviceName);
fprintf(outFile, " %d %d %d %d",
@ -2516,7 +2516,7 @@ extOutputDevices(def, transList, outFile)
case DEV_PDIODE:
devptr = extDevFindParamMatch(devptr, length, width);
fprintf(outFile, "%s %s",
extDevTable[devptr->exts_deviceClass],
extDevTable[(unsigned char)devptr->exts_deviceClass],
devptr->exts_deviceName);
fprintf(outFile, " %d %d %d %d",
@ -2641,7 +2641,7 @@ extOutputDevices(def, transList, outFile)
devptr = extDevFindParamMatch(devptr, length, width);
fprintf(outFile, "%s %s",
extDevTable[devptr->exts_deviceClass],
extDevTable[(unsigned char)devptr->exts_deviceClass],
devptr->exts_deviceName);
fprintf(outFile, " %d %d %d %d",
@ -2675,7 +2675,7 @@ extOutputDevices(def, transList, outFile)
case DEV_CAPREV:
case DEV_CSUBCKT:
fprintf(outFile, "%s %s",
extDevTable[devptr->exts_deviceClass],
extDevTable[(unsigned char)devptr->exts_deviceClass],
devptr->exts_deviceName);
fprintf(outFile, " %d %d %d %d",

View File

@ -710,7 +710,7 @@ PlotTextSize(font, string, area)
{
if ((*string == ' ') || (*string == '\t'))
d = &font->fo_chars['t'];
else d = &font->fo_chars[*string];
else d = &font->fo_chars[(unsigned char)*string];
if (d->nbytes == 0) continue;
if (d->up > area->r_ytop)
area->r_ytop = d->up;
@ -783,7 +783,7 @@ PlotRasterText(raster, clip, font, string, point)
* area of the raster.
*/
d = &font->fo_chars[*string];
d = &font->fo_chars[(unsigned char)*string];
cBytesPerLine = (d->left + d->right + 7) >> 3;
for (i = 0; i < d->up + d->down; i++)
{

View File

@ -140,7 +140,7 @@ ResPrintExtDev(outextfile, devices)
fprintf(outextfile,"device ");
fprintf(outextfile,"%s %s %d %d %d %d ",
extDevTable[devptr->exts_deviceClass],
extDevTable[(unsigned char)devptr->exts_deviceClass],
devptr->exts_deviceName,
devices->layout->rd_inside.r_ll.p_x,
devices->layout->rd_inside.r_ll.p_y,