Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Apr 2015 19:56:28 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r281168 - in stable/10/usr.bin/xlint: arch/sparc64 common lint1 lint2 xlint
Message-ID:  <201504061956.t36JuSEx029266@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Mon Apr  6 19:56:27 2015
New Revision: 281168
URL: https://svnweb.freebsd.org/changeset/base/281168

Log:
  MFC	r280387:
  xlint: update.
  
  Bring some important updates from NetBSD up to about 2008/04/25.
  The main feature is initial support for C99.
  
  Obtained from:	NetBSD

Modified:
  stable/10/usr.bin/xlint/arch/sparc64/targparam.h
  stable/10/usr.bin/xlint/common/lint.h
  stable/10/usr.bin/xlint/common/mem.c
  stable/10/usr.bin/xlint/lint1/cgram.y
  stable/10/usr.bin/xlint/lint1/decl.c
  stable/10/usr.bin/xlint/lint1/emit1.c
  stable/10/usr.bin/xlint/lint1/err.c
  stable/10/usr.bin/xlint/lint1/externs1.h
  stable/10/usr.bin/xlint/lint1/func.c
  stable/10/usr.bin/xlint/lint1/init.c
  stable/10/usr.bin/xlint/lint1/lint1.h
  stable/10/usr.bin/xlint/lint1/main1.c
  stable/10/usr.bin/xlint/lint1/makeman
  stable/10/usr.bin/xlint/lint1/scan.l
  stable/10/usr.bin/xlint/lint1/tree.c
  stable/10/usr.bin/xlint/lint2/read.c
  stable/10/usr.bin/xlint/xlint/lint.1
  stable/10/usr.bin/xlint/xlint/xlint.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/xlint/arch/sparc64/targparam.h
==============================================================================
--- stable/10/usr.bin/xlint/arch/sparc64/targparam.h	Mon Apr  6 19:26:45 2015	(r281167)
+++ stable/10/usr.bin/xlint/arch/sparc64/targparam.h	Mon Apr  6 19:56:27 2015	(r281168)
@@ -1,4 +1,4 @@
-/*	$NetBSD: targparam.h,v 1.2 2002/01/30 06:55:00 thorpej Exp $	*/
+/*	$NetBSD: targparam.h,v 1.3 2002/01/31 23:31:34 he Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -29,6 +29,8 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
  */
 
 /*

Modified: stable/10/usr.bin/xlint/common/lint.h
==============================================================================
--- stable/10/usr.bin/xlint/common/lint.h	Mon Apr  6 19:26:45 2015	(r281167)
+++ stable/10/usr.bin/xlint/common/lint.h	Mon Apr  6 19:56:27 2015	(r281168)
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.5 2002/03/07 18:29:56 tv Exp $	*/
+/*	$NetBSD: lint.h,v 1.7 2003/10/27 00:12:44 lukem Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -29,6 +29,8 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
  */
 
 #if HAVE_CONFIG_H
@@ -90,7 +92,7 @@ typedef	struct {
 	u_int	tt_isftyp : 1;		/* 1 if floating point type */
 	u_int	tt_isatyp : 1;		/* 1 if arithmetic type */
 	u_int	tt_issclt : 1;		/* 1 if scalar type */
-	char	*tt_name;		/* Bezeichnung des Typs */
+	const char *tt_name;		/* Bezeichnung des Typs */
 } ttab_t;
 
 #define size(t)		(ttab[t].tt_sz)

Modified: stable/10/usr.bin/xlint/common/mem.c
==============================================================================
--- stable/10/usr.bin/xlint/common/mem.c	Mon Apr  6 19:26:45 2015	(r281167)
+++ stable/10/usr.bin/xlint/common/mem.c	Mon Apr  6 19:56:27 2015	(r281168)
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.2 2002/01/21 19:49:51 tv Exp $	*/
+/*	$NetBSD: mem.c,v 1.4 2003/10/16 06:35:26 itojun Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -33,8 +33,9 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem.c,v 1.2 2002/01/21 19:49:51 tv Exp $");
+__RCSID("$NetBSD: mem.c,v 1.4 2003/10/16 06:35:26 itojun Exp $");
 #endif
+__FBSDID("$FreeBSD$");
 
 #include <stdlib.h>
 #include <string.h>
@@ -64,9 +65,13 @@ xcalloc(size_t n, size_t s)
 void *
 xrealloc(void *p, size_t s)
 {
+	void *n;
 
-	if ((p = realloc(p, s)) == NULL)
+	if ((n = realloc(p, s)) == NULL) {
+		free(p);
 		nomem();
+	}
+	p = n;
 	return (p);
 }
 

Modified: stable/10/usr.bin/xlint/lint1/cgram.y
==============================================================================
--- stable/10/usr.bin/xlint/lint1/cgram.y	Mon Apr  6 19:26:45 2015	(r281167)
+++ stable/10/usr.bin/xlint/lint1/cgram.y	Mon Apr  6 19:56:27 2015	(r281168)
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.23 2002/01/31 19:36:53 tv Exp $ */
+/* $NetBSD: cgram.y,v 1.40 2008/04/25 17:18:24 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.23 2002/01/31 19:36:53 tv Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.40 2008/04/25 17:18:24 christos Exp $");
 #endif
 __FBSDID("$FreeBSD$");
 
@@ -65,13 +65,13 @@ int	mblklev;
  */
 static int onowarn = -1;
 
-static	int	toicon(tnode_t *);
+static	int	toicon(tnode_t *, int);
 static	void	idecl(sym_t *, int, sbuf_t *);
 static	void	ignuptorp(void);
 
 #ifdef DEBUG
-static __inline void CLRWFLGS(void);
-static __inline void CLRWFLGS(void)
+static inline void CLRWFLGS(void);
+static inline void CLRWFLGS(void)
 {
 	printf("%s, %d: clear flags %s %d\n", curr_pos.p_file,
 	    curr_pos.p_line, __FILE__, __LINE__);
@@ -79,8 +79,8 @@ static __inline void CLRWFLGS(void)
 	onowarn = -1;
 }
 
-static __inline void SAVE(void);
-static __inline void SAVE(void)
+static inline void SAVE(void);
+static inline void SAVE(void)
 {
 	if (onowarn != -1)
 		abort();
@@ -89,8 +89,8 @@ static __inline void SAVE(void)
 	onowarn = nowarn;
 }
 
-static __inline void RESTORE(void);
-static __inline void RESTORE(void)
+static inline void RESTORE(void);
+static inline void RESTORE(void)
 {
 	if (onowarn != -1) {
 		nowarn = onowarn;
@@ -107,6 +107,8 @@ static __inline void RESTORE(void)
 #endif
 %}
 
+%expect 1
+
 %union {
 	int	y_int;
 	val_t	*y_val;
@@ -118,6 +120,7 @@ static __inline void RESTORE(void)
 	tqual_t	y_tqual;
 	type_t	*y_type;
 	tnode_t	*y_tnode;
+	range_t	y_range;
 	strg_t	*y_strg;
 	pqinf_t	*y_pqinf;
 };
@@ -243,6 +246,8 @@ static __inline void RESTORE(void)
 %type	<y_sym>		parameter_type_list
 %type	<y_sym>		parameter_declaration
 %type	<y_tnode>	expr
+%type	<y_tnode>	expr_stmnt_val
+%type	<y_tnode>	expr_stmnt_list
 %type	<y_tnode>	term
 %type	<y_tnode>	func_arg_list
 %type	<y_op>		point_or_arrow
@@ -253,6 +258,8 @@ static __inline void RESTORE(void)
 %type	<y_strg>	string
 %type	<y_strg>	string2
 %type	<y_sb>		opt_asm_or_symbolrename
+%type	<y_range>	range
+%type	<y_range>	lorange
 
 
 %%
@@ -682,12 +689,12 @@ notype_member_decl:
 		$$ = $1;
 	  }
 	| notype_decl T_COLON constant {
-		$$ = bitfield($1, toicon($3));
+		$$ = bitfield($1, toicon($3, 1));
 	  }
 	| {
 		symtyp = FVFT;
 	  } T_COLON constant {
-		$$ = bitfield(NULL, toicon($3));
+		$$ = bitfield(NULL, toicon($3, 1));
 	  }
 	;
 
@@ -696,12 +703,12 @@ type_member_decl:
 		$$ = $1;
 	  }
 	| type_decl T_COLON constant {
-		$$ = bitfield($1, toicon($3));
+		$$ = bitfield($1, toicon($3, 1));
 	  }
 	| {
 		symtyp = FVFT;
 	  } T_COLON constant {
-		$$ = bitfield(NULL, toicon($3));
+		$$ = bitfield(NULL, toicon($3, 1));
 	  }
 	;
 
@@ -784,7 +791,7 @@ enumerator:
 		$$ = ename($1, enumval, 1);
 	  }
 	| ename T_ASSIGN constant {
-		$$ = ename($1, toicon($3), 0);
+		$$ = ename($1, toicon($3, 1), 0);
 	  }
 	;
 
@@ -849,7 +856,7 @@ notype_direct_decl:
 		$$ = addarray($1, 0, 0);
 	  }
 	| notype_direct_decl T_LBRACK constant T_RBRACK {
-		$$ = addarray($1, 1, toicon($3));
+		$$ = addarray($1, 1, toicon($3, 0));
 	  }
 	| notype_direct_decl param_list {
 		$$ = addfunc($1, $2);
@@ -878,7 +885,7 @@ type_direct_decl:
 		$$ = addarray($1, 0, 0);
 	  }
 	| type_direct_decl T_LBRACK constant T_RBRACK {
-		$$ = addarray($1, 1, toicon($3));
+		$$ = addarray($1, 1, toicon($3, 0));
 	  }
 	| type_direct_decl param_list {
 		$$ = addfunc($1, $2);
@@ -914,7 +921,7 @@ direct_param_decl:
 		$$ = addarray($1, 0, 0);
 	  }
 	| direct_param_decl T_LBRACK constant T_RBRACK {
-		$$ = addarray($1, 1, toicon($3));
+		$$ = addarray($1, 1, toicon($3, 0));
 	  }
 	| direct_param_decl param_list {
 		$$ = addfunc($1, $2);
@@ -943,7 +950,7 @@ direct_notype_param_decl:
 		$$ = addarray($1, 0, 0);
 	  }
 	| direct_notype_param_decl T_LBRACK constant T_RBRACK {
-		$$ = addarray($1, 1, toicon($3));
+		$$ = addarray($1, 1, toicon($3, 0));
 	  }
 	| direct_notype_param_decl param_list {
 		$$ = addfunc($1, $2);
@@ -1121,6 +1128,7 @@ init_expr:
 	  expr				%prec T_COMMA {
 		mkinit($1);
 	  }
+	| init_by_name init_expr	%prec T_COMMA
 	| init_lbrace init_expr_list init_rbrace
 	| init_lbrace init_expr_list T_COMMA init_rbrace
 	| error
@@ -1131,6 +1139,38 @@ init_expr_list:
 	| init_expr_list T_COMMA init_expr
 	;
 
+lorange: 
+	  constant T_ELLIPSE {
+		$$.lo = toicon($1, 1);
+	  }
+	;
+range:
+	constant {
+		$$.lo = toicon($1, 1);
+		$$.hi = $$.lo + 1;
+	  }
+	| lorange constant {
+		$$.lo = $1.lo;
+		$$.hi = toicon($2, 1);
+	  }
+	;
+
+init_by_name:
+	  T_LBRACK range T_RBRACK T_ASSIGN {
+		if (!Sflag)
+			warning(321);
+	  }
+	| point identifier T_ASSIGN {
+		if (!Sflag)
+			warning(313);
+		memberpush($2);
+	  }
+	| identifier T_COLON {
+		gnuism(315);
+		memberpush($1);
+	  }
+	;
+
 init_lbrace:
 	  T_LBRACE {
 		initlbr();
@@ -1187,13 +1227,13 @@ direct_abs_decl:
 		$$ = addarray(aname(), 0, 0);
 	  }
 	| T_LBRACK constant T_RBRACK {
-		$$ = addarray(aname(), 1, toicon($2));
+		$$ = addarray(aname(), 1, toicon($2, 0));
 	  }
 	| direct_abs_decl T_LBRACK T_RBRACK {
 		$$ = addarray($1, 0, 0);
 	  }
 	| direct_abs_decl T_LBRACK constant T_RBRACK {
-		$$ = addarray($1, 1, toicon($3));
+		$$ = addarray($1, 1, toicon($3, 0));
 	  }
 	| abs_decl_param_list {
 		$$ = addfunc(aname(), $1);
@@ -1207,9 +1247,8 @@ direct_abs_decl:
 	  }
 	;
 
-stmnt:
+non_expr_stmnt:
 	  labeled_stmnt
-	| expr_stmnt
 	| comp_stmnt
 	| selection_stmnt
 	| iteration_stmnt
@@ -1217,6 +1256,10 @@ stmnt:
 		ftflg = 0;
 	  }
 	| asm_stmnt
+
+stmnt:
+	  expr_stmnt
+	| non_expr_stmnt
 	;
 
 labeled_stmnt:
@@ -1231,7 +1274,12 @@ label:
 	| T_CASE constant T_COLON {
 		label(T_CASE, NULL, $2);
 		ftflg = 1;
-	  }
+	}
+	| T_CASE constant T_ELLIPSE constant T_COLON {
+		/* XXX: We don't fill all cases */
+		label(T_CASE, NULL, $2);
+		ftflg = 1;
+	}
 	| T_DEFAULT T_COLON {
 		label(T_DEFAULT, NULL, NULL);
 		ftflg = 1;
@@ -1239,11 +1287,11 @@ label:
 	;
 
 comp_stmnt:
-	  compstmnt_lbrace declaration_list opt_stmnt_list compstmnt_rbrace
-	| compstmnt_lbrace opt_stmnt_list compstmnt_rbrace
+	  comp_stmnt_lbrace declaration_list opt_stmnt_list comp_stmnt_rbrace
+	| comp_stmnt_lbrace opt_stmnt_list comp_stmnt_rbrace
 	;
 
-compstmnt_lbrace:
+comp_stmnt_lbrace:
 	  T_LBRACE {
 		blklev++;
 		mblklev++;
@@ -1251,7 +1299,7 @@ compstmnt_lbrace:
 	  }
 	;
 
-compstmnt_rbrace:
+comp_stmnt_rbrace:
 	  T_RBRACE {
 		popdecl();
 		freeblk();
@@ -1276,7 +1324,7 @@ stmnt_list:
 
 expr_stmnt:
 	  expr T_SEMI {
-		expr($1, 0, 0);
+		expr($1, 0, 0, 1);
 		ftflg = 0;
 	  }
 	| T_SEMI {
@@ -1284,6 +1332,34 @@ expr_stmnt:
 	  }
 	;
 
+/*
+ * The following two productions are used to implement 
+ * ({ [[decl-list] stmt-list] }).
+ * XXX: This is not well tested.
+ */
+expr_stmnt_val:
+	  expr T_SEMI {
+		/* XXX: We should really do that only on the last name */
+		if ($1->tn_op == NAME)
+			$1->tn_sym->s_used = 1;
+		$$ = $1;
+		expr($1, 0, 0, 0);
+		ftflg = 0;
+	  }
+	| non_expr_stmnt {
+	$$ = getnode();
+	$$->tn_type = gettyp(VOID);
+	}
+	;
+
+expr_stmnt_list:
+	  expr_stmnt_val
+	| expr_stmnt_list expr_stmnt_val {
+		$$ = $2;
+	}
+	| expr_stmnt_list expr_stmnt_val
+	;
+
 selection_stmnt:
 	  if_without_else {
 		SAVE();
@@ -1525,6 +1601,26 @@ term:
 			$2->tn_parn = 1;
 		$$ = $2;
 	  }
+	| T_LPARN comp_stmnt_lbrace declaration_list expr_stmnt_list {
+		blklev--;
+		mblklev--;
+		initsym = mktempsym(duptyp($4->tn_type));
+		mblklev++;
+		blklev++;
+		gnuism(320);
+	} comp_stmnt_rbrace T_RPARN {
+		$$ = getnnode(initsym, 0);
+	}
+	| T_LPARN comp_stmnt_lbrace expr_stmnt_list {
+		blklev--;
+		mblklev--;
+		initsym = mktempsym($3->tn_type);
+		mblklev++;
+		blklev++;
+		gnuism(320);
+	} comp_stmnt_rbrace T_RPARN {
+		$$ = getnnode(initsym, 0);
+	}
 	| term T_INCDEC {
 		$$ = build($2 == INC ? INCAFT : DECAFT, $1, NULL);
 	  }
@@ -1580,6 +1676,14 @@ term:
 	| T_LPARN type_name T_RPARN term		%prec T_UNOP {
 		$$ = cast($4, $2);
 	  }
+	| T_LPARN type_name T_RPARN 			%prec T_UNOP {
+		sym_t *tmp = mktempsym($2);
+		idecl(tmp, 1, NULL);
+	  } init_lbrace init_expr_list init_rbrace {
+		if (!Sflag)
+			gnuism(319);
+		$$ = getnnode(initsym, 0);
+	  }
 	;
 
 string:
@@ -1620,6 +1724,13 @@ point_or_arrow:
 	  }
 	;
 
+point:
+	  T_STROP {
+		if ($1 != POINT)
+			error(249);
+	  }
+	;
+
 identifier:
 	  T_NAME {
 		$$ = $1;
@@ -1635,7 +1746,6 @@ identifier:
 int
 yyerror(char *msg)
 {
-
 	error(249);
 	if (++sytxerr >= 5)
 		norecover();
@@ -1670,13 +1780,13 @@ q_gt(int64_t a, int64_t b)
  * expressions, it frees the memory used for the expression.
  */
 static int
-toicon(tnode_t *tn)
+toicon(tnode_t *tn, int required)
 {
 	int	i;
 	tspec_t	t;
 	val_t	*v;
 
-	v = constant(tn);
+	v = constant(tn, required);
 
 	/*
 	 * Abstract declarations are used inside expression. To free
@@ -1721,7 +1831,7 @@ idecl(sym_t *decl, int initflg, sbuf_t *
 	case EXTERN:
 		if (rename != NULL) {
 			if (decl->s_rename != NULL)
-				lerror("idecl() 1");
+				LERROR("idecl()");
 
 			s = getlblk(1, rename->sb_len + 1);
 	                (void)memcpy(s, rename->sb_name, rename->sb_len + 1);
@@ -1749,7 +1859,7 @@ idecl(sym_t *decl, int initflg, sbuf_t *
 		decl1loc(decl, initflg);
 		break;
 	default:
-		lerror("idecl() 2");
+		LERROR("idecl()");
 	}
 
 	if (initflg && !initerr)

Modified: stable/10/usr.bin/xlint/lint1/decl.c
==============================================================================
--- stable/10/usr.bin/xlint/lint1/decl.c	Mon Apr  6 19:26:45 2015	(r281167)
+++ stable/10/usr.bin/xlint/lint1/decl.c	Mon Apr  6 19:56:27 2015	(r281168)
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.29 2002/01/18 21:01:39 thorpej Exp $ */
+/* $NetBSD: decl.c,v 1.33 2004/06/20 22:20:16 jmc Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.29 2002/01/18 21:01:39 thorpej Exp $");
+__RCSID("$NetBSD: decl.c,v 1.33 2004/06/20 22:20:16 jmc Exp $");
 #endif
 __FBSDID("$FreeBSD$");
 
@@ -197,7 +197,7 @@ setcompl(type_t *tp, int ic)
 		tp->t_str->sincompl = ic;
 	} else {
 		if (t != ENUM)
-			lerror("setcompl() 1");
+			LERROR("setcompl()");
 		tp->t_enum->eincompl = ic;
 	}
 }
@@ -256,7 +256,7 @@ addtype(type_t *tp)
 			 * something like "typedef int a; int a b;"
 			 * This should not happen with current grammar.
 			 */
-			lerror("addtype()");
+			LERROR("addtype()");
 		}
 		dcs->d_type = tp;
 		return;
@@ -297,7 +297,7 @@ addtype(type_t *tp)
 		dcs->d_lmod = NOTSPEC;
 		if (!quadflg)
 			/* %s C does not support 'long long' */
-			(void)gnuism(265, tflag ? "traditional" : "ANSI");
+			(void)c99ism(265, tflag ? "traditional" : "c89");
 	}
 
 	if (dcs->d_type != NULL && dcs->d_type->t_typedef) {
@@ -466,7 +466,7 @@ addqual(tqual_t q)
 		dcs->d_const = 1;
 	} else {
 		if (q != VOLATILE)
-			lerror("addqual() 1");
+			LERROR("addqual()");
 		if (dcs->d_volatile) {
 			/* duplicate "%s" */
 			warning(10, "volatile");
@@ -508,13 +508,13 @@ popdecl(void)
 		(void)printf("popdecl(%d)\n", (int)dcs->d_ctx);
 
 	if (dcs->d_nxt == NULL)
-		lerror("popdecl() 1");
+		LERROR("popdecl()");
 	di = dcs;
 	dcs = di->d_nxt;
 	switch (di->d_ctx) {
 	case EXTERN:
 		/* there is nothing after external declarations */
-		lerror("popdecl() 2");
+		LERROR("popdecl()");
 		/* NOTREACHED */
 	case MOS:
 	case MOU:
@@ -562,7 +562,7 @@ popdecl(void)
 		rmsyms(di->d_dlsyms);
 		break;
 	default:
-		lerror("popdecl() 3");
+		LERROR("popdecl()");
 	}
 	free(di);
 }
@@ -635,7 +635,7 @@ deftyp(void)
 
 	if (tp != NULL && (t != NOTSPEC || s != NOTSPEC || l != NOTSPEC)) {
 		/* should never happen */
-		lerror("deftyp() 1");
+		LERROR("deftyp()");
 	}
 
 	if (tp == NULL) {
@@ -674,7 +674,7 @@ deftyp(void)
 		case VOID:
 			break;
 		default:
-			lerror("deftyp() 2");
+			LERROR("deftyp()");
 		}
 		if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {
 			dcs->d_terr = 1;
@@ -712,13 +712,13 @@ deftyp(void)
 
 	if (dcs->d_const && dcs->d_type->t_const) {
 		if (!dcs->d_type->t_typedef)
-			lerror("deftyp() 3");
+			LERROR("deftyp()");
 		/* typedef already qualified with "%s" */
 		warning(68, "const");
 	}
 	if (dcs->d_volatile && dcs->d_type->t_volatile) {
 		if (!dcs->d_type->t_typedef)
-			lerror("deftyp() 4");
+			LERROR("deftyp()");
 		/* typedef already qualified with "%s" */
 		warning(68, "volatile");
 	}
@@ -777,7 +777,7 @@ length(type_t *tp, const char *name)
 	switch (tp->t_tspec) {
 	case FUNC:
 		/* compiler takes size of function */
-		lerror("%s", msgs[12]);
+		LERROR("%s", msgs[12]);
 		/* NOTREACHED */
 	case STRUCT:
 	case UNION:
@@ -796,7 +796,7 @@ length(type_t *tp, const char *name)
 	default:
 		elsz = size(tp->t_tspec);
 		if (elsz <= 0)
-			lerror("length()");
+			LERROR("length()");
 		break;
 	}
 	return (elem * elsz);
@@ -831,7 +831,7 @@ getbound(type_t *tp)
 		}
 	}
 	if (a < CHAR_BIT || a > LINT_ALIGN(1) * CHAR_BIT)
-		lerror("getbound() 1");
+		LERROR("getbound()");
 	return (a);
 }
 
@@ -925,7 +925,7 @@ chktyp(sym_t *sym)
 			if (dcs->d_ctx == PARG) {
 				if (sym->s_scl != ABSTRACT) {
 					if (sym->s_name == unnamed)
-						lerror("chktyp()");
+						LERROR("chktyp()");
 					/* void param cannot have name: %s */
 					error(61, sym->s_name);
 					*tpp = gettyp(INT);
@@ -963,12 +963,12 @@ decl1str(sym_t *dsym)
 	scl_t	sc;
 
 	if ((sc = dsym->s_scl) != MOS && sc != MOU)
-		lerror("decl1str() 1");
+		LERROR("decl1str()");
 
 	if (dcs->d_rdcsym != NULL) {
 		if ((sc = dcs->d_rdcsym->s_scl) != MOS && sc != MOU)
 			/* should be ensured by storesym() */
-			lerror("decl1str() 2");
+			LERROR("decl1str()");
 		if (dsym->s_styp == dcs->d_rdcsym->s_styp) {
 			/* duplicate member name: %s */
 			error(33, dsym->s_name);
@@ -991,11 +991,13 @@ decl1str(sym_t *dsym)
 		    t == SHORT || t == USHORT || t == ENUM) {
 			if (bitfieldtype_ok == 0) {
 				if (sflag) {
+					char buf[64];
 					/*
 					 * bit-field type '%s' invalid in
 					 * ANSI C
 					 */
-					warning(273, tyname(tp));
+					warning(273,
+					    tyname(buf, sizeof(buf), tp));
 				} else if (pflag) {
 					/* nonportable bit-field type */
 					warning(34);
@@ -1051,7 +1053,7 @@ decl1str(sym_t *dsym)
 	if ((sz = length(dsym->s_type, dsym->s_name)) == 0) {
 		if (t == ARRAY && dsym->s_type->t_dim == 0) {
 			/* illegal zero sized structure member: %s */
-			warning(39, dsym->s_name);
+			c99ism(39, dsym->s_name);
 		}
 	}
 
@@ -1221,12 +1223,12 @@ addarray(sym_t *decl, int dim, int n)
 	tp->t_dim = n;
 
 	if (n < 0) {
-		/* zero or negative array dimension */
-		error(20);
+		/* negative array dimension */
+		error(20, n);
 		n = 0;
 	} else if (n == 0 && dim) {
-		/* zero or negative array dimension */
-		warning(20);
+		/* zero array dimension */
+		c99ism(322, dim);
 	} else if (n == 0 && !dim) {
 		/* is incomplete type */
 		setcompl(tp, 1);
@@ -1417,7 +1419,7 @@ dname(sym_t *sym)
 		} else if (sc == EXTERN) {
 			sym->s_def = DECL;
 		} else {
-			lerror("dname() 1");
+			LERROR("dname()");
 		}
 		break;
 	case PARG:
@@ -1430,7 +1432,7 @@ dname(sym_t *sym)
 			sym->s_reg = 1;
 			sc = AUTO;
 		} else {
-			lerror("dname() 2");
+			LERROR("dname()");
 		}
 		sym->s_def = DEF;
 		break;
@@ -1453,11 +1455,11 @@ dname(sym_t *sym)
 		} else if (sc == EXTERN) {
 			sym->s_def = DECL;
 		} else {
-			lerror("dname() 3");
+			LERROR("dname()");
 		}
 		break;
 	default:
-		lerror("dname() 4");
+		LERROR("dname()");
 	}
 	sym->s_scl = sc;
 
@@ -1481,7 +1483,7 @@ iname(sym_t *sym)
 			/* redeclaration of formal parameter %s */
 			error(21, sym->s_name);
 			if (!sym->s_defarg)
-				lerror("iname()");
+				LERROR("iname()");
 		}
 		sym = pushdown(sym);
 	}
@@ -1514,7 +1516,7 @@ mktag(sym_t *tag, tspec_t kind, int decl
 	} else if (kind == ENUM) {
 		scl = ENUMTAG;
 	} else {
-		lerror("mktag()");
+		LERROR("mktag()");
 	}
 
 	if (tag != NULL) {
@@ -1636,7 +1638,7 @@ scltoa(scl_t sc)
 	case STRTAG:	s = "struct";	break;
 	case UNIONTAG:	s = "union";	break;
 	case ENUMTAG:	s = "enum";	break;
-	default:	lerror("tagttoa()");
+	default:	LERROR("tagttoa()");
 	}
 	return (s);
 }
@@ -1664,7 +1666,7 @@ compltag(type_t *tp, sym_t *fmem)
 		sp->memb = fmem;
 		if (sp->size == 0) {
 			/* zero sized %s */
-			(void)gnuism(47, ttab[t].tt_name);
+			(void)c99ism(47, ttab[t].tt_name);
 		} else {
 			n = 0;
 			for (mem = fmem; mem != NULL; mem = mem->s_nxt) {
@@ -2143,7 +2145,7 @@ compltyp(sym_t *dsym, sym_t *ssym)
 
 	while ((dst = *dstp) != NULL) {
 		if (src == NULL || dst->t_tspec != src->t_tspec)
-			lerror("compltyp() 1");
+			LERROR("compltyp()");
 		if (dst->t_tspec == ARRAY) {
 			if (dst->t_dim == 0 && src->t_dim != 0) {
 				*dstp = dst = duptyp(dst);
@@ -2472,7 +2474,7 @@ decl1loc(sym_t *dsym, int initflg)
 				 */
 				break;
 			default:
-				lerror("decl1loc() 1");
+				LERROR("decl1loc()");
 			}
 
 		} else if (dcs->d_rdcsym->s_blklev == blklev) {
@@ -2621,7 +2623,7 @@ aname(void)
 	sym_t	*sym;
 
 	if (dcs->d_ctx != ABSTRACT && dcs->d_ctx != PARG)
-		lerror("aname()");
+		LERROR("aname()");
 
 	sym = getblk(sizeof (sym_t));
 
@@ -2791,7 +2793,7 @@ chkausg(int novar, sym_t *arg)
 {
 
 	if (!arg->s_set)
-		lerror("chkausg() 1");
+		LERROR("chkausg()");
 
 	if (novar)
 		return;
@@ -2810,7 +2812,7 @@ chkvusg(int novar, sym_t *sym)
 	sym_t	*xsym;
 
 	if (blklev == 0 || sym->s_blklev == 0)
-		lerror("chkvusg() 1");
+		LERROR("chkvusg()");
 
 	/* errors in expressions easily cause lots of these warnings */
 	if (nerr != 0)
@@ -2875,7 +2877,7 @@ chklusg(sym_t *lab)
 {
 
 	if (blklev != 1 || lab->s_blklev != 1)
-		lerror("chklusg() 1");
+		LERROR("chklusg()");
 
 	if (lab->s_set && !lab->s_used) {
 		STRUCT_ASSIGN(curr_pos, lab->s_spos);
@@ -2914,7 +2916,7 @@ chktusg(sym_t *sym)
 		warning(235, sym->s_name);
 		break;
 	default:
-		lerror("chktusg() 1");
+		LERROR("chktusg()");
 	}
 }
 
@@ -2946,7 +2948,7 @@ chkglsyms(void)
 			chktusg(sym);
 		} else {
 			if (sym->s_kind != FMOS)
-				lerror("chkglsyms() 1");
+				LERROR("chkglsyms()");
 		}
 	}
 
@@ -2961,7 +2963,7 @@ chkglvar(sym_t *sym)
 		return;
 
 	if (sym->s_scl != EXTERN && sym->s_scl != STATIC)
-		lerror("chkglvar() 1");
+		LERROR("chkglvar()");
 
 	glchksz(sym);
 

Modified: stable/10/usr.bin/xlint/lint1/emit1.c
==============================================================================
--- stable/10/usr.bin/xlint/lint1/emit1.c	Mon Apr  6 19:26:45 2015	(r281167)
+++ stable/10/usr.bin/xlint/lint1/emit1.c	Mon Apr  6 19:56:27 2015	(r281168)
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.11 2002/01/31 19:36:54 tv Exp $ */
+/* $NetBSD: emit1.c,v 1.14 2004/06/20 22:20:16 jmc Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit1.c,v 1.11 2002/01/31 19:36:54 tv Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.14 2004/06/20 22:20:16 jmc Exp $");
 #endif
 __FBSDID("$FreeBSD$");
 
@@ -117,7 +117,7 @@ outtype(type_t *tp)
 		case STRUCT:	t = 'T';	s = 's';	break;
 		case UNION:	t = 'T';	s = 'u';	break;
 		default:
-			lerror("outtyp() 1");
+			LERROR("outtyp()");
 		}
 		if (tp->t_const)
 			outchar('c');
@@ -257,7 +257,7 @@ outsym(sym_t *sym, scl_t sc, def_t def)
 		outchar('e');
 		break;
 	default:
-		lerror("outsym() 2");
+		LERROR("outsym()");
 	}
 	if (llibflg && def != DECL) {
 		/*
@@ -485,7 +485,7 @@ outfstrg(strg_t *strg)
 	u_char	*cp;
 
 	if (strg->st_tspec != CHAR)
-		lerror("outfstrg() 1");
+		LERROR("outfstrg()");
 
 	cp = strg->st_cp;
 

Modified: stable/10/usr.bin/xlint/lint1/err.c
==============================================================================
--- stable/10/usr.bin/xlint/lint1/err.c	Mon Apr  6 19:26:45 2015	(r281167)
+++ stable/10/usr.bin/xlint/lint1/err.c	Mon Apr  6 19:56:27 2015	(r281168)
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.17 2002/01/31 19:36:54 tv Exp $	*/
+/*	$NetBSD: err.c,v 1.40 2009/04/15 01:20:57 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.17 2002/01/31 19:36:54 tv Exp $");
+__RCSID("$NetBSD: err.c,v 1.40 2009/04/15 01:20:57 christos Exp $");
 #endif
 __FBSDID("$FreeBSD$");
 
@@ -76,7 +76,7 @@ const	char *msgs[] = {
 	"null dimension",					      /* 17 */
 	"illegal use of 'void'",				      /* 18 */
 	"void type for %s",					      /* 19 */
-	"zero or negative array dimension",			      /* 20 */
+	"negative array dimension (%d)",			      /* 20 */
 	"redeclaration of formal parameter %s",			      /* 21 */
 	"incomplete or misplaced function definition",		      /* 22 */
 	"undefined label %s",					      /* 23 */
@@ -95,7 +95,7 @@ const	char *msgs[] = {
 	"illegal bit-field size",				      /* 36 */
 	"zero size bit-field",					      /* 37 */
 	"function illegal in structure or union",		      /* 38 */
-	"illegal zero sized structure member: %s",		      /* 39 */
+	"zero sized array in struct is a C99 extension: %s",	      /* 39 */
 	"unknown size: %s",					      /* 40 */
 	"illegal use of bit-field",				      /* 41 */
 	"forward reference to enum type",			      /* 42 */
@@ -103,7 +103,7 @@ const	char *msgs[] = {
 	"declaration introduces new type in ANSI C: %s %s",	      /* 44 */
 	"base type is really '%s %s'",				      /* 45 */
 	"(%s) tag redeclared",					      /* 46 */
-	"zero sized %s",					      /* 47 */
+	"zero sized %s is a C9X feature",			      /* 47 */
 	"overflow in enumeration values: %s",			      /* 48 */
 	"struct or union member must be named",			      /* 49 */
 	"a function is declared as an argument: %s",		      /* 50 */
@@ -188,7 +188,7 @@ const	char *msgs[] = {
 	"expression has null effect",				      /* 129 */
 	"enum type mismatch, op %s",				      /* 130 */
 	"conversion to '%s' may sign-extend incorrectly",	      /* 131 */
-	"conversion from '%s' may lose accuracy",		      /* 132 */
+	"conversion from '%s' to '%s' may lose accuracy",	      /* 132 */
 	"conversion of pointer to '%s' loses bits",		      /* 133 */
 	"conversion of pointer to '%s' may lose bits",		      /* 134 */
 	"possible pointer alignment problem",			      /* 135 */
@@ -232,7 +232,7 @@ const	char *msgs[] = {
 	"too many array initializers",				      /* 173 */
 	"too many initializers",				      /* 174 */
 	"initialisation of an incomplete type",			      /* 175 */
-	"invalid initializer",					      /* 176 */
+	"invalid initializer type %s",				      /* 176 */
 	"non-constant initializer",				      /* 177 */
 	"initializer does not fit",				      /* 178 */
 	"cannot initialize struct/union with no named member",	      /* 179 */
@@ -354,7 +354,7 @@ const	char *msgs[] = {
 	"conversion of '%s' to '%s' is out of range, arg #%d",	      /* 295 */
 	"conversion of negative constant to unsigned type, arg #%d",  /* 296 */
 	"conversion to '%s' may sign-extend incorrectly, arg #%d",    /* 297 */
-	"conversion from '%s' may lose accuracy, arg #%d",	      /* 298 */
+	"conversion from '%s' to '%s' may lose accuracy, arg #%d",    /* 298 */
 	"prototype does not match old style definition, arg #%d",     /* 299 */
 	"old style definition",					      /* 300 */
 	"array of incomplete type",				      /* 301 */
@@ -369,6 +369,16 @@ const	char *msgs[] = {
 	"symbol renaming can't be used on function arguments",	      /* 310 */
 	"symbol renaming can't be used on automatic variables",	      /* 311 */
 	"%s C does not support // comments",			      /* 312 */
+	"struct or union member name in initializer is a C9X feature",/* 313 */
+	"%s is not a structure or a union",			      /* 314 */
+	"GCC style struct or union member name in initializer",	      /* 315 */
+	"__FUNCTION__ is a GCC extension",			      /* 316 */
+	"__func__ is a C9X feature",				      /* 317 */
+	"variable array dimension is a C99/GCC extension",	      /* 318 */
+	"compound literals are a C9X/GCC extension",		      /* 319 */
+	"({ }) is a GCC extension",				      /* 320 */
+	"array initializer with designators is a C9X feature",	      /* 321 */
+	"zero sized array is a C99 extension",			      /* 322 */
 };
 
 /*
@@ -377,10 +387,10 @@ const	char *msgs[] = {
 void
 msglist(void)
 {
-	int i;
+	size_t i;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504061956.t36JuSEx029266>