mirror of
https://github.com/postgres/postgres.git
synced 2025-05-29 00:03:09 -04:00
Clean up compiler warnings from unused variables with asserts disabled
For those variables only used when asserts are enabled, use a new macro PG_USED_FOR_ASSERTS_ONLY, which expands to __attribute__((unused)) when asserts are not enabled.
This commit is contained in:
parent
621eb156f1
commit
0e85abd658
@ -391,7 +391,7 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf,
|
|||||||
uint32 ovflbitno;
|
uint32 ovflbitno;
|
||||||
int32 bitmappage,
|
int32 bitmappage,
|
||||||
bitmapbit;
|
bitmapbit;
|
||||||
Bucket bucket;
|
Bucket bucket PG_USED_FOR_ASSERTS_ONLY;
|
||||||
|
|
||||||
/* Get information from the doomed page */
|
/* Get information from the doomed page */
|
||||||
_hash_checkpage(rel, ovflbuf, LH_OVERFLOW_PAGE);
|
_hash_checkpage(rel, ovflbuf, LH_OVERFLOW_PAGE);
|
||||||
|
@ -151,7 +151,7 @@ execCurrentOf(CurrentOfExpr *cexpr,
|
|||||||
{
|
{
|
||||||
ScanState *scanstate;
|
ScanState *scanstate;
|
||||||
bool lisnull;
|
bool lisnull;
|
||||||
Oid tuple_tableoid;
|
Oid tuple_tableoid PG_USED_FOR_ASSERTS_ONLY;
|
||||||
ItemPointer tuple_tid;
|
ItemPointer tuple_tid;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -66,7 +66,7 @@ ExecMaterial(MaterialState *node)
|
|||||||
* Allocate a second read pointer to serve as the mark. We know it
|
* Allocate a second read pointer to serve as the mark. We know it
|
||||||
* must have index 1, so needn't store that.
|
* must have index 1, so needn't store that.
|
||||||
*/
|
*/
|
||||||
int ptrno;
|
int ptrno PG_USED_FOR_ASSERTS_ONLY;
|
||||||
|
|
||||||
ptrno = tuplestore_alloc_read_pointer(tuplestorestate,
|
ptrno = tuplestore_alloc_read_pointer(tuplestorestate,
|
||||||
node->eflags);
|
node->eflags);
|
||||||
|
@ -344,7 +344,7 @@ setop_fill_hash_table(SetOpState *setopstate)
|
|||||||
SetOp *node = (SetOp *) setopstate->ps.plan;
|
SetOp *node = (SetOp *) setopstate->ps.plan;
|
||||||
PlanState *outerPlan;
|
PlanState *outerPlan;
|
||||||
int firstFlag;
|
int firstFlag;
|
||||||
bool in_first_rel;
|
bool in_first_rel PG_USED_FOR_ASSERTS_ONLY;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get state info from node
|
* get state info from node
|
||||||
|
@ -30,7 +30,6 @@ static TupleTableSlot *
|
|||||||
WorkTableScanNext(WorkTableScanState *node)
|
WorkTableScanNext(WorkTableScanState *node)
|
||||||
{
|
{
|
||||||
TupleTableSlot *slot;
|
TupleTableSlot *slot;
|
||||||
EState *estate;
|
|
||||||
Tuplestorestate *tuplestorestate;
|
Tuplestorestate *tuplestorestate;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -48,8 +47,7 @@ WorkTableScanNext(WorkTableScanState *node)
|
|||||||
* worktable. Therefore, we don't need a private read pointer for the
|
* worktable. Therefore, we don't need a private read pointer for the
|
||||||
* tuplestore, nor do we need to tell tuplestore_gettupleslot to copy.
|
* tuplestore, nor do we need to tell tuplestore_gettupleslot to copy.
|
||||||
*/
|
*/
|
||||||
estate = node->ss.ps.state;
|
Assert(ScanDirectionIsForward(node->ss.ps.state->es_direction));
|
||||||
Assert(ScanDirectionIsForward(estate->es_direction));
|
|
||||||
|
|
||||||
tuplestorestate = node->rustate->working_table;
|
tuplestorestate = node->rustate->working_table;
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ lo_import_internal(text *filename, Oid lobjOid)
|
|||||||
{
|
{
|
||||||
File fd;
|
File fd;
|
||||||
int nbytes,
|
int nbytes,
|
||||||
tmp;
|
tmp PG_USED_FOR_ASSERTS_ONLY;
|
||||||
char buf[BUFSIZE];
|
char buf[BUFSIZE];
|
||||||
char fnamebuf[MAXPGPATH];
|
char fnamebuf[MAXPGPATH];
|
||||||
LargeObjectDesc *lobj;
|
LargeObjectDesc *lobj;
|
||||||
|
@ -1373,7 +1373,7 @@ fail:
|
|||||||
void
|
void
|
||||||
pq_putmessage_noblock(char msgtype, const char *s, size_t len)
|
pq_putmessage_noblock(char msgtype, const char *s, size_t len)
|
||||||
{
|
{
|
||||||
int res;
|
int res PG_USED_FOR_ASSERTS_ONLY;
|
||||||
int required;
|
int required;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3583,7 +3583,7 @@ void
|
|||||||
set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel)
|
set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel)
|
||||||
{
|
{
|
||||||
PlannerInfo *subroot = rel->subroot;
|
PlannerInfo *subroot = rel->subroot;
|
||||||
RangeTblEntry *rte;
|
RangeTblEntry *rte PG_USED_FOR_ASSERTS_ONLY;
|
||||||
ListCell *lc;
|
ListCell *lc;
|
||||||
|
|
||||||
/* Should only be applied to base relations that are subqueries */
|
/* Should only be applied to base relations that are subqueries */
|
||||||
|
@ -1588,7 +1588,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
|
|||||||
/* Process leaf SELECT */
|
/* Process leaf SELECT */
|
||||||
Query *selectQuery;
|
Query *selectQuery;
|
||||||
char selectName[32];
|
char selectName[32];
|
||||||
RangeTblEntry *rte;
|
RangeTblEntry *rte PG_USED_FOR_ASSERTS_ONLY;
|
||||||
RangeTblRef *rtr;
|
RangeTblRef *rtr;
|
||||||
ListCell *tl;
|
ListCell *tl;
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ LruInsert(File file)
|
|||||||
/* seek to the right position */
|
/* seek to the right position */
|
||||||
if (vfdP->seekPos != (off_t) 0)
|
if (vfdP->seekPos != (off_t) 0)
|
||||||
{
|
{
|
||||||
off_t returnValue;
|
off_t returnValue PG_USED_FOR_ASSERTS_ONLY;
|
||||||
|
|
||||||
returnValue = lseek(vfdP->fd, vfdP->seekPos, SEEK_SET);
|
returnValue = lseek(vfdP->fd, vfdP->seekPos, SEEK_SET);
|
||||||
Assert(returnValue != (off_t) -1);
|
Assert(returnValue != (off_t) -1);
|
||||||
|
@ -2013,7 +2013,7 @@ RestoreScratchTarget(bool lockheld)
|
|||||||
static void
|
static void
|
||||||
RemoveTargetIfNoLongerUsed(PREDICATELOCKTARGET *target, uint32 targettaghash)
|
RemoveTargetIfNoLongerUsed(PREDICATELOCKTARGET *target, uint32 targettaghash)
|
||||||
{
|
{
|
||||||
PREDICATELOCKTARGET *rmtarget;
|
PREDICATELOCKTARGET *rmtarget PG_USED_FOR_ASSERTS_ONLY;
|
||||||
|
|
||||||
Assert(LWLockHeldByMe(SerializablePredicateLockListLock));
|
Assert(LWLockHeldByMe(SerializablePredicateLockListLock));
|
||||||
|
|
||||||
@ -2074,7 +2074,7 @@ DeleteChildTargetLocks(const PREDICATELOCKTARGETTAG *newtargettag)
|
|||||||
{
|
{
|
||||||
uint32 oldtargettaghash;
|
uint32 oldtargettaghash;
|
||||||
LWLockId partitionLock;
|
LWLockId partitionLock;
|
||||||
PREDICATELOCK *rmpredlock;
|
PREDICATELOCK *rmpredlock PG_USED_FOR_ASSERTS_ONLY;
|
||||||
|
|
||||||
oldtargettaghash = PredicateLockTargetTagHashCode(&oldtargettag);
|
oldtargettaghash = PredicateLockTargetTagHashCode(&oldtargettag);
|
||||||
partitionLock = PredicateLockHashPartitionLock(oldtargettaghash);
|
partitionLock = PredicateLockHashPartitionLock(oldtargettaghash);
|
||||||
@ -2227,7 +2227,7 @@ DecrementParentLocks(const PREDICATELOCKTARGETTAG *targettag)
|
|||||||
{
|
{
|
||||||
uint32 targettaghash;
|
uint32 targettaghash;
|
||||||
LOCALPREDICATELOCK *parentlock,
|
LOCALPREDICATELOCK *parentlock,
|
||||||
*rmlock;
|
*rmlock PG_USED_FOR_ASSERTS_ONLY;
|
||||||
|
|
||||||
parenttag = nexttag;
|
parenttag = nexttag;
|
||||||
targettaghash = PredicateLockTargetTagHashCode(&parenttag);
|
targettaghash = PredicateLockTargetTagHashCode(&parenttag);
|
||||||
|
@ -808,7 +808,7 @@ static void
|
|||||||
AuxiliaryProcKill(int code, Datum arg)
|
AuxiliaryProcKill(int code, Datum arg)
|
||||||
{
|
{
|
||||||
int proctype = DatumGetInt32(arg);
|
int proctype = DatumGetInt32(arg);
|
||||||
PGPROC *auxproc;
|
PGPROC *auxproc PG_USED_FOR_ASSERTS_ONLY;
|
||||||
|
|
||||||
Assert(proctype >= 0 && proctype < NUM_AUXILIARY_PROCS);
|
Assert(proctype >= 0 && proctype < NUM_AUXILIARY_PROCS);
|
||||||
|
|
||||||
|
@ -3874,7 +3874,7 @@ convert_string_datum(Datum value, Oid typid)
|
|||||||
{
|
{
|
||||||
char *xfrmstr;
|
char *xfrmstr;
|
||||||
size_t xfrmlen;
|
size_t xfrmlen;
|
||||||
size_t xfrmlen2;
|
size_t xfrmlen2 PG_USED_FOR_ASSERTS_ONLY;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: originally we guessed at a suitable output buffer size, and
|
* Note: originally we guessed at a suitable output buffer size, and
|
||||||
@ -6408,7 +6408,7 @@ btcostestimate(PG_FUNCTION_ARGS)
|
|||||||
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lcc);
|
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lcc);
|
||||||
Expr *clause;
|
Expr *clause;
|
||||||
Node *leftop,
|
Node *leftop,
|
||||||
*rightop;
|
*rightop PG_USED_FOR_ASSERTS_ONLY;
|
||||||
Oid clause_op;
|
Oid clause_op;
|
||||||
int op_strategy;
|
int op_strategy;
|
||||||
bool is_null_op = false;
|
bool is_null_op = false;
|
||||||
|
@ -1474,7 +1474,7 @@ psql_scan_slash_option(PsqlScanState state,
|
|||||||
bool semicolon)
|
bool semicolon)
|
||||||
{
|
{
|
||||||
PQExpBufferData mybuf;
|
PQExpBufferData mybuf;
|
||||||
int lexresult;
|
int lexresult PG_USED_FOR_ASSERTS_ONLY;
|
||||||
char local_quote;
|
char local_quote;
|
||||||
|
|
||||||
/* Must be scanning already */
|
/* Must be scanning already */
|
||||||
|
@ -710,6 +710,18 @@ typedef NameData *Name;
|
|||||||
#define STATUS_WAITING (2)
|
#define STATUS_WAITING (2)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Append PG_USED_FOR_ASSERTS_ONLY to definitions of variables that are only
|
||||||
|
* used in assert-enabled builds, to avoid compiler warnings about unused
|
||||||
|
* variables in assert-disabled builds.
|
||||||
|
*/
|
||||||
|
#ifdef USE_ASSERT_CHECKING
|
||||||
|
#define PG_USED_FOR_ASSERTS_ONLY
|
||||||
|
#else
|
||||||
|
#define PG_USED_FOR_ASSERTS_ONLY __attribute__((unused))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* gettext domain name mangling */
|
/* gettext domain name mangling */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user