Skip to content

Commit 9fb9691

Browse files
committed
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.
1 parent 96ae658 commit 9fb9691

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

src/backend/access/common/detoast.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ toast_decompress_datum(struct varlena *attr)
487487
return lz4_decompress_datum(attr);
488488
default:
489489
elog(ERROR, "invalid compression method id %d", cmid);
490+
return NULL; /* keep compiler quiet */
490491
}
491492
}
492493

@@ -518,6 +519,7 @@ toast_decompress_datum_slice(struct varlena *attr, int32 slicelength)
518519
return lz4_decompress_datum_slice(attr, slicelength);
519520
default:
520521
elog(ERROR, "invalid compression method id %d", cmid);
522+
return NULL; /* keep compiler quiet */
521523
}
522524
}
523525

src/backend/access/common/toast_compression.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ lz4_compress_datum(const struct varlena *value)
135135
{
136136
#ifndef USE_LZ4
137137
NO_LZ4_SUPPORT();
138+
return NULL; /* keep compiler quiet */
138139
#else
139140
int32 valsize;
140141
int32 len;
@@ -177,6 +178,7 @@ lz4_decompress_datum(const struct varlena *value)
177178
{
178179
#ifndef USE_LZ4
179180
NO_LZ4_SUPPORT();
181+
return NULL; /* keep compiler quiet */
180182
#else
181183
int32 rawsize;
182184
struct varlena *result;
@@ -209,6 +211,7 @@ lz4_decompress_datum_slice(const struct varlena *value, int32 slicelength)
209211
{
210212
#ifndef USE_LZ4
211213
NO_LZ4_SUPPORT();
214+
return NULL; /* keep compiler quiet */
212215
#else
213216
int32 rawsize;
214217
struct varlena *result;

src/include/access/toast_compression.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ GetCompressionMethodName(char method)
6969
return "lz4";
7070
default:
7171
elog(ERROR, "invalid compression method %c", method);
72+
return NULL; /* keep compiler quiet */
7273
}
7374
}
7475

src/test/modules/libpq_pipeline/libpq_pipeline.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ exit_nicely(PGconn *conn)
6060
*/
6161
#define pg_fatal(...) pg_fatal_impl(__LINE__, __VA_ARGS__)
6262
static void
63+
pg_attribute_noreturn()
6364
pg_fatal_impl(int line, const char *fmt,...)
6465
{
6566
va_list args;
@@ -570,6 +571,7 @@ test_pipelined_insert(PGconn *conn, int n_rows)
570571

571572
default:
572573
pg_fatal("invalid state");
574+
sql = NULL; /* keep compiler quiet */
573575
}
574576

575577
pg_debug("sending: %s\n", sql);
@@ -679,8 +681,8 @@ test_pipelined_insert(PGconn *conn, int n_rows)
679681
break;
680682
case BI_DONE:
681683
/* unreachable */
682-
description = "";
683-
abort();
684+
pg_fatal("unreachable state");
685+
cmdtag = NULL; /* keep compiler quiet */
684686
}
685687

686688
if (PQresultStatus(res) != status)

0 commit comments

Comments
 (0)