1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-05 09:19:17 +03:00

Suppress various new compiler warnings.

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.
This commit is contained in:
Tom Lane 2021-03-21 11:50:43 -04:00
parent 96ae658e62
commit 9fb9691a88
4 changed files with 10 additions and 2 deletions

View File

@ -487,6 +487,7 @@ toast_decompress_datum(struct varlena *attr)
return lz4_decompress_datum(attr); return lz4_decompress_datum(attr);
default: default:
elog(ERROR, "invalid compression method id %d", cmid); 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); return lz4_decompress_datum_slice(attr, slicelength);
default: default:
elog(ERROR, "invalid compression method id %d", cmid); elog(ERROR, "invalid compression method id %d", cmid);
return NULL; /* keep compiler quiet */
} }
} }

View File

@ -135,6 +135,7 @@ lz4_compress_datum(const struct varlena *value)
{ {
#ifndef USE_LZ4 #ifndef USE_LZ4
NO_LZ4_SUPPORT(); NO_LZ4_SUPPORT();
return NULL; /* keep compiler quiet */
#else #else
int32 valsize; int32 valsize;
int32 len; int32 len;
@ -177,6 +178,7 @@ lz4_decompress_datum(const struct varlena *value)
{ {
#ifndef USE_LZ4 #ifndef USE_LZ4
NO_LZ4_SUPPORT(); NO_LZ4_SUPPORT();
return NULL; /* keep compiler quiet */
#else #else
int32 rawsize; int32 rawsize;
struct varlena *result; struct varlena *result;
@ -209,6 +211,7 @@ lz4_decompress_datum_slice(const struct varlena *value, int32 slicelength)
{ {
#ifndef USE_LZ4 #ifndef USE_LZ4
NO_LZ4_SUPPORT(); NO_LZ4_SUPPORT();
return NULL; /* keep compiler quiet */
#else #else
int32 rawsize; int32 rawsize;
struct varlena *result; struct varlena *result;

View File

@ -69,6 +69,7 @@ GetCompressionMethodName(char method)
return "lz4"; return "lz4";
default: default:
elog(ERROR, "invalid compression method %c", method); elog(ERROR, "invalid compression method %c", method);
return NULL; /* keep compiler quiet */
} }
} }

View File

@ -60,6 +60,7 @@ exit_nicely(PGconn *conn)
*/ */
#define pg_fatal(...) pg_fatal_impl(__LINE__, __VA_ARGS__) #define pg_fatal(...) pg_fatal_impl(__LINE__, __VA_ARGS__)
static void static void
pg_attribute_noreturn()
pg_fatal_impl(int line, const char *fmt,...) pg_fatal_impl(int line, const char *fmt,...)
{ {
va_list args; va_list args;
@ -570,6 +571,7 @@ test_pipelined_insert(PGconn *conn, int n_rows)
default: default:
pg_fatal("invalid state"); pg_fatal("invalid state");
sql = NULL; /* keep compiler quiet */
} }
pg_debug("sending: %s\n", sql); pg_debug("sending: %s\n", sql);
@ -679,8 +681,8 @@ test_pipelined_insert(PGconn *conn, int n_rows)
break; break;
case BI_DONE: case BI_DONE:
/* unreachable */ /* unreachable */
description = ""; pg_fatal("unreachable state");
abort(); cmdtag = NULL; /* keep compiler quiet */
} }
if (PQresultStatus(res) != status) if (PQresultStatus(res) != status)