1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-16 17:07:43 +03:00

Silence compiler warnings on clang 21

Clang 21 shows some new compiler warnings, for example:

warning: variable 'dstsize' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer]

The fix is to initialize the variables when they are defined.  This is
similar to, for example, the existing situation in gistKeyIsEQ().

Discussion: https://www.postgresql.org/message-id/flat/6604ad6e-5934-43ac-8590-15113d6ae4b1%40eisentraut.org
This commit is contained in:
Peter Eisentraut
2025-09-12 07:27:48 +02:00
parent 2d756ebbe8
commit e92677e863
2 changed files with 3 additions and 3 deletions

View File

@@ -135,7 +135,7 @@ toast_save_datum(Relation rel, Datum value,
char data[TOAST_MAX_CHUNK_SIZE + VARHDRSZ];
/* ensure union is aligned well enough: */
int32 align_it;
} chunk_data;
} chunk_data = {0}; /* silence compiler warning */
int32 chunk_size;
int32 chunk_seq = 0;
char *data_p;

View File

@@ -157,7 +157,7 @@ gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len,
{
int i;
GistEntryVector *evec;
int attrsize;
int attrsize = 0; /* silence compiler warning */
evec = (GistEntryVector *) palloc((len + 2) * sizeof(GISTENTRY) + GEVHDRSZ);
@@ -242,7 +242,7 @@ gistMakeUnionKey(GISTSTATE *giststate, int attno,
char padding[2 * sizeof(GISTENTRY) + GEVHDRSZ];
} storage;
GistEntryVector *evec = &storage.gev;
int dstsize;
int dstsize = 0; /* silence compiler warning */
evec->n = 2;