Skip to content

mod_curltest: fix compiler warnings#22214

Closed
vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:modtest
Closed

mod_curltest: fix compiler warnings#22214
vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:modtest

Conversation

@vszakats

@vszakats vszakats commented Jun 29, 2026

Copy link
Copy Markdown
Member
mod_curltest.c:331:25: warning: result of comparison of unsigned expression >= 0 is always true [-Wtautological-unsigned-zero-compare]
  331 |           if(chunk_size >= 0) {
      |              ~~~~~~~~~~ ^  ~
mod_curltest.c:421:9: warning: declaration shadows a local variable [-Wshadow]
  421 |     int i, hd_len = (16 * 1024);
      |         ^
mod_curltest.c:288:7: note: previous declaration is here
  288 |   int i, chunks = 3, error_bucket = 1;
      |       ^
mod_curltest.c:501:40: warning: format specifies type 'int' but the argument has type 'unsigned int' [-Wformat]
  500 |                 "error_handler: request cleanup, r->status=%d, aborted=%d, "
      |                                                                        ~~
      |                                                                        %u
  501 |                 "close=%d", r->status, c->aborted, close_conn);
      |                                        ^~~~~~~~~~
mod_curltest.c:837:1: warning: missing field 'lock' initializer [-Wmissing-field-initializers]
  837 | };
      | ^
mod_curltest.c:914:43: warning: format specifies type 'int' but the argument has type 'apr_time_t' (aka 'long') [-Wformat]
  914 |     char *v = apr_psprintf(r->pool, "%d", limitrec.duration_sec);
      |                                      ~~   ^~~~~~~~~~~~~~~~~~~~~
      |                                      %ld
mod_curltest.c:956:16: warning: unused variable 'rv' [-Wunused-variable]
  956 |   apr_status_t rv;
      |                ^~

https://github.com/curl/curl/pull/22214/files?w=1

clang -c mod_curltest.c \
  -isystem /opt/homebrew/opt/apr-util/include/apr-1 \
  -isystem /opt/homebrew/opt/apr/include/apr-1 \
  -isystem /opt/homebrew/opt/httpd/include/httpd \
  \
  -Weverything \
  \
  -pedantic-errors -Werror=partial-availability \
  -Werror-implicit-function-declaration -Wextra -Wall -Wpedantic \
  -Wbad-function-cast -Wconversion -Wmissing-declarations \
  -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-multichar \
  -Wpointer-arith -Wshadow -Wsign-compare -Wundef -Wunused \
  -Wwrite-strings -Waddress -Wattributes -Wcast-align -Wcast-qual \
  -Wdeclaration-after-statement -Wdiv-by-zero -Wempty-body \
  -Wendif-labels -Wfloat-equal -Wformat-security -Wignored-qualifiers \
  -Wmissing-field-initializers -Wmissing-noreturn -Wno-padded \
  -Wno-sign-conversion -Wno-switch-default -Wno-switch-enum \
  -Wno-system-headers -Wold-style-definition -Wredundant-decls \
  -Wstrict-prototypes -Wtype-limits -Wunreachable-code \
  -Wunused-parameter -Wvla -Wconditional-uninitialized \
  -Wno-used-but-marked-unused -Wshift-sign-overflow -Wshorten-64-to-32 \
  -Wformat=2 -Wlanguage-extension-token -Wno-covered-switch-default \
  -Wno-disabled-macro-expansion -Wformat-non-iso -Wenum-conversion \
  -Wmissing-variable-declarations -Wno-documentation-unknown-command \
  -Wsometimes-uninitialized -Wdouble-promotion -Wheader-guard -Wpragmas \
  -Wunused-const-variable -Wcomma -Wassign-enum -Wextra-semi-stmt \
  -Wimplicit-fallthrough -Wxor-used-as-pow -Wcast-function-type \
  -Wreserved-identifier -Wno-reserved-macro-identifier \
  -Wformat-signedness \
  -Wno-unsafe-buffer-usage -Wcast-function-type-strict \
  \
  -Wno-cast-align -Wno-cast-qual -Wno-poison-system-directories

```
mod_curltest.c:331:25: warning: result of comparison of unsigned expression >= 0 is always true [-Wtautological-unsigned-zero-compare]
  331 |           if(chunk_size >= 0) {
      |              ~~~~~~~~~~ ^  ~
mod_curltest.c:421:9: warning: declaration shadows a local variable [-Wshadow]
  421 |     int i, hd_len = (16 * 1024);
      |         ^
mod_curltest.c:288:7: note: previous declaration is here
  288 |   int i, chunks = 3, error_bucket = 1;
      |       ^
mod_curltest.c:501:40: warning: format specifies type 'int' but the argument has type 'unsigned int' [-Wformat]
  500 |                 "error_handler: request cleanup, r->status=%d, aborted=%d, "
      |                                                                        ~~
      |                                                                        %u
  501 |                 "close=%d", r->status, c->aborted, close_conn);
      |                                        ^~~~~~~~~~
mod_curltest.c:837:1: warning: missing field 'lock' initializer [-Wmissing-field-initializers]
  837 | };
      | ^
mod_curltest.c:914:43: warning: format specifies type 'int' but the argument has type 'apr_time_t' (aka 'long') [-Wformat]
  914 |     char *v = apr_psprintf(r->pool, "%d", limitrec.duration_sec);
      |                                      ~~   ^~~~~~~~~~~~~~~~~~~~~
      |                                      %ld
mod_curltest.c:956:16: warning: unused variable 'rv' [-Wunused-variable]
  956 |   apr_status_t rv;
      |                ^~
```
@vszakats vszakats changed the title mod_curltest: fix 6 compiler warnings mod_curltest: fix compiler warnings Jun 29, 2026
@vszakats vszakats marked this pull request as draft June 29, 2026 09:29
@vszakats vszakats marked this pull request as ready for review June 29, 2026 10:49
@bagder bagder requested a review from icing June 29, 2026 12:16
@vszakats vszakats closed this in c9d8a6b Jun 29, 2026
@vszakats vszakats deleted the modtest branch June 29, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants