Annotate variables only used for asserts with PG_USED_FOR_ASSERTS_ONLY.

This avoids '-Wunused-but-set-variable' type warnings when compiling
without assertions, e.g. against a system postgres.
pull/450/head
Andres Freund 2016-04-15 10:05:44 -07:00 committed by Jason Petersen
parent cb7a397b0c
commit 29b8576a33
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
6 changed files with 7 additions and 6 deletions

View File

@ -486,7 +486,7 @@ MultiClientQueryStatus(int32 connectionId)
{
PGconn *connection = NULL;
PGresult *result = NULL;
int tupleCount = 0;
int tupleCount PG_USED_FOR_ASSERTS_ONLY = 0;
bool copyResults = false;
ConnStatusType connStatusType = CONNECTION_OK;
ExecStatusType resultStatus = PGRES_COMMAND_OK;

View File

@ -305,7 +305,7 @@ FindRandomNodeNotInList(HTAB *WorkerNodesHash, List *currentNodeList)
WorkerNode *workerNode = NULL;
HASH_SEQ_STATUS status;
uint32 workerNodeCount = 0;
uint32 currentNodeCount = 0;
uint32 currentNodeCount PG_USED_FOR_ASSERTS_ONLY = 0;
bool lookForWorkerNode = true;
uint32 workerPosition = 0;
uint32 workerIndex = 0;

View File

@ -750,7 +750,7 @@ BestJoinOrder(List *candidateJoinOrders)
List *bestJoinOrder = NULL;
uint32 ruleTypeIndex = 0;
uint32 highestValidIndex = JOIN_RULE_LAST - 1;
uint32 candidateCount = 0;
uint32 candidateCount PG_USED_FOR_ASSERTS_ONLY = 0;
/*
* We start with the highest ranking rule type (cartesian product), and walk

View File

@ -1560,7 +1560,7 @@ ApplyJoinRule(MultiNode *leftNode, MultiNode *rightNode, JoinRuleType ruleType,
List *applicableJoinClauses = NIL;
List *leftTableIdList = OutputTableIdList(leftNode);
List *rightTableIdList = OutputTableIdList(rightNode);
int rightTableIdCount = 0;
int rightTableIdCount PG_USED_FOR_ASSERTS_ONLY = 0;
uint32 rightTableId = 0;
rightTableIdCount = list_length(rightTableIdList);

View File

@ -1724,7 +1724,8 @@ BuildMapMergeJob(Query *jobQuery, List *dependedJobList, Var *partitionKey,
SortedShardIntervalArray(shardIntervalList);
/* this join-type currently doesn't work for hash partitioned tables */
char basePartitionMethod = PartitionMethod(baseRelationId);
char basePartitionMethod PG_USED_FOR_ASSERTS_ONLY =
PartitionMethod(baseRelationId);
Assert(basePartitionMethod != DISTRIBUTE_BY_HASH);
mapMergeJob->partitionType = RANGE_PARTITION_TYPE;

View File

@ -368,7 +368,7 @@ CreateTaskTable(StringInfo schemaName, StringInfo relationName,
CreateStmt *createStatement = NULL;
RangeVar *relation = NULL;
List *columnDefinitionList = NIL;
Oid relationId = InvalidOid;
Oid relationId PG_USED_FOR_ASSERTS_ONLY = InvalidOid;
#if (PG_VERSION_NUM >= 90500)
ObjectAddress relationObject;
#endif