Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.6
 
1.7
 
MAIN:ragge:20020817074817
 
trees.c
_>280280                         }
 281281                 }
 282282 
<>283 -        if( (actions&PUN) && (o!=CAST||cflag) ){
  283+        if ((actions&PUN) && (o!=CAST||cflag))
284284                 chkpun(p);
<>285 -                }
286285 
 287286         if( actions & (TYPL|TYPR) ){
 288287 
     
 !
769768         return(1);
 770769         }
 771770 
<> 771+/*
  772+ * Checks p for the existance of a pun.  This is called when the op of p
  773+ * is ASSIGN, RETURN, CAST, COLON, or relational.
  774+ * One case is when enumerations are used: this applies only to lint.
  775+ * In the other case, one operand is a pointer, the other integer type
  776+ * we check that this integer is in fact a constant zero...
  777+ * in the case of ASSIGN, any assignment of pointer to integer is illegal
  778+ * this falls out, because the LHS is never 0.
  779+ */
772780 void
<>773 -chkpun(p) register NODE *p; {
 774 -
 775 -        /* checks p for the existance of a pun */
 776 -
 777 -        /* this is called when the op of p is ASSIGN, RETURN, CAST, COLON, or relational */
 778 -
 779 -        /* one case is when enumerations are used: this applies only to lint */
 780 -        /* in the other case, one operand is a pointer, the other integer type */
 781 -        /* we check that this integer is in fact a constant zero... */
 782 -
 783 -        /* in the case of ASSIGN, any assignment of pointer to integer is illegal */
 784 -        /* this falls out, because the LHS is never 0 */
 785 -
  781+chkpun(NODE *p)
  782+{
786783         NODE *q;
 787784         int t1, t2, d1, d2, ref1, ref2;
 788785 
 789786         t1 = p->in.left->in.type;
 790787         t2 = p->in.right->in.type;
 791788 
<>792 -        if( t1==ENUMTY || t2==ENUMTY ) { /* check for enumerations */
  789+        /* check for enumerations */
  790+        if (t1==ENUMTY || t2==ENUMTY) {
793791                 /* rob pike says this is obnoxious...
 794792                 if( logop( p->in.op ) && p->in.op != EQ && p->in.op != NE )
 795793                         werror( "comparison of enums" ); */
<>796 -                if( t1==ENUMTY && t2==ENUMTY ) {
 797 -                        if ( p->in.left->fn.csiz!=p->in.right->fn.csiz )
 798 -                                werror( "enumeration type clash, operator %s", opst[p->in.op] );
  794+                if (t1==ENUMTY && t2==ENUMTY) {
  795+                        if (p->in.left->fn.csiz!=p->in.right->fn.csiz)
  796+                                werror("enumeration type clash, "
  797+                                    "operator %s", opst[p->in.op]);
799798                         return;
<>800 -                        }
 801 -                if ( t1 == ENUMTY ) t1 = INT;
 802 -                if ( t2 == ENUMTY ) t2 = INT;
803799                 }
<> 800+                if (t1 == ENUMTY)
  801+                        t1 = INT;
  802+                if (t2 == ENUMTY)
  803+                        t2 = INT;
  804+        }
804805 
 805806         ref1 = ISPTR(t1) || ISARY(t1);
 806807         ref2 = ISPTR(t2) || ISARY(t2);
 807808 
<>808 -        if( ref1 ^ ref2 ){
 809 -                if( ref1 ) q = p->in.right;
 810 -                else q = p->in.left;
 811 -                if( q->in.op != ICON || q->tn.lval != 0 ){
 812 -                        werror( "illegal combination of pointer and integer, op %s",
 813 -                                opst[p->in.op] );
 814 -                }
 815 -        } else if( ref1 ) {
 816 -                if( t1 == t2 ) {
 817 -                        if( p->in.left->fn.csiz != p->in.right->fn.csiz ) {
  809+        if (ref1 ^ ref2) {
  810+                if (ref1)
  811+                        q = p->in.right;
  812+                else
  813+                        q = p->in.left;
  814+                if (q->in.op != ICON || q->tn.lval != 0)
  815+                        werror("illegal combination of pointer "
  816+                            "and integer, op %s", opst[p->in.op]);
  817+        } else if (ref1) {
  818+                if (t1 == t2) {
  819+                        if (p->in.left->fn.csiz != p->in.right->fn.csiz) {
818820                                 werror("illegal structure pointer combination");
 819821                                 return;
 820822                         }
 821823                         d1 = p->in.left->fn.cdim;
 822824                         d2 = p->in.right->fn.cdim;
<>823 -                        for( ;; ){
 824 -                                if( ISARY(t1) ){
 825 -                                        if( dimtab[d1] != dimtab[d2] ){
 826 -                                                werror( "illegal array size combination" );
  825+                        for (;;) {
  826+                                if (ISARY(t1)) {
  827+                                        if (dimtab[d1] != dimtab[d2]) {
  828+                                                werror("illegal array "
  829+                                                    "size combination");
827830                                                 return;
 828831                                         }
 829832                                         ++d1;
 830833                                         ++d2;
 831834                                 } else
<>832 -                                        if( !ISPTR(t1) )
  835+                                        if (!ISPTR(t1))
833836                                                 break;
 834837                                 t1 = DECREF(t1);
 835838                         }
<>836 -                } else if( t1 != INCREF(UNDEF) && t2 != INCREF(UNDEF) )
 837 -                        werror( "illegal pointer combination" );
  839+                } else if (t1 != INCREF(UNDEF) && t2 != INCREF(UNDEF))
  840+                        werror("illegal pointer combination");
<_838841         }
 839842 }
 840843 
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-09-30 17:55 +0200