From: Peter Eisentraut Date: Mon, 16 Jul 2012 19:15:03 +0000 (+0300) Subject: Remove unreachable code X-Git-Tag: REL9_3_BETA1~1197 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd16f9480ac67ab0c6b0102d110cd5121ed9ab46;p=postgresql Remove unreachable code The Solaris Studio compiler warns about these instances, unlike more mainstream compilers such as gcc. But manual inspection showed that the code is clearly not reachable, and we hope no worthy compiler will complain about removing this code. --- diff --git a/contrib/hstore/hstore_io.c b/contrib/hstore/hstore_io.c index aadf050410..7bdac3d94c 100644 --- a/contrib/hstore/hstore_io.c +++ b/contrib/hstore/hstore_io.c @@ -163,8 +163,6 @@ get_val(HSParser *state, bool ignoreeq, bool *escaped) state->ptr++; } - - return false; } #define WKEY 0 diff --git a/contrib/intarray/_int_bool.c b/contrib/intarray/_int_bool.c index dfb113a8ea..d0572afc1e 100644 --- a/contrib/intarray/_int_bool.c +++ b/contrib/intarray/_int_bool.c @@ -136,7 +136,6 @@ gettoken(WORKSTATE *state, int32 *val) } (state->buf)++; } - return END; } /* @@ -301,7 +300,6 @@ execute(ITEM *curitem, void *checkval, bool calcnot, else return execute(curitem - 1, checkval, calcnot, chkcond); } - return false; } /* @@ -404,7 +402,6 @@ contains_required_value(ITEM *curitem) else return false; } - return false; } bool diff --git a/contrib/intarray/_int_gist.c b/contrib/intarray/_int_gist.c index e429c8b58c..60de393bdf 100644 --- a/contrib/intarray/_int_gist.c +++ b/contrib/intarray/_int_gist.c @@ -217,8 +217,6 @@ g_int_compress(PG_FUNCTION_ARGS) } else PG_RETURN_POINTER(entry); - - PG_RETURN_POINTER(entry); } Datum diff --git a/contrib/ltree/ltxtquery_io.c b/contrib/ltree/ltxtquery_io.c index c2e532c3b8..583ff2aaeb 100644 --- a/contrib/ltree/ltxtquery_io.c +++ b/contrib/ltree/ltxtquery_io.c @@ -139,7 +139,6 @@ gettoken_query(QPRS_STATE *state, int32 *val, int32 *lenval, char **strval, uint state->buf += charlen; } - return END; } /* diff --git a/contrib/ltree/ltxtquery_op.c b/contrib/ltree/ltxtquery_op.c index bedbe247eb..64f9d219f7 100644 --- a/contrib/ltree/ltxtquery_op.c +++ b/contrib/ltree/ltxtquery_op.c @@ -40,7 +40,6 @@ ltree_execute(ITEM *curitem, void *checkval, bool calcnot, bool (*chkcond) (void else return ltree_execute(curitem + 1, checkval, calcnot, chkcond); } - return false; } typedef struct diff --git a/src/backend/access/gin/ginbtree.c b/src/backend/access/gin/ginbtree.c index 82ac53e148..3efdedd180 100644 --- a/src/backend/access/gin/ginbtree.c +++ b/src/backend/access/gin/ginbtree.c @@ -146,9 +146,6 @@ ginFindLeafPage(GinBtree btree, GinBtreeStack *stack) stack->predictNumber = 1; } } - - /* keep compiler happy */ - return NULL; } void diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c index 022bd27b23..57022594bf 100644 --- a/src/backend/access/gin/ginget.c +++ b/src/backend/access/gin/ginget.c @@ -354,8 +354,6 @@ collectMatchBitmap(GinBtreeData *btree, GinBtreeStack *stack, */ stack->off++; } - - return true; } /* diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index c790ad6ffb..2253e7c0eb 100644 --- a/src/backend/access/gist/gistget.c +++ b/src/backend/access/gist/gistget.c @@ -535,8 +535,6 @@ gistgettuple(PG_FUNCTION_ARGS) } while (so->nPageData == 0); } } - - PG_RETURN_BOOL(false); /* keep compiler quiet */ } /* diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c index 80e282bbf4..a8a1fe6aae 100644 --- a/src/backend/executor/nodeGroup.c +++ b/src/backend/executor/nodeGroup.c @@ -184,9 +184,6 @@ ExecGroup(GroupState *node) else InstrCountFiltered1(node, 1); } - - /* NOTREACHED */ - return NULL; } /* ----------------- diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c index e0ab5997fb..0d66dab42d 100644 --- a/src/backend/libpq/be-secure.c +++ b/src/backend/libpq/be-secure.c @@ -201,9 +201,9 @@ secure_loaded_verify_locations(void) { #ifdef USE_SSL return ssl_loaded_verify_locations; -#endif - +#else return false; +#endif } /* diff --git a/src/backend/storage/buffer/freelist.c b/src/backend/storage/buffer/freelist.c index c92774798c..d96b7a7b05 100644 --- a/src/backend/storage/buffer/freelist.c +++ b/src/backend/storage/buffer/freelist.c @@ -233,9 +233,6 @@ StrategyGetBuffer(BufferAccessStrategy strategy, bool *lock_held) } UnlockBufHdr(buf); } - - /* not reached */ - return NULL; } /* diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 9a5438f18a..f696375cab 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -4198,11 +4198,6 @@ PostgresMain(int argc, char *argv[], const char *username) firstchar))); } } /* end of input-reading loop */ - - /* can't get here because the above loop never exits */ - Assert(false); - - abort(); /* keep compiler quiet */ } diff --git a/src/backend/tsearch/dict_thesaurus.c b/src/backend/tsearch/dict_thesaurus.c index 7e641ef64f..1f52372a48 100644 --- a/src/backend/tsearch/dict_thesaurus.c +++ b/src/backend/tsearch/dict_thesaurus.c @@ -744,8 +744,6 @@ findVariant(LexemeInfo *in, LexemeInfo *stored, uint16 curpos, LexemeInfo **newi for (i = 0; i < newn; i++) newin[i] = newin[i]->nextentry; } - - return NULL; } static TSLexeme * diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index b46cb87615..4347ad317f 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -1439,7 +1439,6 @@ get_th(char *num, int type) return numTH[3]; return numth[3]; } - return NULL; } /* ---------- diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c index 010167a8a9..b7c46abd05 100644 --- a/src/backend/utils/adt/tsquery.c +++ b/src/backend/utils/adt/tsquery.c @@ -216,7 +216,6 @@ gettoken_query(TSQueryParserState state, } state->buf += pg_mblen(state->buf); } - return PT_END; } /* diff --git a/src/backend/utils/adt/tsvector_parser.c b/src/backend/utils/adt/tsvector_parser.c index 5214fce7a6..058b30fe25 100644 --- a/src/backend/utils/adt/tsvector_parser.c +++ b/src/backend/utils/adt/tsvector_parser.c @@ -362,6 +362,4 @@ gettoken_tsvector(TSVectorParseState state, /* get next char */ state->prsbuf += pg_mblen(state->prsbuf); } - - return false; } diff --git a/src/bin/pg_basebackup/pg_receivexlog.c b/src/bin/pg_basebackup/pg_receivexlog.c index dbc6ecf431..c4e1d2a682 100644 --- a/src/bin/pg_basebackup/pg_receivexlog.c +++ b/src/bin/pg_basebackup/pg_receivexlog.c @@ -435,7 +435,4 @@ main(int argc, char **argv) pg_usleep(RECONNECT_SLEEP_TIME * 1000000); } } - - /* Never get here */ - exit(2); } diff --git a/src/bin/psql/variables.c b/src/bin/psql/variables.c index 4baa3e253a..6875f63dc1 100644 --- a/src/bin/psql/variables.c +++ b/src/bin/psql/variables.c @@ -115,8 +115,6 @@ ParseVariableBool(const char *value) psql_error("unrecognized Boolean value; assuming \"on\"\n"); return true; } - /* suppress compiler warning */ - return true; } diff --git a/src/interfaces/ecpg/ecpglib/typename.c b/src/interfaces/ecpg/ecpglib/typename.c index d4bfd0d35d..98b81894f3 100644 --- a/src/interfaces/ecpg/ecpglib/typename.c +++ b/src/interfaces/ecpg/ecpglib/typename.c @@ -65,7 +65,6 @@ ecpg_type_name(enum ECPGttype typ) default: abort(); } - return NULL; } int diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index 8ca791ce3f..11a56c9a8f 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -1663,8 +1663,6 @@ exec_stmt_loop(PLpgSQL_execstate *estate, PLpgSQL_stmt_loop *stmt) elog(ERROR, "unrecognized rc: %d", rc); } } - - return PLPGSQL_RC_OK; }