From: Tom Lane Date: Sat, 11 Nov 2006 01:14:19 +0000 (+0000) Subject: Suppress a few 'uninitialized variable' warnings that gcc emits only at X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=c92c06b2c3f98fc65ec85d738c2dbf50d08e7f2c;p=users%2Fbernd%2Fpostgres.git Suppress a few 'uninitialized variable' warnings that gcc emits only at -O3 or higher (presumably because it inlines more things). Per gripe from Mark Mielke. --- diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index 3dd50dd7aa..7b39dcc91d 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -1082,6 +1082,9 @@ _bt_findsplitloc(Relation rel, BTREE_DEFAULT_FILLFACTOR); else state.fillfactor = BTREE_NONLEAF_FILLFACTOR; + state.newitemonleft = false; /* these just to keep compiler quiet */ + state.firstright = 0; + state.best_delta = 0; /* Total free space available on a btree page, after fixed overhead */ leftspace = rightspace = diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index 434aee0955..0bc92a2fda 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -626,7 +626,10 @@ cost_bitmap_tree_node(Path *path, Cost *cost, Selectivity *selec) *selec = ((BitmapOrPath *) path)->bitmapselectivity; } else + { elog(ERROR, "unrecognized node type: %d", nodeTag(path)); + *cost = *selec = 0; /* keep compiler quiet */ + } } /* diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index f467afc8df..52922c9034 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -1257,7 +1257,10 @@ tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result) /* Julian day routines are not correct for negative Julian days */ if (!IS_VALID_JULIAN(tm->tm_year, tm->tm_mon, tm->tm_mday)) + { + *result = 0; /* keep compiler quiet */ return -1; + } date = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - POSTGRES_EPOCH_JDATE; time = time2t(tm->tm_hour, tm->tm_min, tm->tm_sec, fsec); @@ -1266,11 +1269,17 @@ tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result) *result = date * USECS_PER_DAY + time; /* check for major overflow */ if ((*result - time) / USECS_PER_DAY != date) + { + *result = 0; /* keep compiler quiet */ return -1; + } /* check for just-barely overflow (okay except time-of-day wraps) */ if ((*result < 0 && date >= 0) || (*result >= 0 && date < 0)) + { + *result = 0; /* keep compiler quiet */ return -1; + } #else *result = date * SECS_PER_DAY + time; #endif