Subject: [Fwd: Re: bin/34766: Changes for xlint]
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: henning petersen <henning.petersen@t-online.de>
List: netbsd-bugs
Date: 10/09/2006 15:15:05
The following reply was made to PR bin/34766; it has been noted by GNATS.

From: henning petersen <henning.petersen@t-online.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: [Fwd: Re: bin/34766: Changes for xlint]
Date: Mon, 09 Oct 2006 16:06:24 +0200

 This is a multi-part message in MIME format.
 --------------070404010004060102080004
 Content-Type: text/plain; charset=ISO-8859-15; format=flowed
 Content-Transfer-Encoding: 7bit
 
 
 
 --------------070404010004060102080004
 Content-Type: message/rfc822;
  name="Re: bin/34766: Changes for xlint"
 Content-Transfer-Encoding: 8bit
 Content-Disposition: inline;
  filename="Re: bin/34766: Changes for xlint"
 
 X-Identity-Key: id1
 Message-ID: <452A4735.2010801@t-online.de>
 Date: Mon, 09 Oct 2006 14:57:25 +0200
 From: henning petersen <henning.petersen@t-online.de>
 User-Agent: Thunderbird 1.5.0.7 (Windows/20060909)
 MIME-Version: 1.0
 To:  gnats-bugs@NetBSD.org
 Subject: Re: bin/34766: Changes for xlint
 References: <pr-bin-34766@gnats.netbsd.org> <20061009113501.CC13263BC04@narn.NetBSD.org>
 In-Reply-To: <20061009113501.CC13263BC04@narn.NetBSD.org>
 Content-Type: multipart/mixed;
  boundary="------------060400060700080903070209"
 
 This is a multi-part message in MIME format.
 --------------060400060700080903070209
 Content-Type: text/plain; charset=ISO-8859-15; format=flowed
 Content-Transfer-Encoding: 8bit
 
 David Laight schrieb:
 > The following reply was made to PR bin/34766; it has been noted by GNATS.
 >
 > From: David Laight <david@l8s.co.uk>
 > To: gnats-bugs@NetBSD.org
 > Cc: 
 > Subject: Re: bin/34766: Changes for xlint
 > Date: Mon, 9 Oct 2006 12:26:58 +0100
 >
 >  On Mon, Oct 09, 2006 at 11:20:00AM +0000, henning.petersen@t-online.de wrote:
 >  > Add sizeof(term) from OpenBSD;
 >  > Missing strg1->st_len=len in function catstrg;
 >  > Typos in comments;
 >  
 >  Can you separate the patches?
 >  
 >  > -		for (p = p2; p->p_nxt != NULL; p = p->p_nxt)
 >  > -			continue;
 >  > +		for (p = p2; p->p_nxt != NULL; p = p->p_nxt);
 >  
 >  The continue here is deliberate and good practise, they don't want
 >  removing.
 >  
 >  	David
 >  
 >  -- 
 >  David Laight: david@l8s.co.uk
 >  
 >
 > __________ NOD32 1.1795 (20061009) Information __________
 >
 > Diese E-Mail wurde vom NOD32 antivirus system geprüft
 > http://www.nod32.com
 >
 >
 >
 >   
 
 
 --------------060400060700080903070209
 Content-Type: text/plain;
  name="scan.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="scan.diff"
 
 Index: scan.l
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/xlint/lint1/scan.l,v
 retrieving revision 1.34
 diff -u -r1.34 scan.l
 --- scan.l	22 Mar 2006 02:14:03 -0000	1.34
 +++ scan.l	9 Oct 2006 12:43:23 -0000
 @@ -514,7 +514,7 @@
  		warning(252);
  
  	/*
 -	 * If the value is to big for the current type, we must choose
 +	 * If the value is too big for the current type, we must choose
  	 * another type.
  	 */
  	ansiu = 0;
 @@ -649,7 +649,7 @@
  }
  
  /*
 - * Convert a string representing a floating point value into its interal
 + * Convert a string representing a floating point value into its integral
   * representation. Type and value are returned in yylval. fcon()
   * (and yylex()) returns T_CON.
   * XXX Currently it is not possible to convert constants of type
 
 --------------060400060700080903070209
 Content-Type: text/plain;
  name="tree.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="tree.diff"
 
 Index: tree.c
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/xlint/lint1/tree.c,v
 retrieving revision 1.42
 diff -u -r1.42 tree.c
 --- tree.c	22 Mar 2006 02:08:55 -0000	1.42
 +++ tree.c	9 Oct 2006 12:34:09 -0000
 @@ -561,7 +561,7 @@
  
  	/*
  	 * Apply class conversions to the left operand, but only if its
 -	 * value is needed or it is compaired with null.
 +	 * value is needed or it is compared with null.
  	 */
  	if (mp->m_vctx || mp->m_tctx)
  		ln = cconv(ln);
 @@ -618,7 +618,7 @@
  
  	/*
  	 * Check types for compatibility with the operation and mutual
 -	 * compatibility. Return if there are serios problems.
 +	 * compatibility. Return if there are serious problems.
  	 */
  	if (!typeok(op, 0, ln, rn))
  		return (NULL);
 @@ -763,7 +763,7 @@
  
  /*
   * Perform most type checks. First the types are checked using
 - * informations from modtab[]. After that it is done by hand for
 + * information from modtab[]. After that it is done by hand for
   * more complicated operators and type combinations.
   *
   * If the types are ok, typeok() returns 1, otherwise 0.
 @@ -828,7 +828,7 @@
  	case POINT:
  		/*
  		 * Most errors required by ANSI C are reported in strmemb().
 -		 * Here we only must check for totaly wrong things.
 +		 * Here we only must check for totally wrong things.
  		 */
  		if (lt == FUNC || lt == VOID || ltp->t_isfield ||
  		    ((lt != STRUCT && lt != UNION) && !ln->tn_lvalue)) {
 @@ -975,14 +975,14 @@
  		 * ANSI C does not perform balancing for shift operations,
  		 * but traditional C does. If the width of the right operand
  		 * is greather than the width of the left operand, than in
 -		 * traditional C the left operand would be extendet to the
 +		 * traditional C the left operand would be extended to the
  		 * width of the right operand. For SHL this may result in
  		 * different results.
  		 */
  		if (psize(lt) < psize(rt)) {
  			/*
  			 * XXX If both operands are constant make sure
 -			 * that there is really a differencs between
 +			 * that there is really a difference between
  			 * ANSI C and traditional C.
  			 */
  			if (hflag)
 @@ -995,7 +995,7 @@
  				/* negative shift */
  				warning(121);
  			} else if ((uint64_t)rn->tn_val->v_quad == size(lt)) {
 -				/* shift equal to size fo object */
 +				/* shift equal to size of object */
  				warning(267);
  			} else if ((uint64_t)rn->tn_val->v_quad > size(lt)) {
  				/* shift greater than size of object */
 @@ -1121,7 +1121,7 @@
  		goto assign;
  	case SHRASS:
  		if (pflag && !isutyp(lt) && !(tflag && isutyp(rt))) {
 -			/* bitwise operation on s.v. possibly nonportabel */
 +			/* bitwise operation on s.v. possibly nonportable */
  			warning(117);
  		}
  		goto assign;
 @@ -1767,7 +1767,7 @@
  }
  
  /*
 - * Print warnings for conversions of integer types which my cause
 + * Print warnings for conversions of integer types which may cause
   * problems.
   */
  /* ARGSUSED */
 @@ -2934,6 +2934,26 @@
  }
  
  /*
 + * Create a constant node for sizeof(term).
 + */
 +tnode_t *
 +bldszoftrm(tnode_t *tn)
 +{
 +	switch (tn->tn_op) {
 +	case POINT:
 +	case STAR:
 +	case NAME:
 +	case STRING:
 +		break;
 +	default:
 +		warning(322, modtab[tn->tn_op].m_name);
 +	}
 +
 +
 +	return bldszof(tn->tn_type);
 +}
 +
 +/*
   * Create a constant node for sizeof.
   */
  tnode_t *
 @@ -3714,7 +3734,7 @@
  }
  
  /*
 - * Takes an expression an returns 0 if this expression can be used
 + * Takes an expression and returns 0 if this expression can be used
   * for static initialisation, otherwise -1.
   *
   * Constant initialisation expressions must be constant or an address
 @@ -3825,6 +3845,7 @@
  		free(strg2->st_wcp);
  	}
  	free(strg2);
 +	strg1->st_len = len;
  
  	return (strg1);
  }
 
 --------------060400060700080903070209
 Content-Type: text/plain;
  name="cgram.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="cgram.diff"
 
 Index: cgram.y
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/xlint/lint1/cgram.y,v
 retrieving revision 1.37
 diff -u -r1.37 cgram.y
 --- cgram.y	12 Jul 2006 20:03:48 -0000	1.37
 +++ cgram.y	9 Oct 2006 12:35:09 -0000
 @@ -1658,7 +1658,7 @@
  		}
  	  }
  	| T_SIZEOF term					%prec T_SIZEOF {
 -		if (($$ = $2 == NULL ? NULL : bldszof($2->tn_type)) != NULL)
 +		if (($$ = $2 == NULL ? NULL : bldszoftrm($2)) != NULL)
  			chkmisc($2, 0, 0, 0, 0, 0, 1);
  	  }
  	| T_SIZEOF T_LPARN type_name T_RPARN		%prec T_SIZEOF {
 
 --------------060400060700080903070209
 Content-Type: text/plain;
  name="decl.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="decl.diff"
 
 Index: decl.c
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/xlint/lint1/decl.c,v
 retrieving revision 1.35
 diff -u -r1.35 decl.c
 --- decl.c	13 Jul 2006 17:49:29 -0000	1.35
 +++ decl.c	9 Oct 2006 12:35:29 -0000
 @@ -129,7 +129,7 @@
  /*
   * Returns a shared type structure vor arithmetic types and void.
   *
 - * It's important do duplicate this structure (using duptyp() or tdupdyp())
 + * It's important to duplicate this structure (using duptyp() or tdupdyp())
   * if it is to be modified (adding qualifiers or anything else).
   */
  type_t *
 @@ -164,7 +164,7 @@
  }
  
  /*
 - * Returns 1 if the argument is void or an incomplete array,
 + * Returns 1 if the argument is void or a incomplete array,
   * struct, union or enum type.
   */
  int
 @@ -810,7 +810,7 @@
  }
  
  /*
 - * Get the alignment of the given Type in bits.
 + * Get the alignment of the given type in bits.
   */
  int
  getbound(type_t *tp)
 @@ -991,7 +991,7 @@
  		/*
  		 * bit field
  		 *
 -		 * only unsigned und signed int are protable bit-field types
 +		 * only unsigned and signed int are portable bit-field types
  		 *(at least in ANSI C, in traditional C only unsigned int)
  		 */
  		if (t == CHAR || t == UCHAR || t == SCHAR ||
 @@ -1154,6 +1154,7 @@
  		/* left '*' at the end of the list */
  		for (p = p2; p->p_nxt != NULL; p = p->p_nxt)
  			continue;
 +
  		p->p_nxt = p1;
  		return (p2);
  	} else {
 @@ -1180,7 +1181,7 @@
   * Followint 3 functions extend the type of a declarator with
   * pointer, function and array types.
   *
 - * The current type is the Type built by deftyp() (dcs->d_type) and
 + * The current type is the type built by deftyp() (dcs->d_type) and
   * pointer, function and array types already added for this
   * declarator. The new type extension is inserted between both.
   */
 @@ -1401,7 +1402,7 @@
  	switch (dcs->d_ctx) {
  	case MOS:
  	case MOU:
 -		/* Parent setzen */
 +		/* Set parent */
  		sym->s_styp = dcs->d_tagtyp->t_str;
  		sym->s_def = DEF;
  		sym->s_value.v_tspec = INT;
 @@ -1566,7 +1567,7 @@
  			tp->t_enum = getblk(sizeof (enum_t));
  			tp->t_enum->etag = tag;
  		}
 -		/* ist unvollstaendiger Typ */
 +		/* is incomplete type */
  		setcompl(tp, 1);
  	}
  
 @@ -1776,7 +1777,7 @@
  	if (plibflg && llibflg &&
  	    dsym->s_type->t_tspec == FUNC && dsym->s_type->t_proto) {
  		/*
 -		 * With both LINTLIBRARY and PROTOLIB the prototyp is
 +		 * With both LINTLIBRARY and PROTOLIB the prototype is
  		 * written as a function definition to the output file.
  		 */
  		rval = dsym->s_type->t_subt->t_tspec != VOID;
 @@ -2157,7 +2158,7 @@
  			if (dst->t_dim == 0 && src->t_dim != 0) {
  				*dstp = dst = duptyp(dst);
  				dst->t_dim = src->t_dim;
 -				/* now a complete Typ */
 +				/* now a complete type */
  				setcompl(dst, 0);
  			}
  		} else if (dst->t_tspec == FUNC) {
 @@ -2236,7 +2237,7 @@
   * Does some checks for lint directives which apply to functions.
   * Processes arguments in old style function definitions which default
   * to int.
 - * Checks compatiblility of old style function definition with previous
 + * Checks compatibility of old style function definition with previous
   * prototype.
   */
  void
 @@ -2307,7 +2308,7 @@
  	}
  
  	/*
 -	 * print a warning for each argument off an old style function
 +	 * print a warning for each argument of an old style function
  	 * definition which defaults to int
  	 */
  	for (arg = args; arg != NULL; arg = arg->s_nxt) {
 @@ -2320,7 +2321,7 @@
  	}
  
  	/*
 -	 * If this is an old style function definition and a prototyp
 +	 * If this is an old style function definition and a prototype
  	 * exists, compare the types of arguments.
  	 */
  	if (funcsym->s_osdef && funcsym->s_type->t_proto) {
 @@ -2590,7 +2591,7 @@
  
  /*
   * Print an error or a warning if the symbol cant be initialized due
 - * to type/storage class. Returnvalue is 1 if an error has been
 + * to type/storage class. Return value is 1 if an error has been
   * detected.
   */
  static int
 
 --------------060400060700080903070209
 Content-Type: text/plain;
  name="emit1.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="emit1.diff"
 
 Index: emit1.c
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/xlint/lint1/emit1.c,v
 retrieving revision 1.16
 diff -u -r1.16 emit1.c
 --- emit1.c	24 Sep 2005 15:30:35 -0000	1.16
 +++ emit1.c	9 Oct 2006 12:35:47 -0000
 @@ -481,7 +481,7 @@
  
  /*
   * extracts potential format specifiers for printf() and scanf() and
 - * writes them, enclosed in "" and qouted if necessary, to the output buffer
 + * writes them, enclosed in "" and quoted if necessary, to the output buffer
   */
  static void
  outfstrg(strg_t *strg)
 
 --------------060400060700080903070209
 Content-Type: text/plain;
  name="externs1.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="externs1.diff"
 
 Index: externs1.h
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/xlint/lint1/externs1.h,v
 retrieving revision 1.21
 diff -u -r1.21 externs1.h
 --- externs1.h	7 Apr 2005 16:28:40 -0000	1.21
 +++ externs1.h	9 Oct 2006 12:36:32 -0000
 @@ -197,6 +197,7 @@
  extern	tnode_t	*promote(op_t, int, tnode_t *);
  extern	tnode_t	*convert(op_t, int, type_t *, tnode_t *);
  extern	void	cvtcon(op_t, int, type_t *, val_t *, val_t *);
 +extern	tnode_t	*bldszoftrm(tnode_t *);
  extern	tnode_t	*bldszof(type_t *);
  extern	tnode_t	*cast(tnode_t *, type_t *);
  extern	tnode_t	*funcarg(tnode_t *, tnode_t *);
 
 --------------060400060700080903070209
 Content-Type: text/plain;
  name="func.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="func.diff"
 
 Index: func.c
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/xlint/lint1/func.c,v
 retrieving revision 1.22
 diff -u -r1.22 func.c
 --- func.c	24 Sep 2005 15:30:35 -0000	1.22
 +++ func.c	9 Oct 2006 12:40:24 -0000
 @@ -62,7 +62,7 @@
  int	rchflg;
  
  /*
 - * In conjunction with reached ontrols printing of "fallthrough on ..."
 + * In conjunction with reached controls printing of "fallthrough on ..."
   * warnings.
   * Reset by each statement and set by FALLTHROUGH, switch (switch1())
   * and case (label()).
 @@ -110,13 +110,13 @@
  pos_t	scflpos;
  
  /*
 - * Are both plibflg and llibflg set, prototypes are writen as function
 + * Are both plibflg and llibflg set, prototypes are written as function
   * definitions to the output file.
   */
  int	plibflg;
  
  /*
 - * Nonzero means that no warnings about constands in conditional
 + * Nonzero means that no warnings about constants in conditional
   * context are printed.
   */
  int	ccflg;
 @@ -201,7 +201,7 @@
   * Called after a function declaration which introduces a function definition
   * and before an (optional) old style argument declaration list.
   *
 - * Puts all symbols declared in the Prototype or in an old style argument
 + * Puts all symbols declared in the prototype or in an old style argument
   * list back to the symbol table.
   *
   * Does the usual checking of storage class, type (return value),
 
 --------------060400060700080903070209
 Content-Type: text/plain;
  name="lint1.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="lint1.diff"
 
 Index: lint1.h
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/xlint/lint1/lint1.h,v
 retrieving revision 1.19
 diff -u -r1.19 lint1.h
 --- lint1.h	24 Sep 2005 15:30:35 -0000	1.19
 +++ lint1.h	9 Oct 2006 12:37:13 -0000
 @@ -104,7 +104,7 @@
   * Structures of type str_t uniqely identify structures. This can't
   * be done in structures of type type_t, because these are copied
   * if they must be modified. So it would not be possible to check
 - * if to structures are identical by comparing the pointers to
 + * if two structures are identical by comparing the pointers to
   * the type structures.
   *
   * The typename is used if the structure is unnamed to identify
 
 --------------060400060700080903070209--
 
 
 --------------070404010004060102080004--