Skip to content

Commit 618c64f

Browse files
committed
Revert workarounds for -Wmissing-braces false positives on old GCC
We have collected several instances of a workaround for GCC bug 53119, which caused false-positive compiler warnings. This bug has long been fixed, but was still seen on the buildfarm, most recently on lapwing with gcc (Debian 4.7.2-5). (The GCC bug tracker mentions that a fix was backported to 4.7.4 and 4.8.3.) That compiler no longer runs warning-free since commit 6fdd5d9, so we don't need to keep these workarounds. And furthermore, the consensus appears to be that we don't want to keep supporting that era of platform anymore at all. This reverts the following commits: d937904 506428d b449afb 6392f2a bad0763 5e0c761 and makes a few similar fixes to newer code. Discussion: https://www.postgresql.org/message-id/flat/e170d61f-01ab-4cf9-ab68-91cd1fac62c5%40eisentraut.org Discussion: https://www.postgresql.org/message-id/flat/CA%2BTgmoYEAm-KKZibAP3hSqbTFTjUd47XtVcf3xSFDpyecXX9uQ%40mail.gmail.com
1 parent b7076c1 commit 618c64f

File tree

9 files changed

+16
-25
lines changed

9 files changed

+16
-25
lines changed

contrib/pg_prewarm/autoprewarm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -798,12 +798,11 @@ apw_detach_shmem(int code, Datum arg)
798798
static void
799799
apw_start_leader_worker(void)
800800
{
801-
BackgroundWorker worker;
801+
BackgroundWorker worker = {0};
802802
BackgroundWorkerHandle *handle;
803803
BgwHandleStatus status;
804804
pid_t pid;
805805

806-
MemSet(&worker, 0, sizeof(BackgroundWorker));
807806
worker.bgw_flags = BGWORKER_SHMEM_ACCESS;
808807
worker.bgw_start_time = BgWorkerStart_ConsistentState;
809808
strcpy(worker.bgw_library_name, "pg_prewarm");
@@ -840,10 +839,9 @@ apw_start_leader_worker(void)
840839
static void
841840
apw_start_database_worker(void)
842841
{
843-
BackgroundWorker worker;
842+
BackgroundWorker worker = {0};
844843
BackgroundWorkerHandle *handle;
845844

846-
MemSet(&worker, 0, sizeof(BackgroundWorker));
847845
worker.bgw_flags =
848846
BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION;
849847
worker.bgw_start_time = BgWorkerStart_ConsistentState;

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3333,7 +3333,7 @@ estimate_path_cost_size(PlannerInfo *root,
33333333
{
33343334
RelOptInfo *outerrel = fpinfo->outerrel;
33353335
PgFdwRelationInfo *ofpinfo;
3336-
AggClauseCosts aggcosts;
3336+
AggClauseCosts aggcosts = {0};
33373337
double input_rows;
33383338
int numGroupCols;
33393339
double numGroups = 1;
@@ -3357,7 +3357,6 @@ estimate_path_cost_size(PlannerInfo *root,
33573357
input_rows = ofpinfo->rows;
33583358

33593359
/* Collect statistics about aggregates for estimating costs. */
3360-
MemSet(&aggcosts, 0, sizeof(AggClauseCosts));
33613360
if (root->parse->hasAggs)
33623361
{
33633362
get_agg_clause_costs(root, AGGSPLIT_SIMPLE, &aggcosts);

src/backend/optimizer/path/costsize.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2690,13 +2690,12 @@ cost_agg(Path *path, PlannerInfo *root,
26902690
double output_tuples;
26912691
Cost startup_cost;
26922692
Cost total_cost;
2693-
AggClauseCosts dummy_aggcosts;
2693+
const AggClauseCosts dummy_aggcosts = {0};
26942694

26952695
/* Use all-zero per-aggregate costs if NULL is passed */
26962696
if (aggcosts == NULL)
26972697
{
26982698
Assert(aggstrategy == AGG_HASHED);
2699-
MemSet(&dummy_aggcosts, 0, sizeof(AggClauseCosts));
27002699
aggcosts = &dummy_aggcosts;
27012700
}
27022701

src/backend/storage/smgr/bulk_write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
#define MAX_PENDING_WRITES XLR_MAX_BLOCK_ID
4848

49-
static const PGIOAlignedBlock zero_buffer = {{0}}; /* worth BLCKSZ */
49+
static const PGIOAlignedBlock zero_buffer = {0}; /* worth BLCKSZ */
5050

5151
typedef struct PendingWrite
5252
{

src/bin/pg_waldump/rmgrdesc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ static const RmgrDescData RmgrDescTable[RM_N_BUILTIN_IDS] = {
4141

4242
#define CUSTOM_NUMERIC_NAME_LEN sizeof("custom###")
4343

44-
static char CustomNumericNames[RM_N_CUSTOM_IDS][CUSTOM_NUMERIC_NAME_LEN] = {{0}};
45-
static RmgrDescData CustomRmgrDesc[RM_N_CUSTOM_IDS] = {{0}};
44+
static char CustomNumericNames[RM_N_CUSTOM_IDS][CUSTOM_NUMERIC_NAME_LEN] = {0};
45+
static RmgrDescData CustomRmgrDesc[RM_N_CUSTOM_IDS] = {0};
4646
static bool CustomRmgrDescInitialized = false;
4747

4848
/*

src/bin/pgbench/pgbench.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,15 +2279,10 @@ evalStandardFunc(CState *st,
22792279
{
22802280
/* evaluate all function arguments */
22812281
int nargs = 0;
2282+
PgBenchValue vargs[MAX_FARGS] = {0};
22822283
PgBenchExprLink *l = args;
22832284
bool has_null = false;
22842285

2285-
/*
2286-
* This value is double braced to workaround GCC bug 53119, which seems to
2287-
* exist at least on gcc (Debian 4.7.2-5) 4.7.2, 32-bit.
2288-
*/
2289-
PgBenchValue vargs[MAX_FARGS] = {{0}};
2290-
22912286
for (nargs = 0; nargs < MAX_FARGS && l != NULL; nargs++, l = l->next)
22922287
{
22932288
if (!evaluateExpr(st, l->expr, &vargs[nargs]))

src/common/blkreftable.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ BlockRefTableSetLimitBlock(BlockRefTable *brtab,
265265
BlockNumber limit_block)
266266
{
267267
BlockRefTableEntry *brtentry;
268-
BlockRefTableKey key = {{0}}; /* make sure any padding is zero */
268+
BlockRefTableKey key = {0}; /* make sure any padding is zero */
269269
bool found;
270270

271271
memcpy(&key.rlocator, rlocator, sizeof(RelFileLocator));
@@ -300,7 +300,7 @@ BlockRefTableMarkBlockModified(BlockRefTable *brtab,
300300
BlockNumber blknum)
301301
{
302302
BlockRefTableEntry *brtentry;
303-
BlockRefTableKey key = {{0}}; /* make sure any padding is zero */
303+
BlockRefTableKey key = {0}; /* make sure any padding is zero */
304304
bool found;
305305
#ifndef FRONTEND
306306
MemoryContext oldcontext = MemoryContextSwitchTo(brtab->mcxt);
@@ -340,7 +340,7 @@ BlockRefTableEntry *
340340
BlockRefTableGetEntry(BlockRefTable *brtab, const RelFileLocator *rlocator,
341341
ForkNumber forknum, BlockNumber *limit_block)
342342
{
343-
BlockRefTableKey key = {{0}}; /* make sure any padding is zero */
343+
BlockRefTableKey key = {0}; /* make sure any padding is zero */
344344
BlockRefTableEntry *entry;
345345

346346
Assert(limit_block != NULL);
@@ -521,7 +521,7 @@ WriteBlockRefTable(BlockRefTable *brtab,
521521
for (i = 0; i < brtab->hash->members; ++i)
522522
{
523523
BlockRefTableSerializedEntry *sentry = &sdata[i];
524-
BlockRefTableKey key = {{0}}; /* make sure any padding is zero */
524+
BlockRefTableKey key = {0}; /* make sure any padding is zero */
525525
unsigned j;
526526

527527
/* Write the serialized entry itself. */
@@ -616,7 +616,7 @@ BlockRefTableReaderNextRelation(BlockRefTableReader *reader,
616616
BlockNumber *limit_block)
617617
{
618618
BlockRefTableSerializedEntry sentry;
619-
BlockRefTableSerializedEntry zentry = {{0}};
619+
BlockRefTableSerializedEntry zentry = {0};
620620

621621
/*
622622
* Sanity check: caller must read all blocks from all chunks before moving
@@ -1291,7 +1291,7 @@ BlockRefTableWrite(BlockRefTableBuffer *buffer, void *data, int length)
12911291
static void
12921292
BlockRefTableFileTerminate(BlockRefTableBuffer *buffer)
12931293
{
1294-
BlockRefTableSerializedEntry zentry = {{0}};
1294+
BlockRefTableSerializedEntry zentry = {0};
12951295
pg_crc32c crc;
12961296

12971297
/* Write a sentinel indicating that there are no more entries. */

src/common/file_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ pg_pwritev_with_retry(int fd, const struct iovec *iov, int iovcnt, off_t offset)
687687
ssize_t
688688
pg_pwrite_zeros(int fd, size_t size, off_t offset)
689689
{
690-
static const PGIOAlignedBlock zbuffer = {{0}}; /* worth BLCKSZ */
690+
static const PGIOAlignedBlock zbuffer = {0}; /* worth BLCKSZ */
691691
void *zerobuf_addr = unconstify(PGIOAlignedBlock *, &zbuffer)->data;
692692
struct iovec iov[PG_IOV_MAX];
693693
size_t remaining_size = size;

src/interfaces/libpq/fe-auth-oauth-curl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ register_socket(CURL *curl, curl_socket_t socket, int what, void *ctx,
12321232
#endif
12331233
#ifdef HAVE_SYS_EVENT_H
12341234
struct async_ctx *actx = ctx;
1235-
struct kevent ev[2] = {{0}};
1235+
struct kevent ev[2] = {0};
12361236
struct kevent ev_out[2];
12371237
struct timespec timeout = {0};
12381238
int nev = 0;

0 commit comments

Comments
 (0)