Text   |  XML   |  ReML   |   Visible Warnings:

Redundant Condition  at lemon.c:1056

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

resolve_conflict

(/home/sate/Testcases/c/cve/wireshark-1.2.0/tools/lemon/lemon.c)expand/collapse
Show more  
 1031  static int resolve_conflict(
 1032      struct action *apx,
 1033      struct action *apy,
 1034      struct symbol *errsym _U_)
 1035  {
 1036    struct symbol *spx, *spy;
 1037    int errcnt = 0;
 1038    assert( apx->sp==apy->sp );  /* Otherwise there would be no conflict */
 1039    if( apx->type==SHIFT && apy->type==SHIFT ){
 1040      apy->type = SSCONFLICT;
 1041      errcnt++;
 1042    }
 1043    if( apx->type==SHIFT && apy->type==REDUCE ){
 1044      spx = apx->sp;
 1045      spy = apy->x.rp->precsym;
 1046      if( spy==0 || spx->prec<0 || spy->prec<0 ){
 1047        /* Not enough precedence information. */
 1048        apy->type = SRCONFLICT;
 1049        errcnt++;
 1050      }else if( spx->prec>spy->prec ){    /* Lower precedence wins */
 1051        apy->type = RD_RESOLVED;
 1052      }else if( spx->prec<spy->prec ){
 1053        apx->type = SH_RESOLVED;
 1054      }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */
 1055        apy->type = RD_RESOLVED;                             /* associativity */
 1056      }else if( spx->prec==spy->prec && spx->assoc==LEFT ){  /* to break tie */
 1057        apx->type = SH_RESOLVED;
 1058      }else{
 1059        assert( spx->prec==spy->prec && spx->assoc==NONE );
 1060        apy->type = SRCONFLICT;
 1061        errcnt++;
 1062      }
 1063    }else if( apx->type==REDUCE && apy->type==REDUCE ){
 1064      spx = apx->x.rp->precsym;
 1065      spy = apy->x.rp->precsym;
 1066      if( spx==0 || spy==0 || spx->prec<0 ||
 1067      spy->prec<0 || spx->prec==spy->prec ){
 1068        apy->type = RRCONFLICT;
 1069        errcnt++;
 1070      }else if( spx->prec>spy->prec ){
 1071        apy->type = RD_RESOLVED;
 1072      }else if( spx->prec<spy->prec ){
 1073        apx->type = RD_RESOLVED;
 1074      }
 1075    }else{
 1076      assert(
 1077        apx->type==SH_RESOLVED ||
 1078        apx->type==RD_RESOLVED ||
 1079        apx->type==SSCONFLICT ||
 1080        apx->type==SRCONFLICT ||
 1081        apx->type==RRCONFLICT ||
 1082        apy->type==SH_RESOLVED ||
 1083        apy->type==RD_RESOLVED ||
 1084        apy->type==SSCONFLICT ||
 1085        apy->type==SRCONFLICT ||
 1086        apy->type==RRCONFLICT
 1087      );
 1088      /* The REDUCE/SHIFT case cannot happen because SHIFTs come before 
 1089      ** REDUCEs on the list.  If we reach this point it must be because
 1090      ** the parser conflict had already been resolved. */
 1091    }
 1092    return errcnt;
 1093  }
Show more  




Change Warning 882.29666 : Redundant Condition

Priority:
State:
Finding:
Owner:
Note: