aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-03-20 09:14:51 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-03-20 09:14:51 +0200
commitd63d486d6c393817810d0477569fc657c388bfb2 (patch)
treede2b5d708f136f52426798c9a1997781f69e51d6 /src
parent9578393bc513e350e9cbfa4679fc7be7309b41a4 (diff)
downloadpostgresql-d63d486d6c393817810d0477569fc657c388bfb2.tar.gz
postgresql-d63d486d6c393817810d0477569fc657c388bfb2.zip
Remove assertions that some compiler say are tautological
To avoid the compiler warnings: launch_backend.c:211:39: warning: comparison of constant 16 with expression of type 'BackendType' (aka 'enum BackendType') is always true [-Wtautological-constant-out-of-range-compare] launch_backend.c:233:39: warning: comparison of constant 16 with expression of type 'BackendType' (aka 'enum BackendType') is always true [-Wtautological-constant-out-of-range-compare] The point of the assertions was to fail more explicitly if someone adds a new BackendType to the end of the enum, but forgets to add it to the child_process_kinds array. It was a pretty weak assertion to begin with, because it wouldn't catch if you added a new BackendType in the middle of the enum. So let's just remove it. Per buildfarm member ayu and a few others, spotted by Tom Lane. Discussion: https://www.postgresql.org/message-id/4119680.1710913067@sss.pgh.pa.us
Diffstat (limited to 'src')
-rw-r--r--src/backend/postmaster/launch_backend.c2
-rw-r--r--src/include/miscadmin.h3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/postmaster/launch_backend.c b/src/backend/postmaster/launch_backend.c
index 3b5f73524c0..cb0c3e2f8ab 100644
--- a/src/backend/postmaster/launch_backend.c
+++ b/src/backend/postmaster/launch_backend.c
@@ -208,7 +208,6 @@ child_process_kind child_process_kinds[] = {
const char *
PostmasterChildName(BackendType child_type)
{
- Assert(child_type >= 0 && child_type < lengthof(child_process_kinds));
return child_process_kinds[child_type].name;
}
@@ -230,7 +229,6 @@ postmaster_child_launch(BackendType child_type,
{
pid_t pid;
- Assert(child_type >= 0 && child_type < lengthof(child_process_kinds));
Assert(IsPostmasterEnvironment && !IsUnderPostmaster);
#ifdef EXEC_BACKEND
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index f900da61573..90f9b21b258 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -326,6 +326,9 @@ extern void SwitchBackToLocalLatch(void);
/*
* MyBackendType indicates what kind of a backend this is.
+ *
+ * If you add entries, please also update the child_process_kinds array in
+ * launch_backend.c.
*/
typedef enum BackendType
{