You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2026/07/02 16:11:22 UTC

mod_jk cleanups

All,

I just grabbed mod_jk main branch and configured/compiled on my MacOS 
clang toolchain. It built with no errors but a few warnings:

jk_lb_worker.c:1404:36: warning: address of array 
'p->worker->session_cookie_path' will always evaluate to
       'true' [-Wpointer-bool-conversion]
  1404 |                     if (p->worker->session_cookie_path && 
*p->worker->session_cookie_path) {
       |                         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ ~~
1 warning generated.

===

jk_ajp_common.c:2995:20: warning: address of array 'p->source' will 
always evaluate to 'true'
       [-Wpointer-bool-conversion]
  2995 |             if (p->source && *p->source) {
       |                 ~~~^~~~~~ ~~
1 warning generated.

===

jk_status.c:1879:23: warning: address of array 'aw->source' will always 
evaluate to 'true'
       [-Wpointer-bool-conversion]
  1879 |                   aw->source && *aw->source ? aw->source : 
"undefined",
       |                   ~~~~^~~~~~ ~~
jk_status.c:1893:23: warning: address of array 'aw->source' will always 
evaluate to 'true'
       [-Wpointer-bool-conversion]
  1893 |                   aw->source && *aw->source ? aw->source : 
"undefined",
       |                   ~~~~^~~~~~ ~~
jk_status.c:1997:27: warning: address of array 'wr->redirect' will 
always evaluate to 'true'
       [-Wpointer-bool-conversion]
  1997 |                       wr->redirect ? (*wr->redirect ? 
wr->redirect : "&nbsp;") : "&nbsp",
       |                       ~~~~^~~~~~~~ ~
jk_status.c:1998:27: warning: address of array 'wr->domain' will always 
evaluate to 'true'
       [-Wpointer-bool-conversion]
  1998 |                       wr->domain ? (*wr->domain ? wr->domain : 
"&nbsp;") : "&nbsp",
       |                       ~~~~^~~~~~ ~
jk_status.c:2042:60: warning: address of array 'aw->source' will always 
evaluate to 'true'
       [-Wpointer-bool-conversion]
  2042 |         jk_print_xml_att_string(s, l, off+2, "source", 
aw->source && *aw->source ? aw->source : "undefined");
       | 
~~~~^~~~~~ ~~
jk_status.c:2112:43: warning: address of array 'aw->source' will always 
evaluate to 'true'
       [-Wpointer-bool-conversion]
  2112 |         jk_printf(s, l, " source=%s", aw->source && *aw->source 
? aw->source : "undefined");
       |                                       ~~~~^~~~~~ ~~
jk_status.c:2126:50: warning: address of array 'wr->route' will always 
evaluate to 'true'
       [-Wpointer-bool-conversion]
  2126 |             jk_printf(s, l, " route=\"%s\"", wr->route ? 
wr->route : "");
       |                                              ~~~~^~~~~ ~
jk_status.c:2127:53: warning: address of array 'wr->redirect' will 
always evaluate to 'true'
       [-Wpointer-bool-conversion]
  2127 |             jk_printf(s, l, " redirect=\"%s\"", wr->redirect ? 
wr->redirect : "");
       |                                                 ~~~~^~~~~~~~ ~
jk_status.c:2128:51: warning: address of array 'wr->domain' will always 
evaluate to 'true'
       [-Wpointer-bool-conversion]
  2128 |             jk_printf(s, l, " domain=\"%s\"", wr->domain ? 
wr->domain : "");
       |                                               ~~~~^~~~~~ ~
jk_status.c:2179:67: warning: address of array 'aw->source' will always 
evaluate to 'true'
       [-Wpointer-bool-conversion]
  2179 |         jk_print_prop_att_string(s, l, w, ajp_name, "source", 
aw->source && *aw->source ? aw->source : "undefined");
       | 
~~~~^~~~~~ ~~
10 warnings generated.

I think clang is noticing provable non-NULL cases, suggesting that the 
predicates are not required. I get these kinds of warnings all the time 
in my own code for null-checks that are technically superfluous but in 
there just in case the code changes somewhat unexpectedly within a 
function and suddenly the pointer CAN be null.

I'm posting this just in case anyone notices that we have a true logic 
error in programmer expectations and that these warnings represent 
actual bugs.

-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org