gcc 4.6 warnings -Wunused-but-set-variable

Started by Peter Eisentrautalmost 15 years ago7 messages
#1Peter Eisentraut
peter_e@gmx.net
1 attachment(s)

As you might have heard, GCC 4.6 was released the other day. It
generates a bunch of new warnings with the PostgreSQL source code, most
of which belong to the new warning scenario -Wunused-but-set-variable,
which is included in -Wall.

Attached is a patch that gets rid of most of these. As you can see,
most of these remove real leftover garbage. The line I marked in
pg_basebackup.c might be an actual problem: It goes through a whole lot
to figure out the timeline and then doesn't do anything with it. In
some other cases, however, one might argue that the changes lose some
clarity, such as when dropping the return value of strtoul() or
va_arg(). How should we proceed? In any case, my patch should be
re-reviewed for any possible side effects that I might have hastily
removed.

Attachments:

unused-but-set-variable.patchtext/x-patch; charset=UTF-8; name=unused-but-set-variable.patchDownload
diff --git i/contrib/isn/isn.c w/contrib/isn/isn.c
index 46e904b..b698cb0 100644
--- i/contrib/isn/isn.c
+++ w/contrib/isn/isn.c
@@ -341,8 +341,7 @@ ean2isn(ean13 ean, bool errorOK, ean13 *result, enum isn_type accept)
 	enum isn_type type = INVALID;
 
 	char		buf[MAXEAN13LEN + 1];
-	char	   *firstdig,
-			   *aux;
+	char	   *aux;
 	unsigned	digval;
 	unsigned	search;
 	ean13		ret = ean;
@@ -354,7 +353,7 @@ ean2isn(ean13 ean, bool errorOK, ean13 *result, enum isn_type accept)
 
 	/* convert the number */
 	search = 0;
-	firstdig = aux = buf + 13;
+	aux = buf + 13;
 	*aux = '\0';				/* terminate string; aux points to last digit */
 	do
 	{
@@ -528,8 +527,7 @@ ean2string(ean13 ean, bool errorOK, char *result, bool shortType)
 	const unsigned (*TABLE_index)[2];
 	enum isn_type type = INVALID;
 
-	char	   *firstdig,
-			   *aux;
+	char	   *aux;
 	unsigned	digval;
 	unsigned	search;
 	char		valid = '\0';	/* was the number initially written with a
@@ -546,7 +544,7 @@ ean2string(ean13 ean, bool errorOK, char *result, bool shortType)
 
 	/* convert the number */
 	search = 0;
-	firstdig = aux = result + MAXEAN13LEN;
+	aux = result + MAXEAN13LEN;
 	*aux = '\0';				/* terminate string; aux points to last digit */
 	*--aux = valid;				/* append '!' for numbers with invalid but
 								 * corrected check digit */
diff --git i/contrib/pageinspect/fsmfuncs.c w/contrib/pageinspect/fsmfuncs.c
index eca3230..38c4e23 100644
--- i/contrib/pageinspect/fsmfuncs.c
+++ w/contrib/pageinspect/fsmfuncs.c
@@ -35,7 +35,6 @@ Datum
 fsm_page_contents(PG_FUNCTION_ARGS)
 {
 	bytea	   *raw_page = PG_GETARG_BYTEA_P(0);
-	int			raw_page_size;
 	StringInfoData sinfo;
 	FSMPage		fsmpage;
 	int			i;
@@ -45,7 +44,6 @@ fsm_page_contents(PG_FUNCTION_ARGS)
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 				 (errmsg("must be superuser to use raw page functions"))));
 
-	raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
 	fsmpage = (FSMPage) PageGetContents(VARDATA(raw_page));
 
 	initStringInfo(&sinfo);
diff --git i/contrib/pgcrypto/pgp-s2k.c w/contrib/pgcrypto/pgp-s2k.c
index ef16caf..349234e 100644
--- i/contrib/pgcrypto/pgp-s2k.c
+++ w/contrib/pgcrypto/pgp-s2k.c
@@ -39,14 +39,12 @@ static int
 calc_s2k_simple(PGP_S2K *s2k, PX_MD *md, const uint8 *key,
 				unsigned key_len)
 {
-	unsigned	md_bs,
-				md_rlen;
+	unsigned	md_rlen;
 	uint8		buf[PGP_MAX_DIGEST];
 	unsigned	preload;
 	unsigned	remain;
 	uint8	   *dst = s2k->key;
 
-	md_bs = px_md_block_size(md);
 	md_rlen = px_md_result_size(md);
 
 	remain = s2k->key_len;
@@ -83,14 +81,12 @@ calc_s2k_simple(PGP_S2K *s2k, PX_MD *md, const uint8 *key,
 static int
 calc_s2k_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key, unsigned key_len)
 {
-	unsigned	md_bs,
-				md_rlen;
+	unsigned	md_rlen;
 	uint8		buf[PGP_MAX_DIGEST];
 	unsigned	preload = 0;
 	uint8	   *dst;
 	unsigned	remain;
 
-	md_bs = px_md_block_size(md);
 	md_rlen = px_md_result_size(md);
 
 	dst = s2k->key;
@@ -129,8 +125,7 @@ static int
 calc_s2k_iter_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key,
 					 unsigned key_len)
 {
-	unsigned	md_bs,
-				md_rlen;
+	unsigned	md_rlen;
 	uint8		buf[PGP_MAX_DIGEST];
 	uint8	   *dst;
 	unsigned	preload = 0;
@@ -143,7 +138,6 @@ calc_s2k_iter_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key,
 	cval = s2k->iter;
 	count = ((unsigned) 16 + (cval & 15)) << ((cval >> 4) + 6);
 
-	md_bs = px_md_block_size(md);
 	md_rlen = px_md_result_size(md);
 
 	remain = s2k->key_len;
diff --git i/contrib/pgcrypto/px-hmac.c w/contrib/pgcrypto/px-hmac.c
index 16abc43..36efabd 100644
--- i/contrib/pgcrypto/px-hmac.c
+++ w/contrib/pgcrypto/px-hmac.c
@@ -52,13 +52,11 @@ static void
 hmac_init(PX_HMAC *h, const uint8 *key, unsigned klen)
 {
 	unsigned	bs,
-				hlen,
 				i;
 	uint8	   *keybuf;
 	PX_MD	   *md = h->md;
 
 	bs = px_md_block_size(md);
-	hlen = px_md_result_size(md);
 	keybuf = px_alloc(bs);
 	memset(keybuf, 0, bs);
 
diff --git i/contrib/pgcrypto/px.c w/contrib/pgcrypto/px.c
index 768c7c3..e3f5e26 100644
--- i/contrib/pgcrypto/px.c
+++ w/contrib/pgcrypto/px.c
@@ -162,14 +162,12 @@ combo_init(PX_Combo *cx, const uint8 *key, unsigned klen,
 		   const uint8 *iv, unsigned ivlen)
 {
 	int			err;
-	unsigned	bs,
-				ks,
+	unsigned	ks,
 				ivs;
 	PX_Cipher  *c = cx->cipher;
 	uint8	   *ivbuf = NULL;
 	uint8	   *keybuf;
 
-	bs = px_cipher_block_size(c);
 	ks = px_cipher_key_size(c);
 
 	ivs = px_cipher_iv_size(c);
@@ -205,7 +203,6 @@ combo_encrypt(PX_Combo *cx, const uint8 *data, unsigned dlen,
 	int			err = 0;
 	uint8	   *bbuf;
 	unsigned	bs,
-				maxlen,
 				bpos,
 				i,
 				pad;
@@ -213,7 +210,6 @@ combo_encrypt(PX_Combo *cx, const uint8 *data, unsigned dlen,
 	PX_Cipher  *c = cx->cipher;
 
 	bbuf = NULL;
-	maxlen = *rlen;
 	bs = px_cipher_block_size(c);
 
 	/* encrypt */
diff --git i/contrib/seg/seg.c w/contrib/seg/seg.c
index afada2a..5cadb9c 100644
--- i/contrib/seg/seg.c
+++ w/contrib/seg/seg.c
@@ -867,7 +867,6 @@ restore(char *result, float val, int n)
 		'0', '0', '0', '0', '\0'
 	};
 	char	   *p;
-	char	   *mant;
 	int			exp;
 	int			i,
 				dp,
@@ -893,7 +892,7 @@ restore(char *result, float val, int n)
 	*p = '\0';
 
 	/* get the exponent */
-	mant = (char *) strtok(strdup(result), "e");
+	strtok(strdup(result), "e");
 	exp = atoi(strtok(NULL, "e"));
 
 	if (exp == 0)
diff --git i/src/backend/access/gist/gistvacuum.c w/src/backend/access/gist/gistvacuum.c
index 4369d01..33e6f34 100644
--- i/src/backend/access/gist/gistvacuum.c
+++ w/src/backend/access/gist/gistvacuum.c
@@ -38,8 +38,6 @@ gistvacuumcleanup(PG_FUNCTION_ARGS)
 	BlockNumber npages,
 				blkno;
 	BlockNumber totFreePages;
-	BlockNumber lastBlock = GIST_ROOT_BLKNO,
-				lastFilledBlock = GIST_ROOT_BLKNO;
 	bool		needLock;
 
 	/* No-op in ANALYZE ONLY mode */
@@ -90,11 +88,8 @@ gistvacuumcleanup(PG_FUNCTION_ARGS)
 			totFreePages++;
 			RecordFreeIndexPage(rel, blkno);
 		}
-		else
-			lastFilledBlock = blkno;
 		UnlockReleaseBuffer(buffer);
 	}
-	lastBlock = npages - 1;
 
 	/* Finally, vacuum the FSM */
 	IndexFreeSpaceMapVacuum(info->index);
diff --git i/src/backend/access/nbtree/nbtpage.c w/src/backend/access/nbtree/nbtpage.c
index 2796445..8003b5a 100644
--- i/src/backend/access/nbtree/nbtpage.c
+++ w/src/backend/access/nbtree/nbtpage.c
@@ -466,7 +466,6 @@ _bt_log_reuse_page(Relation rel, BlockNumber blkno, TransactionId latestRemovedX
 
 	/* XLOG stuff */
 	{
-		XLogRecPtr	recptr;
 		XLogRecData rdata[1];
 		xl_btree_reuse_page xlrec_reuse;
 
@@ -478,7 +477,7 @@ _bt_log_reuse_page(Relation rel, BlockNumber blkno, TransactionId latestRemovedX
 		rdata[0].buffer = InvalidBuffer;
 		rdata[0].next = NULL;
 
-		recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_REUSE_PAGE, rdata);
+		XLogInsert(RM_BTREE_ID, XLOG_BTREE_REUSE_PAGE, rdata);
 
 		/*
 		 * We don't do PageSetLSN or PageSetTLI here because we're about
diff --git i/src/backend/catalog/pg_proc.c w/src/backend/catalog/pg_proc.c
index 6138165..55276d5 100644
--- i/src/backend/catalog/pg_proc.c
+++ w/src/backend/catalog/pg_proc.c
@@ -671,7 +671,6 @@ fmgr_internal_validator(PG_FUNCTION_ARGS)
 {
 	Oid			funcoid = PG_GETARG_OID(0);
 	HeapTuple	tuple;
-	Form_pg_proc proc;
 	bool		isnull;
 	Datum		tmp;
 	char	   *prosrc;
@@ -684,7 +683,6 @@ fmgr_internal_validator(PG_FUNCTION_ARGS)
 	tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for function %u", funcoid);
-	proc = (Form_pg_proc) GETSTRUCT(tuple);
 
 	tmp = SysCacheGetAttr(PROCOID, tuple, Anum_pg_proc_prosrc, &isnull);
 	if (isnull)
@@ -717,7 +715,6 @@ fmgr_c_validator(PG_FUNCTION_ARGS)
 	Oid			funcoid = PG_GETARG_OID(0);
 	void	   *libraryhandle;
 	HeapTuple	tuple;
-	Form_pg_proc proc;
 	bool		isnull;
 	Datum		tmp;
 	char	   *prosrc;
@@ -732,7 +729,6 @@ fmgr_c_validator(PG_FUNCTION_ARGS)
 	tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for function %u", funcoid);
-	proc = (Form_pg_proc) GETSTRUCT(tuple);
 
 	tmp = SysCacheGetAttr(PROCOID, tuple, Anum_pg_proc_prosrc, &isnull);
 	if (isnull)
diff --git i/src/backend/catalog/toasting.c w/src/backend/catalog/toasting.c
index 5d5496d..42986d3 100644
--- i/src/backend/catalog/toasting.c
+++ w/src/backend/catalog/toasting.c
@@ -118,7 +118,6 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptio
 	Relation	toast_rel;
 	Relation	class_rel;
 	Oid			toast_relid;
-	Oid			toast_idxid;
 	Oid			toast_typid = InvalidOid;
 	Oid			namespaceid;
 	char		toast_relname[NAMEDATALEN];
@@ -274,7 +273,7 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptio
 	coloptions[0] = 0;
 	coloptions[1] = 0;
 
-	toast_idxid = index_create(toast_rel, toast_idxname, toastIndexOid,
+	index_create(toast_rel, toast_idxname, toastIndexOid,
 							   indexInfo,
 							   list_make2("chunk_id", "chunk_seq"),
 							   BTREE_AM_OID,
diff --git i/src/backend/commands/explain.c w/src/backend/commands/explain.c
index 1d9586f..bb15b25 100644
--- i/src/backend/commands/explain.c
+++ w/src/backend/commands/explain.c
@@ -1269,7 +1269,6 @@ show_plan_tlist(PlanState *planstate, List *ancestors, ExplainState *es)
 	List	   *result = NIL;
 	bool		useprefix;
 	ListCell   *lc;
-	int			i;
 
 	/* No work if empty tlist (this occurs eg in bitmap indexscans) */
 	if (plan->targetlist == NIL)
@@ -1290,7 +1289,6 @@ show_plan_tlist(PlanState *planstate, List *ancestors, ExplainState *es)
 	useprefix = list_length(es->rtable) > 1;
 
 	/* Deparse each result column (we now include resjunk ones) */
-	i = 0;
 	foreach(lc, plan->targetlist)
 	{
 		TargetEntry *tle = (TargetEntry *) lfirst(lc);
diff --git i/src/backend/commands/tablecmds.c w/src/backend/commands/tablecmds.c
index 737ab1a..82d09c0 100644
--- i/src/backend/commands/tablecmds.c
+++ w/src/backend/commands/tablecmds.c
@@ -8129,14 +8129,12 @@ MergeAttributesIntoExisting(Relation child_rel, Relation parent_rel)
 	AttrNumber	parent_attno;
 	int			parent_natts;
 	TupleDesc	tupleDesc;
-	TupleConstr *constr;
 	HeapTuple	tuple;
 
 	attrrel = heap_open(AttributeRelationId, RowExclusiveLock);
 
 	tupleDesc = RelationGetDescr(parent_rel);
 	parent_natts = tupleDesc->natts;
-	constr = tupleDesc->constr;
 
 	for (parent_attno = 1; parent_attno <= parent_natts; parent_attno++)
 	{
diff --git i/src/backend/commands/tsearchcmds.c w/src/backend/commands/tsearchcmds.c
index 81f129d..d16f1fd 100644
--- i/src/backend/commands/tsearchcmds.c
+++ w/src/backend/commands/tsearchcmds.c
@@ -2152,14 +2152,12 @@ DropConfigurationMapping(AlterTSConfigurationStmt *stmt,
 	HeapTuple	maptup;
 	int			i;
 	Oid			prsId;
-	int		   *tokens,
-				ntoken;
+	int		   *tokens;
 	ListCell   *c;
 
 	prsId = ((Form_pg_ts_config) GETSTRUCT(tup))->cfgparser;
 
 	tokens = getTokenTypes(prsId, stmt->tokentype);
-	ntoken = list_length(stmt->tokentype);
 
 	i = 0;
 	foreach(c, stmt->tokentype)
diff --git i/src/backend/commands/vacuum.c w/src/backend/commands/vacuum.c
index 1651aa9..3ec28c8 100644
--- i/src/backend/commands/vacuum.c
+++ w/src/backend/commands/vacuum.c
@@ -92,8 +92,7 @@ vacuum(VacuumStmt *vacstmt, Oid relid, bool do_toast,
 	   BufferAccessStrategy bstrategy, bool for_wraparound, bool isTopLevel)
 {
 	const char *stmttype;
-	volatile bool all_rels,
-				in_outer_xact,
+	volatile bool in_outer_xact,
 				use_own_xacts;
 	List	   *relations;
 
@@ -153,9 +152,6 @@ vacuum(VacuumStmt *vacstmt, Oid relid, bool do_toast,
 	}
 	vac_strategy = bstrategy;
 
-	/* Remember whether we are processing everything in the DB */
-	all_rels = (!OidIsValid(relid) && vacstmt->relation == NULL);
-
 	/*
 	 * Build list of relations to process, unless caller gave us one. (If we
 	 * build one, we put it in vac_context for safekeeping.)
diff --git i/src/backend/commands/variable.c w/src/backend/commands/variable.c
index 2a61ea3..1d04e33 100644
--- i/src/backend/commands/variable.c
+++ w/src/backend/commands/variable.c
@@ -855,7 +855,6 @@ show_session_authorization(void)
 	 * assign_session_authorization
 	 */
 	const char *value = session_authorization_string;
-	Oid			savedoid;
 	char	   *endptr;
 
 	/* If session_authorization hasn't been set in this process, return "" */
@@ -865,7 +864,7 @@ show_session_authorization(void)
 	Assert(strspn(value, "x") == NAMEDATALEN &&
 		   (value[NAMEDATALEN] == 'T' || value[NAMEDATALEN] == 'F'));
 
-	savedoid = (Oid) strtoul(value + NAMEDATALEN + 1, &endptr, 10);
+	strtoul(value + NAMEDATALEN + 1, &endptr, 10);
 
 	Assert(endptr != value + NAMEDATALEN + 1 && *endptr == ',');
 
diff --git i/src/backend/executor/nodeHashjoin.c w/src/backend/executor/nodeHashjoin.c
index a6847c9..114ff00 100644
--- i/src/backend/executor/nodeHashjoin.c
+++ w/src/backend/executor/nodeHashjoin.c
@@ -59,7 +59,6 @@ static bool ExecHashJoinNewBatch(HashJoinState *hjstate);
 TupleTableSlot *				/* return: a tuple or NULL */
 ExecHashJoin(HashJoinState *node)
 {
-	EState	   *estate;
 	PlanState  *outerNode;
 	HashState  *hashNode;
 	List	   *joinqual;
@@ -74,7 +73,6 @@ ExecHashJoin(HashJoinState *node)
 	/*
 	 * get information from HashJoin node
 	 */
-	estate = node->js.ps.state;
 	joinqual = node->js.joinqual;
 	otherqual = node->js.ps.qual;
 	hashNode = (HashState *) innerPlanState(node);
diff --git i/src/backend/executor/nodeMergejoin.c w/src/backend/executor/nodeMergejoin.c
index 75c3a64..bc1aa30 100644
--- i/src/backend/executor/nodeMergejoin.c
+++ w/src/backend/executor/nodeMergejoin.c
@@ -639,7 +639,6 @@ ExecMergeTupleDump(MergeJoinState *mergestate)
 TupleTableSlot *
 ExecMergeJoin(MergeJoinState *node)
 {
-	EState	   *estate;
 	List	   *joinqual;
 	List	   *otherqual;
 	bool		qualResult;
@@ -655,7 +654,6 @@ ExecMergeJoin(MergeJoinState *node)
 	/*
 	 * get information from node
 	 */
-	estate = node->js.ps.state;
 	innerPlan = innerPlanState(node);
 	outerPlan = outerPlanState(node);
 	econtext = node->js.ps.ps_ExprContext;
diff --git i/src/backend/executor/nodeRecursiveunion.c w/src/backend/executor/nodeRecursiveunion.c
index 84c0518..be0d8ba 100644
--- i/src/backend/executor/nodeRecursiveunion.c
+++ w/src/backend/executor/nodeRecursiveunion.c
@@ -79,7 +79,6 @@ ExecRecursiveUnion(RecursiveUnionState *node)
 	PlanState  *innerPlan = innerPlanState(node);
 	RecursiveUnion *plan = (RecursiveUnion *) node->ps.plan;
 	TupleTableSlot *slot;
-	RUHashEntry entry;
 	bool		isnew;
 
 	/* 1. Evaluate non-recursive term */
@@ -93,8 +92,7 @@ ExecRecursiveUnion(RecursiveUnionState *node)
 			if (plan->numCols > 0)
 			{
 				/* Find or build hashtable entry for this tuple's group */
-				entry = (RUHashEntry)
-					LookupTupleHashEntry(node->hashtable, slot, &isnew);
+				LookupTupleHashEntry(node->hashtable, slot, &isnew);
 				/* Must reset temp context after each hashtable lookup */
 				MemoryContextReset(node->tempContext);
 				/* Ignore tuple if already seen */
@@ -141,8 +139,7 @@ ExecRecursiveUnion(RecursiveUnionState *node)
 		if (plan->numCols > 0)
 		{
 			/* Find or build hashtable entry for this tuple's group */
-			entry = (RUHashEntry)
-				LookupTupleHashEntry(node->hashtable, slot, &isnew);
+			LookupTupleHashEntry(node->hashtable, slot, &isnew);
 			/* Must reset temp context after each hashtable lookup */
 			MemoryContextReset(node->tempContext);
 			/* Ignore tuple if already seen */
diff --git i/src/backend/foreign/foreign.c w/src/backend/foreign/foreign.c
index 44cd181..dfede78 100644
--- i/src/backend/foreign/foreign.c
+++ w/src/backend/foreign/foreign.c
@@ -214,7 +214,6 @@ GetForeignServerByName(const char *srvname, bool missing_ok)
 UserMapping *
 GetUserMapping(Oid userid, Oid serverid)
 {
-	Form_pg_user_mapping umform;
 	Datum		datum;
 	HeapTuple	tp;
 	bool		isnull;
@@ -238,8 +237,6 @@ GetUserMapping(Oid userid, Oid serverid)
 				 errmsg("user mapping not found for \"%s\"",
 						MappingUserName(userid))));
 
-	umform = (Form_pg_user_mapping) GETSTRUCT(tp);
-
 	um = (UserMapping *) palloc(sizeof(UserMapping));
 	um->userid = userid;
 	um->serverid = serverid;
diff --git i/src/backend/libpq/auth.c w/src/backend/libpq/auth.c
index 151ec56..70cc5a5 100644
--- i/src/backend/libpq/auth.c
+++ w/src/backend/libpq/auth.c
@@ -956,15 +956,14 @@ static void
 pg_GSS_error(int severity, char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat)
 {
 	gss_buffer_desc gmsg;
-	OM_uint32	lmaj_s,
-				lmin_s,
+	OM_uint32	lmin_s,
 				msg_ctx;
 	char		msg_major[128],
 				msg_minor[128];
 
 	/* Fetch major status message */
 	msg_ctx = 0;
-	lmaj_s = gss_display_status(&lmin_s, maj_stat, GSS_C_GSS_CODE,
+	gss_display_status(&lmin_s, maj_stat, GSS_C_GSS_CODE,
 								GSS_C_NO_OID, &msg_ctx, &gmsg);
 	strlcpy(msg_major, gmsg.value, sizeof(msg_major));
 	gss_release_buffer(&lmin_s, &gmsg);
@@ -980,7 +979,7 @@ pg_GSS_error(int severity, char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat)
 
 	/* Fetch mechanism minor status message */
 	msg_ctx = 0;
-	lmaj_s = gss_display_status(&lmin_s, min_stat, GSS_C_MECH_CODE,
+	gss_display_status(&lmin_s, min_stat, GSS_C_MECH_CODE,
 								GSS_C_NO_OID, &msg_ctx, &gmsg);
 	strlcpy(msg_minor, gmsg.value, sizeof(msg_minor));
 	gss_release_buffer(&lmin_s, &gmsg);
diff --git i/src/backend/optimizer/geqo/geqo_main.c w/src/backend/optimizer/geqo/geqo_main.c
index b3b02d6..e2a8bbc 100644
--- i/src/backend/optimizer/geqo/geqo_main.c
+++ w/src/backend/optimizer/geqo/geqo_main.c
@@ -73,15 +73,16 @@ geqo(PlannerInfo *root, int number_of_rels, List *initial_rels)
 	Chromosome *kid;
 	Pool	   *pool;
 	int			pool_size,
-				number_generations,
-				status_interval;
+				number_generations;
+#ifdef GEQO_DEBUG
+	int			status_interval;
+#endif
 	Gene	   *best_tour;
 	RelOptInfo *best_rel;
 
 #if defined(ERX)
 	Edge	   *edge_table;		/* list of edges */
 	int			edge_failures = 0;
-	float		difference;
 #endif
 #if defined(CX) || defined(PX) || defined(OX1) || defined(OX2)
 	City	   *city_table;		/* list of cities */
@@ -101,7 +102,9 @@ geqo(PlannerInfo *root, int number_of_rels, List *initial_rels)
 /* set GA parameters */
 	pool_size = gimme_pool_size(number_of_rels);
 	number_generations = gimme_number_generations(pool_size);
+#ifdef GEQO_DEBUG
 	status_interval = 10;
+#endif
 
 /* allocate genetic pool memory */
 	pool = alloc_pool(root, pool_size, number_of_rels);
@@ -178,7 +181,7 @@ geqo(PlannerInfo *root, int number_of_rels, List *initial_rels)
 
 #if defined (ERX)
 		/* EDGE RECOMBINATION CROSSOVER */
-		difference = gimme_edge_table(root, momma->string, daddy->string, pool->string_length, edge_table);
+		gimme_edge_table(root, momma->string, daddy->string, pool->string_length, edge_table);
 
 		kid = momma;
 
diff --git i/src/backend/parser/parse_utilcmd.c w/src/backend/parser/parse_utilcmd.c
index fe8d0c4..1eda78f 100644
--- i/src/backend/parser/parse_utilcmd.c
+++ w/src/backend/parser/parse_utilcmd.c
@@ -2516,9 +2516,8 @@ transformColumnType(CreateStmtContext *cxt, ColumnDef *column)
 	if (column->collClause)
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(ctype);
-		Oid		collOid;
 
-		collOid = LookupCollation(cxt->pstate,
+		LookupCollation(cxt->pstate,
 								  column->collClause->collname,
 								  column->collClause->location);
 		/* Complain if COLLATE is applied to an uncollatable type */
diff --git i/src/backend/rewrite/rewriteDefine.c w/src/backend/rewrite/rewriteDefine.c
index a405dbf..5bdbbd8 100644
--- i/src/backend/rewrite/rewriteDefine.c
+++ w/src/backend/rewrite/rewriteDefine.c
@@ -232,7 +232,6 @@ DefineQueryRewrite(char *rulename,
 				   List *action)
 {
 	Relation	event_relation;
-	Oid			ruleId;
 	int			event_attno;
 	ListCell   *l;
 	Query	   *query;
@@ -488,7 +487,7 @@ DefineQueryRewrite(char *rulename,
 	/* discard rule if it's null action and not INSTEAD; it's a no-op */
 	if (action != NIL || is_instead)
 	{
-		ruleId = InsertRule(rulename,
+		InsertRule(rulename,
 							event_type,
 							event_relid,
 							event_attno,
diff --git i/src/backend/storage/ipc/standby.c w/src/backend/storage/ipc/standby.c
index 2e71484..277ae16 100644
--- i/src/backend/storage/ipc/standby.c
+++ w/src/backend/storage/ipc/standby.c
@@ -334,7 +334,6 @@ static void
 ResolveRecoveryConflictWithLock(Oid dbOid, Oid relOid)
 {
 	VirtualTransactionId *backends;
-	bool		report_memory_error = false;
 	bool		lock_acquired = false;
 	int			num_attempts = 0;
 	LOCKTAG		locktag;
@@ -354,11 +353,8 @@ ResolveRecoveryConflictWithLock(Oid dbOid, Oid relOid)
 		if (++num_attempts < 3)
 			backends = GetLockConflicts(&locktag, AccessExclusiveLock);
 		else
-		{
 			backends = GetConflictingVirtualXIDs(InvalidTransactionId,
 												 InvalidOid);
-			report_memory_error = true;
-		}
 
 		ResolveRecoveryConflictWithVirtualXIDs(backends,
 											 PROCSIG_RECOVERY_CONFLICT_LOCK);
diff --git i/src/backend/storage/smgr/md.c w/src/backend/storage/smgr/md.c
index 9d585b6..9afce7c 100644
--- i/src/backend/storage/smgr/md.c
+++ w/src/backend/storage/smgr/md.c
@@ -901,13 +901,12 @@ void
 mdimmedsync(SMgrRelation reln, ForkNumber forknum)
 {
 	MdfdVec    *v;
-	BlockNumber curnblk;
 
 	/*
 	 * NOTE: mdnblocks makes sure we have opened all active segments, so that
 	 * fsync loop will get them all!
 	 */
-	curnblk = mdnblocks(reln, forknum);
+	mdnblocks(reln, forknum);
 
 	v = mdopen(reln, forknum, EXTENSION_FAIL);
 
diff --git i/src/backend/utils/adt/ri_triggers.c w/src/backend/utils/adt/ri_triggers.c
index 591d2eb..ada1c95 100644
--- i/src/backend/utils/adt/ri_triggers.c
+++ w/src/backend/utils/adt/ri_triggers.c
@@ -255,7 +255,6 @@ RI_FKey_check(PG_FUNCTION_ARGS)
 	Relation	fk_rel;
 	Relation	pk_rel;
 	HeapTuple	new_row;
-	HeapTuple	old_row;
 	Buffer		new_row_buf;
 	RI_QueryKey qkey;
 	SPIPlanPtr	qplan;
@@ -274,13 +273,11 @@ RI_FKey_check(PG_FUNCTION_ARGS)
 
 	if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
 	{
-		old_row = trigdata->tg_trigtuple;
 		new_row = trigdata->tg_newtuple;
 		new_row_buf = trigdata->tg_newtuplebuf;
 	}
 	else
 	{
-		old_row = NULL;
 		new_row = trigdata->tg_trigtuple;
 		new_row_buf = trigdata->tg_trigtuplebuf;
 	}
diff --git i/src/backend/utils/adt/selfuncs.c w/src/backend/utils/adt/selfuncs.c
index f7358d1..9187f65 100644
--- i/src/backend/utils/adt/selfuncs.c
+++ w/src/backend/utils/adt/selfuncs.c
@@ -1081,7 +1081,6 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype, bool negate)
 	List	   *args = (List *) PG_GETARG_POINTER(2);
 	int			varRelid = PG_GETARG_INT32(3);
 	VariableStatData vardata;
-	Node	   *variable;
 	Node	   *other;
 	bool		varonleft;
 	Datum		constval;
@@ -1123,7 +1122,6 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype, bool negate)
 		ReleaseVariableStats(vardata);
 		return result;
 	}
-	variable = (Node *) linitial(args);
 
 	/*
 	 * If the constant is NULL, assume operator is strict and return zero, ie,
@@ -2286,7 +2284,6 @@ eqjoinsel_semi(Oid operator,
 	double		nd1;
 	double		nd2;
 	Form_pg_statistic stats1 = NULL;
-	Form_pg_statistic stats2 = NULL;
 	bool		have_mcvs1 = false;
 	Datum	   *values1 = NULL;
 	int			nvalues1 = 0;
@@ -2316,7 +2313,6 @@ eqjoinsel_semi(Oid operator,
 
 	if (HeapTupleIsValid(vardata2->statsTuple))
 	{
-		stats2 = (Form_pg_statistic) GETSTRUCT(vardata2->statsTuple);
 		have_mcvs2 = get_attstatsslot(vardata2->statsTuple,
 									  vardata2->atttype,
 									  vardata2->atttypmod,
@@ -4410,7 +4406,6 @@ get_variable_range(PlannerInfo *root, VariableStatData *vardata, Oid sortop,
 	Datum		tmin = 0;
 	Datum		tmax = 0;
 	bool		have_data = false;
-	Form_pg_statistic stats;
 	int16		typLen;
 	bool		typByVal;
 	Datum	   *values;
@@ -4434,7 +4429,6 @@ get_variable_range(PlannerInfo *root, VariableStatData *vardata, Oid sortop,
 		/* no stats available, so default result */
 		return false;
 	}
-	stats = (Form_pg_statistic) GETSTRUCT(vardata->statsTuple);
 
 	get_typlenbyval(vardata->atttype, &typLen, &typByVal);
 
diff --git i/src/bin/pg_basebackup/pg_basebackup.c w/src/bin/pg_basebackup/pg_basebackup.c
index 9f926bd..b44f821 100644
--- i/src/bin/pg_basebackup/pg_basebackup.c
+++ w/src/bin/pg_basebackup/pg_basebackup.c
@@ -755,7 +755,7 @@ static void
 BaseBackup(void)
 {
 	PGresult   *res;
-	uint32		timeline;
+	uint32		timeline; // XXX: not used?!?
 	char		current_path[MAXPGPATH];
 	char		escaped_label[MAXPGPATH];
 	int			i;
diff --git i/src/bin/pg_dump/common.c w/src/bin/pg_dump/common.c
index 472760e..c419c2d 100644
--- i/src/bin/pg_dump/common.c
+++ w/src/bin/pg_dump/common.c
@@ -80,24 +80,9 @@ static int	strInArray(const char *pattern, char **arr, int arr_size);
 TableInfo *
 getSchemaData(int *numTablesPtr)
 {
-	NamespaceInfo *nsinfo;
 	ExtensionInfo *extinfo;
-	AggInfo    *agginfo;
 	InhInfo    *inhinfo;
-	RuleInfo   *ruleinfo;
-	ProcLangInfo *proclanginfo;
-	CastInfo   *castinfo;
-	OpclassInfo *opcinfo;
-	OpfamilyInfo *opfinfo;
 	CollInfo   *collinfo;
-	ConvInfo   *convinfo;
-	TSParserInfo *prsinfo;
-	TSTemplateInfo *tmplinfo;
-	TSDictInfo *dictinfo;
-	TSConfigInfo *cfginfo;
-	FdwInfo    *fdwinfo;
-	ForeignServerInfo *srvinfo;
-	DefaultACLInfo *daclinfo;
 	int			numNamespaces;
 	int			numExtensions;
 	int			numAggregates;
@@ -118,7 +103,7 @@ getSchemaData(int *numTablesPtr)
 
 	if (g_verbose)
 		write_msg(NULL, "reading schemas\n");
-	nsinfo = getNamespaces(&numNamespaces);
+	getNamespaces(&numNamespaces);
 
 	if (g_verbose)
 		write_msg(NULL, "reading extensions\n");
@@ -138,11 +123,11 @@ getSchemaData(int *numTablesPtr)
 	/* this must be after getFuncs, too */
 	if (g_verbose)
 		write_msg(NULL, "reading procedural languages\n");
-	proclanginfo = getProcLangs(&numProcLangs);
+	getProcLangs(&numProcLangs);
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined aggregate functions\n");
-	agginfo = getAggregates(&numAggregates);
+	getAggregates(&numAggregates);
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined operators\n");
@@ -151,39 +136,39 @@ getSchemaData(int *numTablesPtr)
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined operator classes\n");
-	opcinfo = getOpclasses(&numOpclasses);
+	getOpclasses(&numOpclasses);
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined operator families\n");
-	opfinfo = getOpfamilies(&numOpfamilies);
+	getOpfamilies(&numOpfamilies);
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined text search parsers\n");
-	prsinfo = getTSParsers(&numTSParsers);
+	getTSParsers(&numTSParsers);
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined text search templates\n");
-	tmplinfo = getTSTemplates(&numTSTemplates);
+	getTSTemplates(&numTSTemplates);
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined text search dictionaries\n");
-	dictinfo = getTSDictionaries(&numTSDicts);
+	getTSDictionaries(&numTSDicts);
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined text search configurations\n");
-	cfginfo = getTSConfigurations(&numTSConfigs);
+	getTSConfigurations(&numTSConfigs);
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined foreign-data wrappers\n");
-	fdwinfo = getForeignDataWrappers(&numForeignDataWrappers);
+	getForeignDataWrappers(&numForeignDataWrappers);
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined foreign servers\n");
-	srvinfo = getForeignServers(&numForeignServers);
+	getForeignServers(&numForeignServers);
 
 	if (g_verbose)
 		write_msg(NULL, "reading default privileges\n");
-	daclinfo = getDefaultACLs(&numDefaultACLs);
+	getDefaultACLs(&numDefaultACLs);
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined collations\n");
@@ -192,11 +177,11 @@ getSchemaData(int *numTablesPtr)
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined conversions\n");
-	convinfo = getConversions(&numConversions);
+	getConversions(&numConversions);
 
 	if (g_verbose)
 		write_msg(NULL, "reading type casts\n");
-	castinfo = getCasts(&numCasts);
+	getCasts(&numCasts);
 
 	if (g_verbose)
 		write_msg(NULL, "reading user-defined tables\n");
@@ -209,7 +194,7 @@ getSchemaData(int *numTablesPtr)
 
 	if (g_verbose)
 		write_msg(NULL, "reading rewrite rules\n");
-	ruleinfo = getRules(&numRules);
+	getRules(&numRules);
 
 	/*
 	 * Identify extension member objects and mark them as not to be dumped.
diff --git i/src/bin/pg_dump/pg_backup_custom.c w/src/bin/pg_dump/pg_backup_custom.c
index 87c6fb6..9b2054c 100644
--- i/src/bin/pg_dump/pg_backup_custom.c
+++ w/src/bin/pg_dump/pg_backup_custom.c
@@ -237,7 +237,6 @@ _WriteExtraToc(ArchiveHandle *AH, TocEntry *te)
 static void
 _ReadExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
-	int			junk;
 	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
 	if (ctx == NULL)
@@ -253,7 +252,7 @@ _ReadExtraToc(ArchiveHandle *AH, TocEntry *te)
 	 * dump it at all.
 	 */
 	if (AH->version < K_VERS_1_7)
-		junk = ReadInt(AH);
+		ReadInt(AH);
 }
 
 /*
diff --git i/src/bin/pg_dump/pg_dump.c w/src/bin/pg_dump/pg_dump.c
index 5561295..a9c8da4 100644
--- i/src/bin/pg_dump/pg_dump.c
+++ w/src/bin/pg_dump/pg_dump.c
@@ -7312,8 +7312,6 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
 	char	   *typmodin;
 	char	   *typmodout;
 	char	   *typanalyze;
-	Oid			typinputoid;
-	Oid			typoutputoid;
 	Oid			typreceiveoid;
 	Oid			typsendoid;
 	Oid			typmodinoid;
@@ -7338,8 +7336,6 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
 		appendPQExpBuffer(query, "SELECT typlen, "
 						  "typinput, typoutput, typreceive, typsend, "
 						  "typmodin, typmodout, typanalyze, "
-						  "typinput::pg_catalog.oid AS typinputoid, "
-						  "typoutput::pg_catalog.oid AS typoutputoid, "
 						  "typreceive::pg_catalog.oid AS typreceiveoid, "
 						  "typsend::pg_catalog.oid AS typsendoid, "
 						  "typmodin::pg_catalog.oid AS typmodinoid, "
@@ -7358,8 +7354,6 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
 		appendPQExpBuffer(query, "SELECT typlen, "
 						  "typinput, typoutput, typreceive, typsend, "
 						  "typmodin, typmodout, typanalyze, "
-						  "typinput::pg_catalog.oid AS typinputoid, "
-						  "typoutput::pg_catalog.oid AS typoutputoid, "
 						  "typreceive::pg_catalog.oid AS typreceiveoid, "
 						  "typsend::pg_catalog.oid AS typsendoid, "
 						  "typmodin::pg_catalog.oid AS typmodinoid, "
@@ -7379,8 +7373,6 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
 		appendPQExpBuffer(query, "SELECT typlen, "
 						  "typinput, typoutput, typreceive, typsend, "
 						  "typmodin, typmodout, typanalyze, "
-						  "typinput::pg_catalog.oid AS typinputoid, "
-						  "typoutput::pg_catalog.oid AS typoutputoid, "
 						  "typreceive::pg_catalog.oid AS typreceiveoid, "
 						  "typsend::pg_catalog.oid AS typsendoid, "
 						  "typmodin::pg_catalog.oid AS typmodinoid, "
@@ -7400,8 +7392,6 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
 						  "typinput, typoutput, typreceive, typsend, "
 						  "'-' AS typmodin, '-' AS typmodout, "
 						  "typanalyze, "
-						  "typinput::pg_catalog.oid AS typinputoid, "
-						  "typoutput::pg_catalog.oid AS typoutputoid, "
 						  "typreceive::pg_catalog.oid AS typreceiveoid, "
 						  "typsend::pg_catalog.oid AS typsendoid, "
 						  "0 AS typmodinoid, 0 AS typmodoutoid, "
@@ -7420,8 +7410,6 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
 						  "typinput, typoutput, typreceive, typsend, "
 						  "'-' AS typmodin, '-' AS typmodout, "
 						  "'-' AS typanalyze, "
-						  "typinput::pg_catalog.oid AS typinputoid, "
-						  "typoutput::pg_catalog.oid AS typoutputoid, "
 						  "typreceive::pg_catalog.oid AS typreceiveoid, "
 						  "typsend::pg_catalog.oid AS typsendoid, "
 						  "0 AS typmodinoid, 0 AS typmodoutoid, "
@@ -7441,8 +7429,6 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
 						  "'-' AS typreceive, '-' AS typsend, "
 						  "'-' AS typmodin, '-' AS typmodout, "
 						  "'-' AS typanalyze, "
-						  "typinput::pg_catalog.oid AS typinputoid, "
-						  "typoutput::pg_catalog.oid AS typoutputoid, "
 						  "0 AS typreceiveoid, 0 AS typsendoid, "
 						  "0 AS typmodinoid, 0 AS typmodoutoid, "
 						  "0 AS typanalyzeoid, "
@@ -7465,8 +7451,6 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
 						  "'-' AS typreceive, '-' AS typsend, "
 						  "'-' AS typmodin, '-' AS typmodout, "
 						  "'-' AS typanalyze, "
-						  "typinput::oid AS typinputoid, "
-						  "typoutput::oid AS typoutputoid, "
 						  "0 AS typreceiveoid, 0 AS typsendoid, "
 						  "0 AS typmodinoid, 0 AS typmodoutoid, "
 						  "0 AS typanalyzeoid, "
@@ -7489,8 +7473,6 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
 						  "'-' AS typreceive, '-' AS typsend, "
 						  "'-' AS typmodin, '-' AS typmodout, "
 						  "'-' AS typanalyze, "
-						  "typinput::oid AS typinputoid, "
-						  "typoutput::oid AS typoutputoid, "
 						  "0 AS typreceiveoid, 0 AS typsendoid, "
 						  "0 AS typmodinoid, 0 AS typmodoutoid, "
 						  "0 AS typanalyzeoid, "
@@ -7509,8 +7491,6 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
 						  "'-' AS typreceive, '-' AS typsend, "
 						  "'-' AS typmodin, '-' AS typmodout, "
 						  "'-' AS typanalyze, "
-						  "typinput::oid AS typinputoid, "
-						  "typoutput::oid AS typoutputoid, "
 						  "0 AS typreceiveoid, 0 AS typsendoid, "
 						  "0 AS typmodinoid, 0 AS typmodoutoid, "
 						  "0 AS typanalyzeoid, "
@@ -7546,8 +7526,6 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
 	typmodin = PQgetvalue(res, 0, PQfnumber(res, "typmodin"));
 	typmodout = PQgetvalue(res, 0, PQfnumber(res, "typmodout"));
 	typanalyze = PQgetvalue(res, 0, PQfnumber(res, "typanalyze"));
-	typinputoid = atooid(PQgetvalue(res, 0, PQfnumber(res, "typinputoid")));
-	typoutputoid = atooid(PQgetvalue(res, 0, PQfnumber(res, "typoutputoid")));
 	typreceiveoid = atooid(PQgetvalue(res, 0, PQfnumber(res, "typreceiveoid")));
 	typsendoid = atooid(PQgetvalue(res, 0, PQfnumber(res, "typsendoid")));
 	typmodinoid = atooid(PQgetvalue(res, 0, PQfnumber(res, "typmodinoid")));
@@ -10141,10 +10119,8 @@ dumpCollation(Archive *fout, CollInfo *collinfo)
 	PQExpBuffer labelq;
 	PGresult   *res;
 	int			ntups;
-	int			i_collname;
 	int			i_collcollate;
 	int			i_collctype;
-	const char *collname;
 	const char *collcollate;
 	const char *collctype;
 
@@ -10161,7 +10137,7 @@ dumpCollation(Archive *fout, CollInfo *collinfo)
 	selectSourceSchema(collinfo->dobj.namespace->dobj.name);
 
 	/* Get conversion-specific details */
-	appendPQExpBuffer(query, "SELECT collname, "
+	appendPQExpBuffer(query, "SELECT "
 					  "collcollate, "
 					  "collctype "
 					  "FROM pg_catalog.pg_collation c "
@@ -10182,11 +10158,9 @@ dumpCollation(Archive *fout, CollInfo *collinfo)
 		exit_nicely();
 	}
 
-	i_collname = PQfnumber(res, "collname");
 	i_collcollate = PQfnumber(res, "collcollate");
 	i_collctype = PQfnumber(res, "collctype");
 
-	collname = PQgetvalue(res, 0, i_collname);
 	collcollate = PQgetvalue(res, 0, i_collcollate);
 	collctype = PQgetvalue(res, 0, i_collctype);
 
@@ -10246,12 +10220,10 @@ dumpConversion(Archive *fout, ConvInfo *convinfo)
 	PQExpBuffer labelq;
 	PGresult   *res;
 	int			ntups;
-	int			i_conname;
 	int			i_conforencoding;
 	int			i_contoencoding;
 	int			i_conproc;
 	int			i_condefault;
-	const char *conname;
 	const char *conforencoding;
 	const char *contoencoding;
 	const char *conproc;
@@ -10270,7 +10242,7 @@ dumpConversion(Archive *fout, ConvInfo *convinfo)
 	selectSourceSchema(convinfo->dobj.namespace->dobj.name);
 
 	/* Get conversion-specific details */
-	appendPQExpBuffer(query, "SELECT conname, "
+	appendPQExpBuffer(query, "SELECT "
 		 "pg_catalog.pg_encoding_to_char(conforencoding) AS conforencoding, "
 		   "pg_catalog.pg_encoding_to_char(contoencoding) AS contoencoding, "
 					  "conproc, condefault "
@@ -10292,13 +10264,11 @@ dumpConversion(Archive *fout, ConvInfo *convinfo)
 		exit_nicely();
 	}
 
-	i_conname = PQfnumber(res, "conname");
 	i_conforencoding = PQfnumber(res, "conforencoding");
 	i_contoencoding = PQfnumber(res, "contoencoding");
 	i_conproc = PQfnumber(res, "conproc");
 	i_condefault = PQfnumber(res, "condefault");
 
-	conname = PQgetvalue(res, 0, i_conname);
 	conforencoding = PQgetvalue(res, 0, i_conforencoding);
 	contoencoding = PQgetvalue(res, 0, i_contoencoding);
 	conproc = PQgetvalue(res, 0, i_conproc);
@@ -11771,7 +11741,6 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
 	char	   *storage;
 	int			j,
 				k;
-	bool		toast_set = false;
 	char	   *srvname;
 	char	   *ftoptions = NULL;
 
@@ -11779,7 +11748,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
 	selectSourceSchema(tbinfo->dobj.namespace->dobj.name);
 
 	if (binary_upgrade)
-		toast_set = binary_upgrade_set_type_oids_by_rel_oid(q,
+		binary_upgrade_set_type_oids_by_rel_oid(q,
 													 tbinfo->dobj.catId.oid);
 
 	/* Is it a table or a view? */
diff --git i/src/bin/pg_dump/pg_dumpall.c w/src/bin/pg_dump/pg_dumpall.c
index 9082653..00afd74 100644
--- i/src/bin/pg_dump/pg_dumpall.c
+++ w/src/bin/pg_dump/pg_dumpall.c
@@ -91,7 +91,6 @@ main(int argc, char *argv[])
 	bool		output_clean = false;
 	bool		roles_only = false;
 	bool		tablespaces_only = false;
-	bool		schema_only = false;
 	PGconn	   *conn;
 	int			encoding;
 	const char *std_strings;
@@ -241,7 +240,6 @@ main(int argc, char *argv[])
 				break;
 
 			case 's':
-				schema_only = true;
 				appendPQExpBuffer(pgdumpopts, " -s");
 				break;
 
@@ -632,7 +630,6 @@ dumpRoles(PGconn *conn)
 				i_rolinherit,
 				i_rolcreaterole,
 				i_rolcreatedb,
-				i_rolcatupdate,
 				i_rolcanlogin,
 				i_rolconnlimit,
 				i_rolpassword,
@@ -645,7 +642,7 @@ dumpRoles(PGconn *conn)
 	if (server_version >= 90100)
 		printfPQExpBuffer(buf,
 						  "SELECT oid, rolname, rolsuper, rolinherit, "
-						  "rolcreaterole, rolcreatedb, rolcatupdate, "
+						  "rolcreaterole, rolcreatedb, "
 						  "rolcanlogin, rolconnlimit, rolpassword, "
 						  "rolvaliduntil, rolreplication, "
 			  "pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment "
@@ -654,7 +651,7 @@ dumpRoles(PGconn *conn)
 	else if (server_version >= 80200)
 		printfPQExpBuffer(buf,
 						  "SELECT oid, rolname, rolsuper, rolinherit, "
-						  "rolcreaterole, rolcreatedb, rolcatupdate, "
+						  "rolcreaterole, rolcreatedb, "
 						  "rolcanlogin, rolconnlimit, rolpassword, "
 						  "rolvaliduntil, false as rolreplication, "
 			  "pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment "
@@ -663,7 +660,7 @@ dumpRoles(PGconn *conn)
 	else if (server_version >= 80100)
 		printfPQExpBuffer(buf,
 						  "SELECT oid, rolname, rolsuper, rolinherit, "
-						  "rolcreaterole, rolcreatedb, rolcatupdate, "
+						  "rolcreaterole, rolcreatedb, "
 						  "rolcanlogin, rolconnlimit, rolpassword, "
 						  "rolvaliduntil, false as rolreplication, "
 						  "null as rolcomment "
@@ -676,7 +673,6 @@ dumpRoles(PGconn *conn)
 						  "true as rolinherit, "
 						  "usesuper as rolcreaterole, "
 						  "usecreatedb as rolcreatedb, "
-						  "usecatupd as rolcatupdate, "
 						  "true as rolcanlogin, "
 						  "-1 as rolconnlimit, "
 						  "passwd as rolpassword, "
@@ -690,7 +686,6 @@ dumpRoles(PGconn *conn)
 						  "true as rolinherit, "
 						  "false as rolcreaterole, "
 						  "false as rolcreatedb, "
-						  "false as rolcatupdate, "
 						  "false as rolcanlogin, "
 						  "-1 as rolconnlimit, "
 						  "null::text as rolpassword, "
@@ -710,7 +705,6 @@ dumpRoles(PGconn *conn)
 	i_rolinherit = PQfnumber(res, "rolinherit");
 	i_rolcreaterole = PQfnumber(res, "rolcreaterole");
 	i_rolcreatedb = PQfnumber(res, "rolcreatedb");
-	i_rolcatupdate = PQfnumber(res, "rolcatupdate");
 	i_rolcanlogin = PQfnumber(res, "rolcanlogin");
 	i_rolconnlimit = PQfnumber(res, "rolconnlimit");
 	i_rolpassword = PQfnumber(res, "rolpassword");
diff --git i/src/bin/psql/psqlscan.l w/src/bin/psql/psqlscan.l
index 3575f91..dfc6648 100644
--- i/src/bin/psql/psqlscan.l
+++ w/src/bin/psql/psqlscan.l
@@ -1384,7 +1384,6 @@ char *
 psql_scan_slash_command(PsqlScanState state)
 {
 	PQExpBufferData mybuf;
-	int			lexresult;
 
 	/* Must be scanning already */
 	psql_assert(state->scanbufhandle);
@@ -1404,7 +1403,7 @@ psql_scan_slash_command(PsqlScanState state)
 	BEGIN(xslashcmd);
 
 	/* And lex. */
-	lexresult = yylex();
+	yylex();
 
 	/* There are no possible errors in this lex state... */
 
@@ -1641,8 +1640,6 @@ psql_scan_slash_option(PsqlScanState state,
 void
 psql_scan_slash_command_end(PsqlScanState state)
 {
-	int			lexresult;
-
 	/* Must be scanning already */
 	psql_assert(state->scanbufhandle);
 
@@ -1658,7 +1655,7 @@ psql_scan_slash_command_end(PsqlScanState state)
 	BEGIN(xslashend);
 
 	/* And lex. */
-	lexresult = yylex();
+	yylex();
 
 	/* There are no possible errors in this lex state... */
 }
diff --git i/src/interfaces/ecpg/ecpglib/descriptor.c w/src/interfaces/ecpg/ecpglib/descriptor.c
index c9d960a..a63ed35 100644
--- i/src/interfaces/ecpg/ecpglib/descriptor.c
+++ w/src/interfaces/ecpg/ecpglib/descriptor.c
@@ -764,11 +764,8 @@ ECPGdescribe(int line, int compat, bool input, const char *connection_name, cons
 
 	for (;;)
 	{
-		enum ECPGttype type,
-					dummy_type;
-		void	   *ptr,
-				   *dummy_ptr;
-		long		dummy;
+		enum ECPGttype type;
+		void	   *ptr;
 
 		/* variable type */
 		type = va_arg(args, enum ECPGttype);
@@ -778,16 +775,16 @@ ECPGdescribe(int line, int compat, bool input, const char *connection_name, cons
 
 		/* rest of variable parameters */
 		ptr = va_arg(args, void *);
-		dummy = va_arg(args, long);
-		dummy = va_arg(args, long);
-		dummy = va_arg(args, long);
+		va_arg(args, long);
+		va_arg(args, long);
+		va_arg(args, long);
 
 		/* variable indicator */
-		dummy_type = va_arg(args, enum ECPGttype);
-		dummy_ptr = va_arg(args, void *);
-		dummy = va_arg(args, long);
-		dummy = va_arg(args, long);
-		dummy = va_arg(args, long);
+		va_arg(args, enum ECPGttype);
+		va_arg(args, void *);
+		va_arg(args, long);
+		va_arg(args, long);
+		va_arg(args, long);
 
 		switch (type)
 		{
diff --git i/src/interfaces/libpq/fe-auth.c w/src/interfaces/libpq/fe-auth.c
index 7d2ef51..c2ca0dc 100644
--- i/src/interfaces/libpq/fe-auth.c
+++ w/src/interfaces/libpq/fe-auth.c
@@ -320,14 +320,13 @@ static void
 pg_GSS_error_int(PQExpBuffer str, const char *mprefix,
 				 OM_uint32 stat, int type)
 {
-	OM_uint32	lmaj_s,
-				lmin_s;
+	OM_uint32	lmin_s;
 	gss_buffer_desc lmsg;
 	OM_uint32	msg_ctx = 0;
 
 	do
 	{
-		lmaj_s = gss_display_status(&lmin_s, stat, type,
+		gss_display_status(&lmin_s, stat, type,
 									GSS_C_NO_OID, &msg_ctx, &lmsg);
 		appendPQExpBuffer(str, "%s: %s\n", mprefix, (char *) lmsg.value);
 		gss_release_buffer(&lmin_s, &lmsg);
diff --git i/src/pl/plpgsql/src/pl_exec.c w/src/pl/plpgsql/src/pl_exec.c
index f793991..43a1d1a 100644
--- i/src/pl/plpgsql/src/pl_exec.c
+++ w/src/pl/plpgsql/src/pl_exec.c
@@ -1913,7 +1913,6 @@ exec_stmt_forc(PLpgSQL_execstate *estate, PLpgSQL_stmt_forc *stmt)
 {
 	PLpgSQL_var *curvar;
 	char	   *curname = NULL;
-	const char *portalname;
 	PLpgSQL_expr *query;
 	ParamListInfo paramLI;
 	Portal		portal;
@@ -1997,7 +1996,6 @@ exec_stmt_forc(PLpgSQL_execstate *estate, PLpgSQL_stmt_forc *stmt)
 	if (portal == NULL)
 		elog(ERROR, "could not open cursor: %s",
 			 SPI_result_code_string(SPI_result));
-	portalname = portal->name;
 
 	/* don't need paramlist any more */
 	if (paramLI)
#2Robert Haas
robertmhaas@gmail.com
In reply to: Peter Eisentraut (#1)
Re: gcc 4.6 warnings -Wunused-but-set-variable

On Tue, Mar 29, 2011 at 4:48 PM, Peter Eisentraut <peter_e@gmx.net> wrote:

As you might have heard, GCC 4.6 was released the other day.  It
generates a bunch of new warnings with the PostgreSQL source code, most
of which belong to the new warning scenario -Wunused-but-set-variable,
which is included in -Wall.

Attached is a patch that gets rid of most of these.  As you can see,
most of these remove real leftover garbage.  The line I marked in
pg_basebackup.c might be an actual problem: It goes through a whole lot
to figure out the timeline and then doesn't do anything with it.  In
some other cases, however, one might argue that the changes lose some
clarity, such as when dropping the return value of strtoul() or
va_arg().  How should we proceed?  In any case, my patch should be
re-reviewed for any possible side effects that I might have hastily
removed.

In the case of variable.c, it is entirely unclear that there's any
point in calling strtoul() at all. Maybe we should just remove that
and the following Assert() as well.

In parse_utilcmd.c, do we need to look up the collation OID if we're
just discarding it anyway?

In the case of the va_arg() calls, maybe something like /* advance arg
position, but ignore result */?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Peter Eisentraut (#1)
timeline garbage in pg_basebackup (was gcc 4.6 warnings -Wunused-but-set-variable)

On tis, 2011-03-29 at 23:48 +0300, Peter Eisentraut wrote:

The line I marked in pg_basebackup.c might be an actual problem: It
goes through a whole lot to figure out the timeline and then doesn't
do anything with it.

This hasn't been addressed yet. It doesn't manifest itself as an actual
problem, but it looks as though someone had intended something in that
code and the code doesn't do that.

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Peter Eisentraut (#1)
Re: gcc 4.6 warnings -Wunused-but-set-variable

On tis, 2011-03-29 at 23:48 +0300, Peter Eisentraut wrote:

As you might have heard, GCC 4.6 was released the other day. It
generates a bunch of new warnings with the PostgreSQL source code, most
of which belong to the new warning scenario -Wunused-but-set-variable,
which is included in -Wall.

In case someone else tries that, I have filed a bug with GCC regarding
some of the other warnings:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48778

#5Magnus Hagander
magnus@hagander.net
In reply to: Peter Eisentraut (#3)
Re: timeline garbage in pg_basebackup (was gcc 4.6 warnings -Wunused-but-set-variable)

On Wed, Apr 27, 2011 at 18:55, Peter Eisentraut <peter_e@gmx.net> wrote:

On tis, 2011-03-29 at 23:48 +0300, Peter Eisentraut wrote:

The line I marked in pg_basebackup.c might be an actual problem: It
goes through a whole lot to figure out the timeline and then doesn't
do anything with it.

This hasn't been addressed yet.  It doesn't manifest itself as an actual
problem, but it looks as though someone had intended something in that
code and the code doesn't do that.

Do you have a ref to the actual problem? The subject change killed my
threading, the email was trimmed to not include the actual problem,
and it appears not to be listed on the open items list... ;)

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

#6Peter Eisentraut
peter_e@gmx.net
In reply to: Magnus Hagander (#5)
Re: timeline garbage in pg_basebackup (was gcc 4.6 warnings -Wunused-but-set-variable)

On ons, 2011-04-27 at 19:17 +0200, Magnus Hagander wrote:

On Wed, Apr 27, 2011 at 18:55, Peter Eisentraut <peter_e@gmx.net> wrote:

On tis, 2011-03-29 at 23:48 +0300, Peter Eisentraut wrote:

The line I marked in pg_basebackup.c might be an actual problem: It
goes through a whole lot to figure out the timeline and then doesn't
do anything with it.

This hasn't been addressed yet. It doesn't manifest itself as an actual
problem, but it looks as though someone had intended something in that
code and the code doesn't do that.

Do you have a ref to the actual problem? The subject change killed my
threading, the email was trimmed to not include the actual problem,
and it appears not to be listed on the open items list... ;)

In BaseBackup(), the variable timeline is assigned in a somewhat
elaborate fashion, but then the result is not used for anything.

#7Magnus Hagander
magnus@hagander.net
In reply to: Peter Eisentraut (#6)
Re: timeline garbage in pg_basebackup (was gcc 4.6 warnings -Wunused-but-set-variable)

On Wed, Apr 27, 2011 at 20:21, Peter Eisentraut <peter_e@gmx.net> wrote:

On ons, 2011-04-27 at 19:17 +0200, Magnus Hagander wrote:

On Wed, Apr 27, 2011 at 18:55, Peter Eisentraut <peter_e@gmx.net> wrote:

On tis, 2011-03-29 at 23:48 +0300, Peter Eisentraut wrote:

The line I marked in pg_basebackup.c might be an actual problem: It
goes through a whole lot to figure out the timeline and then doesn't
do anything with it.

This hasn't been addressed yet.  It doesn't manifest itself as an actual
problem, but it looks as though someone had intended something in that
code and the code doesn't do that.

Do you have a ref to the actual problem? The subject change killed my
threading, the email was trimmed to not include the actual problem,
and it appears not to be listed on the open items list... ;)

In BaseBackup(), the variable timeline is assigned in a somewhat
elaborate fashion, but then the result is not used for anything.

Ah, I see it.

What happened there is I accidentally included it when I split my
patches apart. It's required in the "stream WAL in parallel to the
base backup to decrease requirements on wal_keep_segmtents". But that
patch was postponed since there were still bugs in it, and it wasn't
entirely feature-complete, and we were pretty far past feature-freeze.

So it's not needed in 9.1. I'll rip it out and move it over to the
patch once it's ready to go for 9.2.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/