mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
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 commit6fdd5d9563
, 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:d937904cce
506428d091
b449afb582
6392f2a096
bad0763a4d
5e0c761d0a
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
This commit is contained in:
@ -798,12 +798,11 @@ apw_detach_shmem(int code, Datum arg)
|
|||||||
static void
|
static void
|
||||||
apw_start_leader_worker(void)
|
apw_start_leader_worker(void)
|
||||||
{
|
{
|
||||||
BackgroundWorker worker;
|
BackgroundWorker worker = {0};
|
||||||
BackgroundWorkerHandle *handle;
|
BackgroundWorkerHandle *handle;
|
||||||
BgwHandleStatus status;
|
BgwHandleStatus status;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
MemSet(&worker, 0, sizeof(BackgroundWorker));
|
|
||||||
worker.bgw_flags = BGWORKER_SHMEM_ACCESS;
|
worker.bgw_flags = BGWORKER_SHMEM_ACCESS;
|
||||||
worker.bgw_start_time = BgWorkerStart_ConsistentState;
|
worker.bgw_start_time = BgWorkerStart_ConsistentState;
|
||||||
strcpy(worker.bgw_library_name, "pg_prewarm");
|
strcpy(worker.bgw_library_name, "pg_prewarm");
|
||||||
@ -840,10 +839,9 @@ apw_start_leader_worker(void)
|
|||||||
static void
|
static void
|
||||||
apw_start_database_worker(void)
|
apw_start_database_worker(void)
|
||||||
{
|
{
|
||||||
BackgroundWorker worker;
|
BackgroundWorker worker = {0};
|
||||||
BackgroundWorkerHandle *handle;
|
BackgroundWorkerHandle *handle;
|
||||||
|
|
||||||
MemSet(&worker, 0, sizeof(BackgroundWorker));
|
|
||||||
worker.bgw_flags =
|
worker.bgw_flags =
|
||||||
BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION;
|
BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION;
|
||||||
worker.bgw_start_time = BgWorkerStart_ConsistentState;
|
worker.bgw_start_time = BgWorkerStart_ConsistentState;
|
||||||
|
@ -3333,7 +3333,7 @@ estimate_path_cost_size(PlannerInfo *root,
|
|||||||
{
|
{
|
||||||
RelOptInfo *outerrel = fpinfo->outerrel;
|
RelOptInfo *outerrel = fpinfo->outerrel;
|
||||||
PgFdwRelationInfo *ofpinfo;
|
PgFdwRelationInfo *ofpinfo;
|
||||||
AggClauseCosts aggcosts;
|
AggClauseCosts aggcosts = {0};
|
||||||
double input_rows;
|
double input_rows;
|
||||||
int numGroupCols;
|
int numGroupCols;
|
||||||
double numGroups = 1;
|
double numGroups = 1;
|
||||||
@ -3357,7 +3357,6 @@ estimate_path_cost_size(PlannerInfo *root,
|
|||||||
input_rows = ofpinfo->rows;
|
input_rows = ofpinfo->rows;
|
||||||
|
|
||||||
/* Collect statistics about aggregates for estimating costs. */
|
/* Collect statistics about aggregates for estimating costs. */
|
||||||
MemSet(&aggcosts, 0, sizeof(AggClauseCosts));
|
|
||||||
if (root->parse->hasAggs)
|
if (root->parse->hasAggs)
|
||||||
{
|
{
|
||||||
get_agg_clause_costs(root, AGGSPLIT_SIMPLE, &aggcosts);
|
get_agg_clause_costs(root, AGGSPLIT_SIMPLE, &aggcosts);
|
||||||
|
@ -2690,13 +2690,12 @@ cost_agg(Path *path, PlannerInfo *root,
|
|||||||
double output_tuples;
|
double output_tuples;
|
||||||
Cost startup_cost;
|
Cost startup_cost;
|
||||||
Cost total_cost;
|
Cost total_cost;
|
||||||
AggClauseCosts dummy_aggcosts;
|
const AggClauseCosts dummy_aggcosts = {0};
|
||||||
|
|
||||||
/* Use all-zero per-aggregate costs if NULL is passed */
|
/* Use all-zero per-aggregate costs if NULL is passed */
|
||||||
if (aggcosts == NULL)
|
if (aggcosts == NULL)
|
||||||
{
|
{
|
||||||
Assert(aggstrategy == AGG_HASHED);
|
Assert(aggstrategy == AGG_HASHED);
|
||||||
MemSet(&dummy_aggcosts, 0, sizeof(AggClauseCosts));
|
|
||||||
aggcosts = &dummy_aggcosts;
|
aggcosts = &dummy_aggcosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
#define MAX_PENDING_WRITES XLR_MAX_BLOCK_ID
|
#define MAX_PENDING_WRITES XLR_MAX_BLOCK_ID
|
||||||
|
|
||||||
static const PGIOAlignedBlock zero_buffer = {{0}}; /* worth BLCKSZ */
|
static const PGIOAlignedBlock zero_buffer = {0}; /* worth BLCKSZ */
|
||||||
|
|
||||||
typedef struct PendingWrite
|
typedef struct PendingWrite
|
||||||
{
|
{
|
||||||
|
@ -41,8 +41,8 @@ static const RmgrDescData RmgrDescTable[RM_N_BUILTIN_IDS] = {
|
|||||||
|
|
||||||
#define CUSTOM_NUMERIC_NAME_LEN sizeof("custom###")
|
#define CUSTOM_NUMERIC_NAME_LEN sizeof("custom###")
|
||||||
|
|
||||||
static char CustomNumericNames[RM_N_CUSTOM_IDS][CUSTOM_NUMERIC_NAME_LEN] = {{0}};
|
static char CustomNumericNames[RM_N_CUSTOM_IDS][CUSTOM_NUMERIC_NAME_LEN] = {0};
|
||||||
static RmgrDescData CustomRmgrDesc[RM_N_CUSTOM_IDS] = {{0}};
|
static RmgrDescData CustomRmgrDesc[RM_N_CUSTOM_IDS] = {0};
|
||||||
static bool CustomRmgrDescInitialized = false;
|
static bool CustomRmgrDescInitialized = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2279,15 +2279,10 @@ evalStandardFunc(CState *st,
|
|||||||
{
|
{
|
||||||
/* evaluate all function arguments */
|
/* evaluate all function arguments */
|
||||||
int nargs = 0;
|
int nargs = 0;
|
||||||
|
PgBenchValue vargs[MAX_FARGS] = {0};
|
||||||
PgBenchExprLink *l = args;
|
PgBenchExprLink *l = args;
|
||||||
bool has_null = false;
|
bool has_null = false;
|
||||||
|
|
||||||
/*
|
|
||||||
* This value is double braced to workaround GCC bug 53119, which seems to
|
|
||||||
* exist at least on gcc (Debian 4.7.2-5) 4.7.2, 32-bit.
|
|
||||||
*/
|
|
||||||
PgBenchValue vargs[MAX_FARGS] = {{0}};
|
|
||||||
|
|
||||||
for (nargs = 0; nargs < MAX_FARGS && l != NULL; nargs++, l = l->next)
|
for (nargs = 0; nargs < MAX_FARGS && l != NULL; nargs++, l = l->next)
|
||||||
{
|
{
|
||||||
if (!evaluateExpr(st, l->expr, &vargs[nargs]))
|
if (!evaluateExpr(st, l->expr, &vargs[nargs]))
|
||||||
|
@ -265,7 +265,7 @@ BlockRefTableSetLimitBlock(BlockRefTable *brtab,
|
|||||||
BlockNumber limit_block)
|
BlockNumber limit_block)
|
||||||
{
|
{
|
||||||
BlockRefTableEntry *brtentry;
|
BlockRefTableEntry *brtentry;
|
||||||
BlockRefTableKey key = {{0}}; /* make sure any padding is zero */
|
BlockRefTableKey key = {0}; /* make sure any padding is zero */
|
||||||
bool found;
|
bool found;
|
||||||
|
|
||||||
memcpy(&key.rlocator, rlocator, sizeof(RelFileLocator));
|
memcpy(&key.rlocator, rlocator, sizeof(RelFileLocator));
|
||||||
@ -300,7 +300,7 @@ BlockRefTableMarkBlockModified(BlockRefTable *brtab,
|
|||||||
BlockNumber blknum)
|
BlockNumber blknum)
|
||||||
{
|
{
|
||||||
BlockRefTableEntry *brtentry;
|
BlockRefTableEntry *brtentry;
|
||||||
BlockRefTableKey key = {{0}}; /* make sure any padding is zero */
|
BlockRefTableKey key = {0}; /* make sure any padding is zero */
|
||||||
bool found;
|
bool found;
|
||||||
#ifndef FRONTEND
|
#ifndef FRONTEND
|
||||||
MemoryContext oldcontext = MemoryContextSwitchTo(brtab->mcxt);
|
MemoryContext oldcontext = MemoryContextSwitchTo(brtab->mcxt);
|
||||||
@ -340,7 +340,7 @@ BlockRefTableEntry *
|
|||||||
BlockRefTableGetEntry(BlockRefTable *brtab, const RelFileLocator *rlocator,
|
BlockRefTableGetEntry(BlockRefTable *brtab, const RelFileLocator *rlocator,
|
||||||
ForkNumber forknum, BlockNumber *limit_block)
|
ForkNumber forknum, BlockNumber *limit_block)
|
||||||
{
|
{
|
||||||
BlockRefTableKey key = {{0}}; /* make sure any padding is zero */
|
BlockRefTableKey key = {0}; /* make sure any padding is zero */
|
||||||
BlockRefTableEntry *entry;
|
BlockRefTableEntry *entry;
|
||||||
|
|
||||||
Assert(limit_block != NULL);
|
Assert(limit_block != NULL);
|
||||||
@ -521,7 +521,7 @@ WriteBlockRefTable(BlockRefTable *brtab,
|
|||||||
for (i = 0; i < brtab->hash->members; ++i)
|
for (i = 0; i < brtab->hash->members; ++i)
|
||||||
{
|
{
|
||||||
BlockRefTableSerializedEntry *sentry = &sdata[i];
|
BlockRefTableSerializedEntry *sentry = &sdata[i];
|
||||||
BlockRefTableKey key = {{0}}; /* make sure any padding is zero */
|
BlockRefTableKey key = {0}; /* make sure any padding is zero */
|
||||||
unsigned j;
|
unsigned j;
|
||||||
|
|
||||||
/* Write the serialized entry itself. */
|
/* Write the serialized entry itself. */
|
||||||
@ -616,7 +616,7 @@ BlockRefTableReaderNextRelation(BlockRefTableReader *reader,
|
|||||||
BlockNumber *limit_block)
|
BlockNumber *limit_block)
|
||||||
{
|
{
|
||||||
BlockRefTableSerializedEntry sentry;
|
BlockRefTableSerializedEntry sentry;
|
||||||
BlockRefTableSerializedEntry zentry = {{0}};
|
BlockRefTableSerializedEntry zentry = {0};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sanity check: caller must read all blocks from all chunks before moving
|
* Sanity check: caller must read all blocks from all chunks before moving
|
||||||
@ -1291,7 +1291,7 @@ BlockRefTableWrite(BlockRefTableBuffer *buffer, void *data, int length)
|
|||||||
static void
|
static void
|
||||||
BlockRefTableFileTerminate(BlockRefTableBuffer *buffer)
|
BlockRefTableFileTerminate(BlockRefTableBuffer *buffer)
|
||||||
{
|
{
|
||||||
BlockRefTableSerializedEntry zentry = {{0}};
|
BlockRefTableSerializedEntry zentry = {0};
|
||||||
pg_crc32c crc;
|
pg_crc32c crc;
|
||||||
|
|
||||||
/* Write a sentinel indicating that there are no more entries. */
|
/* Write a sentinel indicating that there are no more entries. */
|
||||||
|
@ -687,7 +687,7 @@ pg_pwritev_with_retry(int fd, const struct iovec *iov, int iovcnt, off_t offset)
|
|||||||
ssize_t
|
ssize_t
|
||||||
pg_pwrite_zeros(int fd, size_t size, off_t offset)
|
pg_pwrite_zeros(int fd, size_t size, off_t offset)
|
||||||
{
|
{
|
||||||
static const PGIOAlignedBlock zbuffer = {{0}}; /* worth BLCKSZ */
|
static const PGIOAlignedBlock zbuffer = {0}; /* worth BLCKSZ */
|
||||||
void *zerobuf_addr = unconstify(PGIOAlignedBlock *, &zbuffer)->data;
|
void *zerobuf_addr = unconstify(PGIOAlignedBlock *, &zbuffer)->data;
|
||||||
struct iovec iov[PG_IOV_MAX];
|
struct iovec iov[PG_IOV_MAX];
|
||||||
size_t remaining_size = size;
|
size_t remaining_size = size;
|
||||||
|
@ -1232,7 +1232,7 @@ register_socket(CURL *curl, curl_socket_t socket, int what, void *ctx,
|
|||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYS_EVENT_H
|
#ifdef HAVE_SYS_EVENT_H
|
||||||
struct async_ctx *actx = ctx;
|
struct async_ctx *actx = ctx;
|
||||||
struct kevent ev[2] = {{0}};
|
struct kevent ev[2] = {0};
|
||||||
struct kevent ev_out[2];
|
struct kevent ev_out[2];
|
||||||
struct timespec timeout = {0};
|
struct timespec timeout = {0};
|
||||||
int nev = 0;
|
int nev = 0;
|
||||||
|
Reference in New Issue
Block a user