Suppress various new compiler warnings.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 21 Mar 2021 15:50:43 +0000 (11:50 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 21 Mar 2021 15:50:43 +0000 (11:50 -0400)
Compilers that don't understand that elog(ERROR) doesn't return
issued warnings here.  In the cases in libpq_pipeline.c, we were
not exactly helping things by failing to mark pg_fatal() as noreturn.

Per buildfarm.

src/backend/access/common/detoast.c
src/backend/access/common/toast_compression.c
src/include/access/toast_compression.h
src/test/modules/libpq_pipeline/libpq_pipeline.c

index 2fef40c2e9a902a59ef30be003658d718b1fe958..bed50e8603452a403706f8ac5731a5a282617bd1 100644 (file)
@@ -487,6 +487,7 @@ toast_decompress_datum(struct varlena *attr)
            return lz4_decompress_datum(attr);
        default:
            elog(ERROR, "invalid compression method id %d", cmid);
+           return NULL;        /* keep compiler quiet */
    }
 }
 
@@ -518,6 +519,7 @@ toast_decompress_datum_slice(struct varlena *attr, int32 slicelength)
            return lz4_decompress_datum_slice(attr, slicelength);
        default:
            elog(ERROR, "invalid compression method id %d", cmid);
+           return NULL;        /* keep compiler quiet */
    }
 }
 
index a6f8b79a9ed82835cd9fb57a9a16fb5fa61b22e6..00af1740cfa1e633024f71de70c5cf004807ef0a 100644 (file)
@@ -135,6 +135,7 @@ lz4_compress_datum(const struct varlena *value)
 {
 #ifndef USE_LZ4
    NO_LZ4_SUPPORT();
+   return NULL;                /* keep compiler quiet */
 #else
    int32       valsize;
    int32       len;
@@ -177,6 +178,7 @@ lz4_decompress_datum(const struct varlena *value)
 {
 #ifndef USE_LZ4
    NO_LZ4_SUPPORT();
+   return NULL;                /* keep compiler quiet */
 #else
    int32       rawsize;
    struct varlena *result;
@@ -209,6 +211,7 @@ lz4_decompress_datum_slice(const struct varlena *value, int32 slicelength)
 {
 #ifndef USE_LZ4
    NO_LZ4_SUPPORT();
+   return NULL;                /* keep compiler quiet */
 #else
    int32       rawsize;
    struct varlena *result;
index 514df0bed184792d984babeaea20cb210c083f12..5c9220c171024433d3c550894ec1b453e10b61d5 100644 (file)
@@ -69,6 +69,7 @@ GetCompressionMethodName(char method)
            return "lz4";
        default:
            elog(ERROR, "invalid compression method %c", method);
+           return NULL;        /* keep compiler quiet */
    }
 }
 
index 03eb3df5042e8c89c7af34e3f8f0bf74589bb3a2..846ee9f5ab058dc6d03205c4f7ddab1421f5f690 100644 (file)
@@ -60,6 +60,7 @@ exit_nicely(PGconn *conn)
  */
 #define pg_fatal(...) pg_fatal_impl(__LINE__, __VA_ARGS__)
 static void
+pg_attribute_noreturn()
 pg_fatal_impl(int line, const char *fmt,...)
 {
    va_list     args;
@@ -570,6 +571,7 @@ test_pipelined_insert(PGconn *conn, int n_rows)
 
            default:
                pg_fatal("invalid state");
+               sql = NULL;     /* keep compiler quiet */
        }
 
        pg_debug("sending: %s\n", sql);
@@ -679,8 +681,8 @@ test_pipelined_insert(PGconn *conn, int n_rows)
                        break;
                    case BI_DONE:
                        /* unreachable */
-                       description = "";
-                       abort();
+                       pg_fatal("unreachable state");
+                       cmdtag = NULL;  /* keep compiler quiet */
                }
 
                if (PQresultStatus(res) != status)