Ok, I've been paging through the hundreds of errors spewn out by gcc
with the new -Wkitchen_sink warnings.  Some are pretty clear, but
many others raise questions I'm unsure how to answer.

For example, given the following structure in "parrot/rx.h"
(note that startindex is unsigned):

    typedef struct rxinfo {
            STRING *string;
            UINTVAL index;
            UINTVAL startindex;
            BOOLVAL success;

            rxflags flags;
            UINTVAL minlength;
            rxdirection whichway;

            PMC *groupstart;
            PMC *groupend;

            opcode_t *substfunc;

            struct Stack_chunk_t* stack;
    } rxinfo;

gcc-2.8 rightfully complains that in the following bit of code from
rx.ops, rx->startindex can never be < 0.

    op rx_advance(in pmc, in int) {
            RX_dUNPACK($1);

            if(!RxReverse_test(rx)) {
                    if(++rx->startindex + rx->minlength > string_length(rx->string)) {
                            goto OFFSET($2);
                    }
            }
            else {
                    if(--rx->startindex < 0) {
                            goto OFFSET($2);
                    }
            }


Does anyone know if the correct fix to make startindex signed, eliminate the
unreachable branch, put an assert() in somewhere, ignore the message,
or do something else clever?

-- 
    Andy Dougherty              [EMAIL PROTECTED]
    Dept. of Physics
    Lafayette College, Easton PA 18042

Reply via email to