1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Suppress -Wshadow=local warnings in REG_DEBUG code.

Our Solaris-camp buildfarm animals (billbug, hake, pollock, so far)
are complaining about dumpcolors()'s local variables in the wake of
3ee0edb91.  This is unsurprising on one level, since that code
clearly violates the new expectation; but AFAICS these animals
aren't explicitly enabling -DREG_DEBUG, so how are they reaching
the now-faulty code?  Do Solaris' headers #define that?

In any case, the fix is simple enough, just narrow the
declaration scopes of this function's loop variables.
(I could have done that only to "c", but thought it best
to maintain a consistent style in this function.)

I don't see any need to back-patch this.
This commit is contained in:
Tom Lane
2026-09-24 13:28:05 -04:00
parent 2c6f2c5e17
commit 9261642909

View File

@@ -1127,7 +1127,6 @@ dumpcolors(struct colormap *cm,
struct colordesc *cd;
struct colordesc *end;
color co;
chr c;
fprintf(f, "max %ld\n", (long) cm->max);
end = CDEND(cm);
@@ -1144,7 +1143,7 @@ dumpcolors(struct colormap *cm,
/*
* Unfortunately, it's hard to do this next bit more efficiently.
*/
for (c = CHR_MIN; c <= MAX_SIMPLE_CHR; c++)
for (chr c = CHR_MIN; c <= MAX_SIMPLE_CHR; c++)
if (GETCOLOR(cm, c) == co)
dumpchr(c, f);
fprintf(f, "\n");
@@ -1153,24 +1152,22 @@ dumpcolors(struct colormap *cm,
/* dump the high colormap if it contains anything interesting */
if (cm->hiarrayrows > 1 || cm->hiarraycols > 1)
{
int r,
c;
const color *rowptr;
fprintf(f, "other:\t");
for (c = 0; c < cm->hiarraycols; c++)
for (int c = 0; c < cm->hiarraycols; c++)
{
fprintf(f, "\t%ld", (long) cm->hicolormap[c]);
}
fprintf(f, "\n");
for (r = 0; r < cm->numcmranges; r++)
for (int r = 0; r < cm->numcmranges; r++)
{
const color *rowptr;
dumpchr(cm->cmranges[r].cmin, f);
fprintf(f, "..");
dumpchr(cm->cmranges[r].cmax, f);
fprintf(f, ":");
rowptr = &cm->hicolormap[cm->cmranges[r].rownum * cm->hiarraycols];
for (c = 0; c < cm->hiarraycols; c++)
for (int c = 0; c < cm->hiarraycols; c++)
{
fprintf(f, "\t%ld", (long) rowptr[c]);
}