[comp.lang.c] A lint solution for == and =.

rbutterworth@watmath.waterloo.edu (Ray Butterworth) (01/22/88)

For those that care, here's a modified section of the 4.3 BSD
first pass of lint:


contx(p, down, pl, pr)
    register NODE *p;
    register *pl, *pr;
{

    *pl = *pr = VAL;
    if (p->in.type==UNDEF) /* (void) cast */
        down=VAL;

    switch( p->in.op ){

        case NOT:
            *pl = down;
            /*FALLTHROUGH*/
        case ANDAND:
        case OROR:
            if (hflag && (p->in.right->in.op==ASSIGN))
                werror("Possible unintended assignment");
            ;/*FALLTHROUGH*/
        case QUEST:
            *pr = down;
            /*FALLTHROUGH*/
        case CBRANCH:
            if (hflag && (p->in.left->in.op==ASSIGN))
                werror("possible unintended assignment");
            break;

        case SCONV:
        case PCONV:

            ...