8000 Clean up compiler warnings from unused variables with asserts disabled · postgrespro/postgres@0e85abd · GitHub
[go: up one dir, main page]

Skip to content

Commit 0e85abd

Browse files
committed
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.
1 parent 621eb15 commit 0e85abd

File tree

15 files changed

+29
-19
lines changed

15 files changed

+29
-19
lines changed

src/backend/access/hash/hashovfl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf,
391391
uint32 ovflbitno;
392392
int32 bitmappage,
393393
bitmapbit;
394-
Bucket bucket;
394+
Bucket bucket PG_USED_FOR_ASSERTS_ONLY;
395395

396396
/* Get information from the doomed page */
397397
_hash_checkpage(rel, ovflbuf, LH_OVERFLOW_PAGE);

src/backend/executor/execCurrent.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ execCurrentOf(CurrentOfExpr *cexpr,
151151
{
152152
ScanState *scanstate;
153153
bool lisnull;
154-
Oid tuple_tableoid;
154+
Oid tuple_tableoid PG_USED_FOR_ASSERTS_ONLY;
155155
ItemPointer tuple_tid;
156156

157157
/*

src/backend/executor/nodeMaterial.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ExecMaterial(MaterialState *node)
6666
* Allocate a second read pointer to serve as the mark. We know it
6767
* must have index 1, so needn't store that.
6868
*/
69-
int ptrno;
69+
int ptrno PG_USED_FOR_ASSERTS_ONLY;
7070

7171
ptrno = tuplestore_alloc_read_pointer(tuplestorestate,
7272
node->eflags);

src/backend/executor/nodeSetOp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ setop_fill_hash_table(SetOpState *setopstate)
344344
SetOp *node = (SetOp *) setopstate->ps.plan;
345345
PlanState *outerPlan;
346346
int firstFlag;
347-
bool in_first_rel;
347+
bool in_first_rel PG_USED_FOR_ASSERTS_ONLY;
348348

349349
/*
350350
* get state info from node

src/backend/executor/nodeWorktablescan.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ static TupleTableSlot *
3030
WorkTableScanNext(WorkTableScanState *node)
3131
{
3232
TupleTableSlot *slot;
33-
EState *estate;
3433
Tuplestorestate *tuplestorestate;
3534

3635
/*
@@ -48,8 +47,7 @@ WorkTableScanNext(WorkTableScanState *node)
4847
* worktable. Therefore, we don't need a private read pointer for the
4948
* tuplestore, nor do we need to tell tuplestore_gettupleslot to copy.
5049
*/
51-
estate = node->ss.ps.state;
52-
Assert(ScanDirectionIsForward(estate->es_direction));
50+
Assert(ScanDirectionIsForward(node->ss.ps.state->es_direction));
5351

5452
tuplestorestate = node->rustate->working_table;
5553

src/backend/libpq/be-fsstubs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ lo_import_internal(text *filename, Oid lobjOid)
378378
{
379379
File fd;
380380
int nbytes,
381-
tmp;
381+
tmp PG_USED_FOR_ASSERTS_ONLY;
382382
char buf[BUFSIZE];
383383
char fnamebuf[MAXPGPATH];
384384
LargeObjectDesc *lobj;

src/backend/libpq/pqcomm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ pq_putmessage(char msgtype, const char *s, size_t len)
13731373
void
13741374
pq_putmessage_noblock(char msgtype, const char *s, size_t len)
13751375
{
1376-
int res;
1376+
int res PG_USED_FOR_ASSERTS_ONLY;
13771377
int required;
13781378

13791379
/*

src/backend/optimizer/path/costsize.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3583,7 +3583,7 @@ void
35833583
set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel)
35843584
{
35853585
PlannerInfo *subroot = rel->subroot;
3586-
RangeTblEntry *rte;
3586+
RangeTblEntry *rte PG_USED_FOR_ASSERTS_ONLY;
35873587
ListCell *lc;
35883588

35893589
/* Should only be applied to base relations that are subqueries */

src/backend/parser/analyze.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
15881588
/* Process leaf SELECT */
15891589
Query *selectQuery;
15901590
char selectName[32];
1591-
RangeTblEntry *rte;
1591+
RangeTblEntry *rte PG_USED_FOR_ASSERTS_ONLY;
15921592
RangeTblRef *rtr;
15931593
ListCell *tl;
15941594

src/backend/storage/file/fd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ LruInsert(File file)
685685
/* seek to the right position */
686686
if (vfdP->seekPos != (off_t) 0)
687687
{
688-
off_t returnValue;
688+
off_t returnValue PG_USED_FOR_ASSERTS_ONLY;
689689

690690
returnValue = lseek(vfdP->fd, vfdP->seekPos, SEEK_SET);
691691
Assert(returnValue != (off_t) -1);

0 commit comments

Comments
 (0)
0