You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Mirko Nasato <mi...@kubera.it> on 2001/05/03 12:03:51 UTC

mod_jk portability

Hi.

I compiled mod_jk (Tomcat 3.2.1) on a OSF1 alpha 5.1 (Compaq Tru64) using
the Compaq cc, but got this warning that scares me a lot

cc: Warning: ../jk/jk_msg_buff.c, line 88: In this statement, the expression
"printf(...)" modifies the variable "i" more than once without an
intervening sequence point.  This behavior is undefined. (undefvarmod)
        printf("%s %d/%d/%d %x %x %x %x - %x %x %x %x - %x %x %x %x - %x %x
%x %x\n", err, msg->pos, msg->len, msg->maxlen,

so i tried to compile this little c program

#include <stdio.h>
int main()
{
    unsigned int i = 0;
    printf("%x %x %x\n", i++, i++, i++);
    return 0;
}

on a few platforms. Here are the results

Compaq cc on osf1 tru64 5.1 alpha: 0 0 0 (with the above mentioned compiler
warning)
GCC on the above: 0 1 2
GCC on Linux i386: 2 1 0
SGI cc on Irix 6.2 (good old beast): 0 0 0
Microsoft Visual C++ 6.0 on win2k: 0 0 0

This is the suspect code from jk_msg_buff.c

/*
 * Simple marshaling code.
 */

/* XXX what's above this line can go to .h XXX */
void jk_b_dump(jk_msg_buf_t *msg, char *err)
{
    int i=0;
        printf("%s %d/%d/%d %x %x %x %x - %x %x %x %x - %x %x %x %x - %x %x
%x %x\n", err, msg->pos, msg->len, msg->maxlen,
               msg->buf[i++],msg->buf[i++],msg->buf[i++],msg->buf[i++],
               msg->buf[i++],msg->buf[i++],msg->buf[i++],msg->buf[i++],
               msg->buf[i++],msg->buf[i++],msg->buf[i++],msg->buf[i++],
               msg->buf[i++],msg->buf[i++],msg->buf[i++],msg->buf[i++]);

        i = msg->pos - 4;
    if(i < 0) {
        i=0;
    }

    printf("        %x %x %x %x - %x %x %x %x --- %x %x %x %x - %x %x %x
%x\n",
               msg->buf[i++],msg->buf[i++],msg->buf[i++],msg->buf[i++],
               msg->buf[i++],msg->buf[i++],msg->buf[i++],msg->buf[i++],
               msg->buf[i++],msg->buf[i++],msg->buf[i++],msg->buf[i++],
               msg->buf[i++],msg->buf[i++],msg->buf[i++],msg->buf[i++]);

}

What's the purpose of this function? Can I get along with this odd
behaviour? TIA.

Regards,

\mirko