libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit 76e80fd9b5bd1d5fdc00bf2ddfa34a2cf39ef0b3
parent a24f3edd5b1186005a06aed2a0024c1ca1bb8cf7
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Sun,  4 May 2025 11:29:51 +0200

Muted useless analyser warnings

Analyser warns about "assigned, but never used", while assignment is
used only to mute compiler warning

Diffstat:
Msrc/mhd2/conn_data_send.c | 3++-
Msrc/mhd2/daemon_add_conn.c | 3++-
Msrc/mhd2/daemon_start.c | 2++
Msrc/mhd2/mhd_send.c | 4++--
Msrc/mhd2/stream_process_request.c | 1+
Msrc/tests/upgrade/test_upgrade.c | 3+++
6 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/mhd2/conn_data_send.c b/src/mhd2/conn_data_send.c @@ -86,7 +86,8 @@ mhd_conn_data_send (struct MHD_Connection *restrict c) // TODO: MOVE out STATES PROCESSING - res = mhd_SOCKET_ERR_INTERNAL; + res = mhd_SOCKET_ERR_INTERNAL; /* Mute compiler warning */ + mhd_assert (mhd_SOCKET_ERR_INTERNAL == res); /* Mute analyser warning */ switch (c->stage) { diff --git a/src/mhd2/daemon_add_conn.c b/src/mhd2/daemon_add_conn.c @@ -336,7 +336,8 @@ new_connection_process_inner (struct MHD_Daemon *restrict daemon, enum MHD_StatusCode res; mhd_assert (connection->daemon == daemon); - res = MHD_SC_OK; + res = MHD_SC_OK; /* Mute compiler warning */ + mhd_assert (MHD_SC_OK == res); /* Mute analyser warning */ /* Allocate memory pool in the processing thread so * intensively used memory area is allocated in "good" * (for the thread) memory region. It is important with diff --git a/src/mhd2/daemon_start.c b/src/mhd2/daemon_start.c @@ -352,6 +352,7 @@ create_bind_listen_stream_socket (struct MHD_Daemon *restrict d, mhd_assert (! v6_tried); mhd_assert (! force_v6_any_dual); #endif + mhd_assert (mhd_SKT_NO_SOCKET == sk_type); /* Mute analyser warning */ if (MHD_INVALID_SOCKET != s->listen_socket) { @@ -2509,6 +2510,7 @@ set_connections_total_limits (struct MHD_Daemon *restrict d, limit_by_conf = s->global_connection_limit; limit_by_num = UINT_MAX; limit_by_select = UINT_MAX; + mhd_assert (UINT_MAX == limit_by_num); /* Mute analyser warning */ error_by_fd_setsize = false; #ifdef MHD_SOCKETS_KIND_POSIX diff --git a/src/mhd2/mhd_send.c b/src/mhd2/mhd_send.c @@ -1176,7 +1176,7 @@ mhd_send_sendfile (struct MHD_Connection *restrict c, mhd_SENFILE_CHUNK_SIZE_FOR_THR_P_C : mhd_SENFILE_CHUNK_SIZE; const int file_fd = c->rp.response->cntn.file.fd; mhd_off_t offset; - size_t send_size; + size_t send_size = 0; /* Initialised to mute compiler warning */ size_t sent_bytes; bool push_data; bool fallback_to_filereader; @@ -1185,7 +1185,7 @@ mhd_send_sendfile (struct MHD_Connection *restrict c, mhd_assert (chunk_size <= (size_t) SSIZE_MAX); mhd_assert (! mhd_C_HAS_TLS (c)); - send_size = 0; + mhd_assert (0 == send_size); /* Mute analyser warning */ push_data = true; if (1) { diff --git a/src/mhd2/stream_process_request.c b/src/mhd2/stream_process_request.c @@ -3435,6 +3435,7 @@ process_request_nonchunked_body (struct MHD_Connection *restrict c) read_buf_reuse = false; state_updated = false; + mhd_assert (! read_buf_reuse); /* Mute analyser warning */ #ifdef MHD_SUPPORT_POST_PARSER if (mhd_ACTION_POST_PARSE == c->rq.app_act.head_act.act) diff --git a/src/tests/upgrade/test_upgrade.c b/src/tests/upgrade/test_upgrade.c @@ -888,6 +888,7 @@ wr_send_tmo (struct wr_socket *s, #endif /* HTTPS_SUPPORT */ testErrorLogDesc ("HTTPS socket send called, but code does not support" \ " HTTPS sockets"); + mhd_SCKT_SET_LERR (mhdt_SCKT_HARD_ERR); /* hard error */ return -1; } @@ -978,6 +979,7 @@ wr_recv_tmo (struct wr_socket *s, return -1; } #endif /* HTTPS_SUPPORT */ + mhd_SCKT_SET_LERR (mhdt_SCKT_HARD_ERR); /* hard error */ return -1; } @@ -1068,6 +1070,7 @@ wr_shutdown_tmo (struct wr_socket *s, int how, int timeout_ms) return -1; } #endif /* HTTPS_SUPPORT */ + mhd_SCKT_SET_LERR (mhdt_SCKT_HARD_ERR); /* hard error */ return -1; }