Silence minor compiler warnings.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 13 Feb 2022 18:06:55 +0000 (13:06 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 13 Feb 2022 18:06:55 +0000 (13:06 -0500)
Depending on compiler version and optimization level, we might
get a complaint that lazy_scan_heap's "freespace" is used
uninitialized.

Compilers not aware that ereport(ERROR) doesn't return complained
about bbsink_lz4_new().

Assigning "-1" to a uint64 value has unportable results; fortunately,
the value of xlogreadsegno is unimportant when xlogreadfd is -1.
(It looks to me like there is no need for xlogreadsegno to be static
in the first place, but I didn't venture to change that.)

src/backend/access/heap/vacuumlazy.c
src/backend/replication/basebackup_lz4.c
src/bin/pg_rewind/parsexlog.c

index d57055674edbae997941b9ec9e18676d2619151c..9c88b9bd71aedb06c4615329940d0bfea6a28edc 100644 (file)
@@ -1112,7 +1112,7 @@ lazy_scan_heap(LVRelState *vacrel, int nworkers)
            if (lazy_scan_noprune(vacrel, buf, blkno, page, &hastup,
                                  &recordfreespace))
            {
-               Size        freespace;
+               Size        freespace = 0;
 
                /*
                 * Processed page successfully (without cleanup lock) -- just
index 8730ee89dc7cab7b537a7ad071ed043a6f5956e2..d26032783cfefb0a5a15a856d787a45bfd09df42 100644 (file)
@@ -66,6 +66,7 @@ bbsink_lz4_new(bbsink *next, int compresslevel)
    ereport(ERROR,
            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
             errmsg("lz4 compression is not supported by this build")));
+   return NULL;                /* keep compiler quiet */
 #else
    bbsink_lz4 *sink;
 
index f6cfee4ce8c98cc59fe1e42ba5521a85282ec520..56df08c64f49e5313d51c154a9518bcf6874cb45 100644 (file)
@@ -38,7 +38,7 @@ static const char *RmgrNames[RM_MAX_ID + 1] = {
 static void extractPageInfo(XLogReaderState *record);
 
 static int xlogreadfd = -1;
-static XLogSegNo xlogreadsegno = -1;
+static XLogSegNo xlogreadsegno = 0;
 static char xlogfpath[MAXPGPATH];
 
 typedef struct XLogPageReadPrivate