Module Name:    src
Committed By:   tls
Date:           Sun Aug 10 06:59:20 UTC 2014

Modified Files:
        src/usr.bin/xlint/common [tls-earlyentropy]: emit.c externs.h
        src/usr.bin/xlint/lint1 [tls-earlyentropy]: cgram.y decl.c externs1.h
            init.c lint1.h main1.c mem1.c scan.l tree.c

Log Message:
Rebase.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.22.1 src/usr.bin/xlint/common/emit.c
cvs rdiff -u -r1.4 -r1.4.62.1 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.59 -r1.59.2.1 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.58 -r1.58.2.1 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.31 -r1.31.4.1 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.24 -r1.24.22.1 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.27 -r1.27.4.1 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.21 -r1.21.4.1 src/usr.bin/xlint/lint1/main1.c
cvs rdiff -u -r1.15 -r1.15.18.1 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.54 -r1.54.2.1 src/usr.bin/xlint/lint1/scan.l
cvs rdiff -u -r1.75 -r1.75.2.1 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/emit.c
diff -u src/usr.bin/xlint/common/emit.c:1.5 src/usr.bin/xlint/common/emit.c:1.5.22.1
--- src/usr.bin/xlint/common/emit.c:1.5	Wed Apr 15 01:20:57 2009
+++ src/usr.bin/xlint/common/emit.c	Sun Aug 10 06:59:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: emit.c,v 1.5 2009/04/15 01:20:57 christos Exp $	*/
+/*	$NetBSD: emit.c,v 1.5.22.1 2014/08/10 06:59:20 tls Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit.c,v 1.5 2009/04/15 01:20:57 christos Exp $");
+__RCSID("$NetBSD: emit.c,v 1.5.22.1 2014/08/10 06:59:20 tls Exp $");
 #endif
 
 #include <ctype.h>
@@ -216,11 +216,11 @@ outint(int i)
  * the name is preceded by its length
  */
 void
-outname(const char *name)
+outname1(const char *file, size_t line, const char *name)
 {
 
 	if (name == NULL)
-		errx(1, "internal error: outname() 1");
+		errx(1, "%s, %zu: internal error: outname(NULL)", file, line);
 	outint((int)strlen(name));
 	outstrg(name);
 }

Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.4 src/usr.bin/xlint/common/externs.h:1.4.62.1
--- src/usr.bin/xlint/common/externs.h:1.4	Thu Apr  7 16:28:40 2005
+++ src/usr.bin/xlint/common/externs.h	Sun Aug 10 06:59:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.4 2005/04/07 16:28:40 christos Exp $	*/
+/*	$NetBSD: externs.h,v 1.4.62.1 2014/08/10 06:59:20 tls Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -69,5 +69,6 @@ extern	void	outchar(int);
 extern	void	outqchar(int);
 extern	void	outstrg(const char *);
 extern	void	outint(int);
-extern	void	outname(const char *);
+#define outname(a)	outname1(__FILE__, __LINE__, a);
+extern	void	outname1(const char *, size_t, const char *);
 extern	void	outsrc(const char *);

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.59 src/usr.bin/xlint/lint1/cgram.y:1.59.2.1
--- src/usr.bin/xlint/lint1/cgram.y:1.59	Sun Mar 23 04:58:16 2014
+++ src/usr.bin/xlint/lint1/cgram.y	Sun Aug 10 06:59:20 2014
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.59 2014/03/23 04:58:16 dholland Exp $ */
+/* $NetBSD: cgram.y,v 1.59.2.1 2014/08/10 06:59:20 tls 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.59 2014/03/23 04:58:16 dholland Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.59.2.1 2014/08/10 06:59:20 tls Exp $");
 #endif
 
 #include <stdlib.h>
@@ -107,7 +107,7 @@ static inline void RESTORE(const char *f
 #endif
 %}
 
-%expect 5
+%expect 75
 
 %union {
 	int	y_int;
@@ -189,13 +189,21 @@ static inline void RESTORE(const char *f
 %token <y_type>		T_ATTRIBUTE
 %token <y_type>		T_AT_ALIGNED
 %token <y_type>		T_AT_DEPRECATED
+%token <y_type>		T_AT_NORETURN
 %token <y_type>		T_AT_MAY_ALIAS
 %token <y_type>		T_AT_PACKED
+%token <y_type>		T_AT_PURE
 %token <y_type>		T_AT_TUINION
 %token <y_type>		T_AT_TUNION
 %token <y_type>		T_AT_UNUSED
-
-
+%token <y_type>		T_AT_FORMAT
+%token <y_type>		T_AT_FORMAT_PRINTF
+%token <y_type>		T_AT_FORMAT_SCANF
+%token <y_type>		T_AT_FORMAT_STRFTIME
+%token <y_type>		T_AT_FORMAT_ARG
+%token <y_type>		T_AT_SENTINEL
+%token <y_type>		T_AT_RETURNS_TWICE
+%token <y_type>		T_AT_COLD
 
 %left	T_COMMA
 %right	T_ASSIGN T_OPASS
@@ -470,19 +478,41 @@ declaration:
 	| error T_SEMI
 	;
 
+type_attribute_format_type:
+	  T_AT_FORMAT_PRINTF
+	| T_AT_FORMAT_SCANF
+	| T_AT_FORMAT_STRFTIME
+	;
+
 type_attribute_spec:
 	  T_AT_DEPRECATED
 	| T_AT_ALIGNED T_LPARN constant T_RPARN
+	| T_AT_SENTINEL T_LPARN constant T_RPARN
+	| T_AT_FORMAT_ARG T_LPARN constant T_RPARN
 	| T_AT_MAY_ALIAS
+	| T_AT_NORETURN
+	| T_AT_COLD
+	| T_AT_RETURNS_TWICE
 	| T_AT_PACKED {
 		addpacked();
 	}
+	| T_AT_PURE
 	| T_AT_TUNION
+	| T_AT_FORMAT T_LPARN type_attribute_format_type T_COMMA
+	    constant T_COMMA constant T_RPARN
 	| T_AT_UNUSED
+	| T_QUAL {
+		if ($1 != CONST)	
+			yyerror("Bad attribute");
+	}
 	;
 
 type_attribute:
-	  T_ATTRIBUTE T_LPARN T_LPARN type_attribute_spec T_RPARN T_RPARN
+	  T_ATTRIBUTE T_LPARN T_LPARN {
+	    attron = 1;
+	} type_attribute_spec {
+	    attron = 0;
+	} T_RPARN T_RPARN
 	| T_PACKED {
 		addpacked();
 	}
@@ -507,6 +537,7 @@ declspecs:
 	| declmods typespec {
 		addtype($2);
 	  }
+	| type_attribute declspecs
 	| declspecs type_attribute
 	| declspecs declmod
 	| declspecs notype_typespec {
@@ -555,8 +586,8 @@ notype_typespec:
 	  T_TYPE {
 		$$ = gettyp($1);
 	  }
-	| T_TYPEOF T_LPARN term T_RPARN {
-		$$ = $3->tn_type;
+	| T_TYPEOF term {
+		$$ = $2->tn_type;
 	  }
 	| struct_spec {
 		popdecl();
@@ -686,6 +717,7 @@ noclass_declspecs:
 	  clrtyp_typespec {
 		addtype($1);
 	  }
+	| type_attribute noclass_declspecs
 	| noclass_declmods typespec {
 		addtype($2);
 	  }
@@ -897,13 +929,16 @@ notype_direct_decl:
 	| T_LPARN type_decl T_RPARN {
 		$$ = $2;
 	  }
+	| type_attribute notype_direct_decl {
+		$$ = $2;
+	}
 	| notype_direct_decl T_LBRACK T_RBRACK {
 		$$ = addarray($1, 0, 0);
 	  }
 	| notype_direct_decl T_LBRACK constant T_RBRACK {
 		$$ = addarray($1, 1, toicon($3, 0));
 	  }
-	| notype_direct_decl param_list {
+	| notype_direct_decl param_list opt_asm_or_symbolrename {
 		$$ = addfunc($1, $2);
 		popdecl();
 		blklev--;
@@ -927,13 +962,16 @@ type_direct_decl:
 	| T_LPARN type_decl T_RPARN {
 		$$ = $2;
 	  }
+	| type_attribute type_direct_decl {
+		$$ = $2;
+	}
 	| type_direct_decl T_LBRACK T_RBRACK {
 		$$ = addarray($1, 0, 0);
 	  }
 	| type_direct_decl T_LBRACK constant T_RBRACK {
 		$$ = addarray($1, 1, toicon($3, 0));
 	  }
-	| type_direct_decl param_list {
+	| type_direct_decl param_list opt_asm_or_symbolrename {
 		$$ = addfunc($1, $2);
 		popdecl();
 		blklev--;
@@ -970,7 +1008,7 @@ direct_param_decl:
 	| direct_param_decl T_LBRACK constant T_RBRACK {
 		$$ = addarray($1, 1, toicon($3, 0));
 	  }
-	| direct_param_decl param_list {
+	| direct_param_decl param_list opt_asm_or_symbolrename {
 		$$ = addfunc($1, $2);
 		popdecl();
 		blklev--;
@@ -999,7 +1037,7 @@ direct_notype_param_decl:
 	| direct_notype_param_decl T_LBRACK constant T_RBRACK {
 		$$ = addarray($1, 1, toicon($3, 0));
 	  }
-	| direct_notype_param_decl param_list {
+	| direct_notype_param_decl param_list opt_asm_or_symbolrename {
 		$$ = addfunc($1, $2);
 		popdecl();
 		blklev--;
@@ -1277,18 +1315,21 @@ direct_abs_decl:
 	| T_LBRACK constant T_RBRACK {
 		$$ = addarray(aname(), 1, toicon($2, 0));
 	  }
+	| type_attribute direct_abs_decl {
+		$$ = $2;
+	}
 	| direct_abs_decl T_LBRACK T_RBRACK {
 		$$ = addarray($1, 0, 0);
 	  }
 	| direct_abs_decl T_LBRACK constant T_RBRACK {
 		$$ = addarray($1, 1, toicon($3, 0));
 	  }
-	| abs_decl_param_list {
+	| abs_decl_param_list opt_asm_or_symbolrename {
 		$$ = addfunc(aname(), $1);
 		popdecl();
 		blklev--;
 	  }
-	| direct_abs_decl abs_decl_param_list {
+	| direct_abs_decl abs_decl_param_list opt_asm_or_symbolrename {
 		$$ = addfunc($1, $2);
 		popdecl();
 		blklev--;
@@ -1731,15 +1772,15 @@ term:
 	| T_IMAG term {
 		$$ = build(IMAG, $2, NULL);
 	  }
+	| T_EXTENSION term {
+		$$ = $2;
+	  }
 	| T_REAL T_LPARN term T_RPARN {
 		$$ = build(REAL, $3, NULL);
 	  }
 	| T_IMAG T_LPARN term T_RPARN {
 		$$ = build(IMAG, $3, NULL);
 	  }
-	| T_EXTENSION T_LPARN term T_RPARN {
-		$$ = $3;
-	  }
 	| T_SIZEOF term					%prec T_SIZEOF {
 		if (($$ = $2 == NULL ? NULL : bldszof($2->tn_type)) != NULL)
 			chkmisc($2, 0, 0, 0, 0, 0, 1);

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.58 src/usr.bin/xlint/lint1/decl.c:1.58.2.1
--- src/usr.bin/xlint/lint1/decl.c:1.58	Sun Dec 15 03:43:37 2013
+++ src/usr.bin/xlint/lint1/decl.c	Sun Aug 10 06:59:20 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.58 2013/12/15 03:43:37 christos Exp $ */
+/* $NetBSD: decl.c,v 1.58.2.1 2014/08/10 06:59:20 tls Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.58 2013/12/15 03:43:37 christos Exp $");
+__RCSID("$NetBSD: decl.c,v 1.58.2.1 2014/08/10 06:59:20 tls Exp $");
 #endif
 
 #include <sys/param.h>
@@ -757,6 +757,7 @@ deftyp(void)
 			break;
 		case DOUBLE:
 			if (l == LONG) {
+		case LDOUBLE:
 				l = NOTSPEC;
 				t = LDOUBLE;
 				if (tflag)
@@ -778,7 +779,7 @@ deftyp(void)
 		case LCOMPLEX:
 			break;
 		default:
-			LERROR("deftyp()");
+			LERROR("deftyp(%s)", basictyname(t));
 		}
 		if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {
 			dcs->d_terr = 1;

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.31 src/usr.bin/xlint/lint1/externs1.h:1.31.4.1
--- src/usr.bin/xlint/lint1/externs1.h:1.31	Fri Apr 19 17:43:05 2013
+++ src/usr.bin/xlint/lint1/externs1.h	Sun Aug 10 06:59:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.31 2013/04/19 17:43:05 christos Exp $	*/
+/*	$NetBSD: externs1.h,v 1.31.4.1 2014/08/10 06:59:20 tls Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -68,6 +68,7 @@ extern	int	yyparse(void);
 /*
  * scan.l
  */
+extern  int	attron;
 extern	pos_t	curr_pos;
 extern	pos_t	csrc_pos;
 extern	symt_t	symtyp;

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.24 src/usr.bin/xlint/lint1/init.c:1.24.22.1
--- src/usr.bin/xlint/lint1/init.c:1.24	Fri Oct  2 18:17:16 2009
+++ src/usr.bin/xlint/lint1/init.c	Sun Aug 10 06:59:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.24 2009/10/02 18:17:16 christos Exp $	*/
+/*	$NetBSD: init.c,v 1.24.22.1 2014/08/10 06:59:20 tls Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.24 2009/10/02 18:17:16 christos Exp $");
+__RCSID("$NetBSD: init.c,v 1.24.22.1 2014/08/10 06:59:20 tls Exp $");
 #endif
 
 #include <stdlib.h>
@@ -500,7 +500,7 @@ mkinit(tnode_t *tn)
 	DPRINTF(("mkinit(%s %s)\n", tyname(buf, sizeof(buf), tn->tn_type),
 	   prtnode(sbuf, sizeof(sbuf), tn)));
 	if (initerr || tn == NULL)
-		goto end;
+		return;
 
 	sc = initsym->s_scl;
 
@@ -521,8 +521,8 @@ mkinit(tnode_t *tn)
 		ln->tn_type = tduptyp(ln->tn_type);
 		ln->tn_type->t_const = 0;
 		tn = build(ASSIGN, ln, tn);
-		expr(tn, 0, 0, 1);
-		goto end;
+		expr(tn, 0, 0, 0);
+		return;
 	}
 
 	/*
@@ -533,11 +533,11 @@ mkinit(tnode_t *tn)
 
 	/* Initialisations by strings are done in strginit(). */
 	if (strginit(tn))
-		goto end;
+		return;
 
 	nextinit(0);
 	if (initerr || tn == NULL)
-		goto end;
+		return;
 
 	initstk->i_cnt--;
 	DPRINTF(("mkinit() cnt=%d tn=%p\n", initstk->i_cnt, tn));
@@ -558,7 +558,7 @@ mkinit(tnode_t *tn)
 		LERROR("mkinit()");
 
 	if (!typeok(INIT, 0, ln, tn))
-		goto end;
+		return;
 
 	/*
 	 * Store the tree memory. This is nessesary because otherwise
@@ -594,15 +594,6 @@ mkinit(tnode_t *tn)
 			}
 		}
 	}
-
- end:
-	/*
-	 * We only free the block, if we are not a compound declaration
-	 * We know that the only symbols that start with a digit are the
-	 * ones we allocate with mktempsym() for compound declarations
-	 */
-	if (!isdigit((unsigned char)initsym->s_name[0]))
-		tfreeblk();
 }
 
 

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.27 src/usr.bin/xlint/lint1/lint1.h:1.27.4.1
--- src/usr.bin/xlint/lint1/lint1.h:1.27	Fri Apr 19 17:43:05 2013
+++ src/usr.bin/xlint/lint1/lint1.h	Sun Aug 10 06:59:20 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.27 2013/04/19 17:43:05 christos Exp $ */
+/* $NetBSD: lint1.h,v 1.27.4.1 2014/08/10 06:59:20 tls Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -118,7 +118,7 @@ typedef struct {
  * 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
@@ -226,7 +226,7 @@ typedef	struct sym {
 	pos_t	s_spos;		/* position of first initialisation */
 	pos_t	s_upos;		/* position of first use */
 	symt_t	s_kind;		/* type of symbol */
-	u_int	s_keyw : 1;	/* keyword */
+	void   *s_keyw;		/* keyword */
 	u_int	s_field : 1;	/* bit-field */
 	u_int	s_set : 1;	/* variable set, label defined */
 	u_int	s_used : 1;	/* variable/label used */
@@ -436,4 +436,10 @@ typedef	struct err_set {
 
 #define LERROR(fmt, args...)	lerror(__FILE__, __LINE__, fmt, ##args)
 
+#ifdef BLKDEBUG
+#define ZERO	0xa5
+#else
+#define	ZERO	0
+#endif
+
 extern err_set	msgset;

Index: src/usr.bin/xlint/lint1/main1.c
diff -u src/usr.bin/xlint/lint1/main1.c:1.21 src/usr.bin/xlint/lint1/main1.c:1.21.4.1
--- src/usr.bin/xlint/lint1/main1.c:1.21	Fri Apr 19 17:43:05 2013
+++ src/usr.bin/xlint/lint1/main1.c	Sun Aug 10 06:59:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: main1.c,v 1.21 2013/04/19 17:43:05 christos Exp $	*/
+/*	$NetBSD: main1.c,v 1.21.4.1 2014/08/10 06:59:20 tls Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main1.c,v 1.21 2013/04/19 17:43:05 christos Exp $");
+__RCSID("$NetBSD: main1.c,v 1.21.4.1 2014/08/10 06:59:20 tls Exp $");
 #endif
 
 #include <sys/types.h>
@@ -128,7 +128,37 @@ sig_atomic_t fpe;
 
 static	void	usage(void);
 
-int main(int, char *[]);
+static const char builtins[] =
+    "int __builtin_isinf(long double);\n"
+    "int __builtin_isnan(long double);\n"
+    "int __builtin_copysign(long double, long double);\n"
+;
+static size_t builtinlen = sizeof(builtins) - 1;
+
+static FILE *
+bltin(void)
+{
+#if HAVE_NBTOOL_CONFIG_H
+	char template[] = "/tmp/lint.XXXXXX";
+	int fd;
+	FILE *fp;
+	if ((fd = mkstemp(template)) == -1)
+		return NULL;
+	(void)unlink(template);
+	if ((fp = fdopen(fd, "r+")) == NULL) {
+		close(fd);
+		return NULL;
+	}
+	if (fwrite(builtins, 1, builtinlen, fp) != builtinlen) {
+		fclose(fp);
+		return NULL;
+	}
+	rewind(fp);
+	return fp;
+#else
+	return fmemopen(__UNCONST(builtins), builtinlen, "r");
+#endif
+}
 
 /*ARGSUSED*/
 static void
@@ -203,9 +233,6 @@ main(int argc, char *argv[])
 	if (argc != 2)
 		usage();
 
-	/* open the input file */
-	if ((yyin = fopen(argv[0], "r")) == NULL)
-		err(1, "cannot open '%s'", argv[0]);
 
 	/* initialize output */
 	outopen(argv[1]);
@@ -219,7 +246,16 @@ main(int argc, char *argv[])
 	initscan();
 	initmtab();
 
+	if ((yyin = bltin()) == NULL)
+		err(1, "cannot open builtins");
+	yyparse();
+	fclose(yyin);
+
+	/* open the input file */
+	if ((yyin = fopen(argv[0], "r")) == NULL)
+		err(1, "cannot open '%s'", argv[0]);
 	yyparse();
+	fclose(yyin);
 
 	/* Following warnings cannot be suppressed by LINTED */
 	lwarn = LWARN_ALL;

Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.15 src/usr.bin/xlint/lint1/mem1.c:1.15.18.1
--- src/usr.bin/xlint/lint1/mem1.c:1.15	Fri Jun 24 01:10:31 2011
+++ src/usr.bin/xlint/lint1/mem1.c	Sun Aug 10 06:59:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.15 2011/06/24 01:10:31 christos Exp $	*/
+/*	$NetBSD: mem1.c,v 1.15.18.1 2014/08/10 06:59:20 tls Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.15 2011/06/24 01:10:31 christos Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.15.18.1 2014/08/10 06:59:20 tls Exp $");
 #endif
 
 #include <sys/types.h>
@@ -200,9 +200,11 @@ xgetblk(mbl_t **mbp, size_t s)
 				mblklen = s;
 			}
 			mb = xnewblk();
+#ifndef BLKDEBUG
+			(void)memset(mb->blk, 0, mb->size);
+#endif
 			if (t)
 				mblklen = t;
-			(void)memset(mb->blk, 0, mb->size);
 		} else {
 			frmblks = mb->nxt;
 		}
@@ -214,6 +216,9 @@ xgetblk(mbl_t **mbp, size_t s)
 	p = mb->ffree;
 	mb->ffree = (char *)mb->ffree + s;
 	mb->nfree -= s;
+#ifdef BLKDEBUG
+	(void)memset(p, 0, s);
+#endif
 	return (p);
 }
 
@@ -230,7 +235,7 @@ xfreeblk(mbl_t **fmbp)
 		*fmbp = mb->nxt;
 		mb->nxt = frmblks;
 		frmblks = mb;
-		(void)memset(mb->blk, 0, mb->size - mb->nfree);
+		(void)memset(mb->blk, ZERO, mb->size - mb->nfree);
 	}
 }
 

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.54 src/usr.bin/xlint/lint1/scan.l:1.54.2.1
--- src/usr.bin/xlint/lint1/scan.l:1.54	Tue Feb 18 22:01:36 2014
+++ src/usr.bin/xlint/lint1/scan.l	Sun Aug 10 06:59:20 2014
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.54 2014/02/18 22:01:36 christos Exp $ */
+/* $NetBSD: scan.l,v 1.54.2.1 2014/08/10 06:59:20 tls 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: scan.l,v 1.54 2014/02/18 22:01:36 christos Exp $");
+__RCSID("$NetBSD: scan.l,v 1.54.2.1 2014/08/10 06:59:20 tls Exp $");
 #endif
 
 #include <stdlib.h>
@@ -60,6 +60,9 @@ pos_t	curr_pos = { 1, "", 0 };
  */
 pos_t	csrc_pos = { 1, "", 0 };
 
+/* Are we parsing a gcc attribute? */
+int attron;
+
 static	void	incline(void);
 static	void	badchar(int);
 static	sbuf_t	*allocsb(void);
@@ -193,81 +196,103 @@ static	struct	kwtab {
 	scl_t	kw_scl;		/* storage class if kw_token T_SCLASS */
 	tspec_t	kw_tspec;	/* type spec. if kw_token T_TYPE or T_SOU */
 	tqual_t	kw_tqual;	/* type qual. fi kw_token T_QUAL */
-	u_int	kw_c89;		/* c89 keyword */
-	u_int	kw_c99;		/* c99 keyword */
-	u_int	kw_gcc;		/* GCC keyword */
+	u_int	kw_c89 : 1;	/* c89 keyword */
+	u_int	kw_c99 : 1;	/* c99 keyword */
+	u_int	kw_gcc : 1;	/* GCC keyword */
+	u_int	kw_attr : 1;	/* GCC attribute, keyword */
 } kwtab[] = {
-	{ "__alignof__", T_ALIGNOF,	0,	0,	0,	  0, 0, 0 },
-	{ "__attribute__",T_ATTRIBUTE,	0,	0,	0,	  0, 0, 1 },
-	{ "attribute",	T_ATTRIBUTE,	0,	0,	0,	  0, 0, 1 },
-	{ "__packed__",	T_AT_PACKED,	0,	0,	0,	  0, 0, 1 },
-	{ "packed",	T_AT_PACKED,	0,	0,	0,	  0, 0, 1 },
-	{ "__aligned__",T_AT_ALIGNED,	0,	0,	0,	  0, 0, 1 },
-	{ "aligned",	T_AT_ALIGNED,	0,	0,	0,	  0, 0, 1 },
-	{ "__transparent_union__",T_AT_TUNION,0,0,	0,	  0, 0, 1 },
-	{ "transparent_union",T_AT_TUNION,0,	0,	0,	  0, 0, 1 },
-	{ "__unused__",	T_AT_UNUSED,	0,	0,	0,	  0, 0, 1 },
-	{ "unused",	T_AT_UNUSED,	0,	0,	0,	  0, 0, 1 },
-	{ "__deprecated__",T_AT_DEPRECATED,0,	0,	0,	  0, 0, 1 },
-	{ "deprecated",	T_AT_DEPRECATED,0,	0,	0,	  0, 0, 1 },
-	{ "__may_alias__",T_AT_MAY_ALIAS,0,	0,	0,	  0, 0, 1 },
-	{ "may_alias",	T_AT_MAY_ALIAS,	0,	0,	0,	  0, 0, 1 },
-	{ "asm",	T_ASM,		0,	0,	0,	  0, 0, 1 },
-	{ "__asm",	T_ASM,		0,	0,	0,	  0, 0, 0 },
-	{ "__asm__",	T_ASM,		0,	0,	0,	  0, 0, 0 },
-	{ "auto",	T_SCLASS,	AUTO,	0,	0,	  0, 0, 0 },
-	{ "break",	T_BREAK,	0,	0,	0,	  0, 0, 0 },
-	{ "_Bool",	T_TYPE,		0,	BOOL,	0,	  0, 1, 0 },
-	{ "case",	T_CASE,		0,	0,	0,	  0, 0, 0 },
-	{ "char",	T_TYPE,		0,	CHAR,	0,	  0, 0, 0 },
-	{ "const",	T_QUAL,		0,	0,	CONST,	  1, 0, 0 },
-	{ "_Complex",	T_TYPE,		0,	COMPLEX,0,	  0, 1, 0 },
-	{ "__const__",	T_QUAL,		0,	0,	CONST,	  0, 0, 0 },
-	{ "__const",	T_QUAL,		0,	0,	CONST,	  0, 0, 0 },
-	{ "continue",	T_CONTINUE,	0,	0,	0,	  0, 0, 0 },
-	{ "default",	T_DEFAULT,	0,	0,	0,	  0, 0, 0 },
-	{ "do",		T_DO,		0,	0,	0,	  0, 0, 0 },
-	{ "double",	T_TYPE,		0,	DOUBLE,	0,	  0, 0, 0 },
-	{ "else",	T_ELSE,		0,	0,	0,	  0, 0, 0 },
-	{ "enum",	T_ENUM,		0,	0,	0,	  0, 0, 0 },
-	{ "__extension__", T_EXTENSION,	0,	0,	0,	  0, 0, 1 },
-	{ "extern",	T_SCLASS,	EXTERN,	0,	0,	  0, 0, 0 },
-	{ "float",	T_TYPE,		0,	FLOAT,	0,	  0, 0, 0 },
-	{ "for",	T_FOR,		0,	0,	0,	  0, 0, 0 },
-	{ "goto",	T_GOTO,		0,	0,	0,	  0, 0, 0 },
-	{ "if",		T_IF,		0,	0,	0,	  0, 0, 0 },
-	{ "__imag__",	T_IMAG,		0,	0,	0,	  0, 1, 0 },
-	{ "inline",	T_SCLASS,	INLINE,	0,	0,	  0, 1, 0 },
-	{ "__inline__",	T_SCLASS,	INLINE,	0,	0,	  0, 0, 0 },
-	{ "__inline",	T_SCLASS,	INLINE,	0,	0,	  0, 0, 0 },
-	{ "int",	T_TYPE,		0,	INT,	0,	  0, 0, 0 },
-	{ "__symbolrename", T_SYMBOLRENAME, 0,	0,	0,	  0, 0, 0 },
-	{ "long",	T_TYPE,		0,	LONG,	0,	  0, 0, 0 },
-	{ "__real__",	T_REAL,		0,	0,	0,	  0, 1, 0 },
-	{ "register",	T_SCLASS,	REG,	0,	0,	  0, 0, 0 },
-	{ "restrict",	T_QUAL,		0,	0,	RESTRICT, 0, 1, 0 },
-	{ "return",	T_RETURN,	0,	0,	0,	  0, 0, 0 },
-	{ "__packed",	T_PACKED,	0,	0,	0,	  0, 0, 0 },
-	{ "short",	T_TYPE,		0,	SHORT,	0,	  0, 0, 0 },
-	{ "signed",	T_TYPE,		0,	SIGNED,	0,	  1, 0, 0 },
-	{ "__signed__",	T_TYPE,		0,	SIGNED,	0,	  0, 0, 0 },
-	{ "__signed",	T_TYPE,		0,	SIGNED,	0,	  0, 0, 0 },
-	{ "sizeof",	T_SIZEOF,	0,	0,	0,	  0, 0, 0 },
-	{ "static",	T_SCLASS,	STATIC,	0,	0,	  0, 0, 0 },
-	{ "struct",	T_SOU,		0,	STRUCT,	0,	  0, 0, 0 },
-	{ "switch",	T_SWITCH,	0,	0,	0,	  0, 0, 0 },
-	{ "typedef",	T_SCLASS,	TYPEDEF, 0,	0,	  0, 0, 0 },
-	{ "typeof",	T_TYPEOF,	0,	0,	0,	  0, 0, 1 },
-	{ "__typeof",	T_TYPEOF,	0,	0,	0,	  0, 0, 1 },
-	{ "__typeof__",	T_TYPEOF,	0,	0,	0,	  0, 0, 1 },
-	{ "union",	T_SOU,		0,	UNION,	0,	  0, 0, 0 },
-	{ "unsigned",	T_TYPE,		0,	UNSIGN,	0,	  0, 0, 0 },
-	{ "void",	T_TYPE,		0,	VOID,	0,	  0, 0, 0 },
-	{ "volatile",	T_QUAL,		0,	0,	VOLATILE, 1, 0, 0 },
-	{ "__volatile__", T_QUAL,	0,	0,	VOLATILE, 0, 0, 0 },
-	{ "__volatile",	T_QUAL,		0,	0,	VOLATILE, 0, 0, 0 },
-	{ "while",	T_WHILE,	0,	0,	0,	  0, 0, 0 },
-	{ NULL,		0,		0,	0,	0,	  0, 0, 0 }
+	{ "__alignof__", T_ALIGNOF,	0,	0,	0,	  0, 0, 0, 0 },
+	{ "__attribute__",T_ATTRIBUTE,	0,	0,	0,	  0, 0, 1, 0 },
+	{ "__attribute",T_ATTRIBUTE,	0,	0,	0,	  0, 0, 1, 0 },
+	{ "__packed__",	T_AT_PACKED,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "packed",	T_AT_PACKED,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "__aligned__",T_AT_ALIGNED,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "aligned",	T_AT_ALIGNED,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "__transparent_union__",T_AT_TUNION,0,0,	0,	  0, 0, 1, 1 },
+	{ "transparent_union",T_AT_TUNION,0,	0,	0,	  0, 0, 1, 1 },
+	{ "__unused__",	T_AT_UNUSED,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "unused",	T_AT_UNUSED,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "__deprecated__",T_AT_DEPRECATED,0,	0,	0,	  0, 0, 1, 1 },
+	{ "deprecated",	T_AT_DEPRECATED,0,	0,	0,	  0, 0, 1, 1 },
+	{ "__may_alias__",T_AT_MAY_ALIAS,0,	0,	0,	  0, 0, 1, 1 },
+	{ "may_alias",	T_AT_MAY_ALIAS,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "format",	T_AT_FORMAT,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "__format__",	T_AT_FORMAT,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "printf",	T_AT_FORMAT_PRINTF,0,	0,	0,	  0, 0, 1, 1 },
+	{ "__printf__",	T_AT_FORMAT_PRINTF,0,	0,	0,	  0, 0, 1, 1 },
+	{ "scanf",	T_AT_FORMAT_SCANF,0,	0,	0,	  0, 0, 1, 1 },
+	{ "__scanf__",	T_AT_FORMAT_SCANF,0,	0,	0,	  0, 0, 1, 1 },
+	{ "strftime",	T_AT_FORMAT_SCANF,0,	0,	0,	  0, 0, 1, 1 },
+	{ "__strftime__",T_AT_FORMAT_STRFTIME,0,0,	0,	  0, 0, 1, 1 },
+	{ "pure",	T_AT_PURE,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "__pure__",	T_AT_PURE,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "noreturn",	T_AT_NORETURN,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "__noreturn__",T_AT_NORETURN,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "sentinel",	T_AT_SENTINEL,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "__sentinel__",T_AT_SENTINEL,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "format_arg", T_AT_FORMAT_ARG,0,	0,	0,	  0, 0, 1, 1 },
+	{ "__format_arg__", T_AT_FORMAT_ARG,0,	0,	0,	  0, 0, 1, 1 },
+	{ "returns_twice", T_AT_RETURNS_TWICE,0,0,	0,	  0, 0, 1, 1 },
+	{ "__returns_twice__", T_AT_RETURNS_TWICE,0,0,	0,	  0, 0, 1, 1 },
+	{ "cold",	T_AT_COLD,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "__cold__",	T_AT_COLD,	0,	0,	0,	  0, 0, 1, 1 },
+	{ "asm",	T_ASM,		0,	0,	0,	  0, 0, 1, 0 },
+	{ "__asm",	T_ASM,		0,	0,	0,	  0, 0, 0, 0 },
+	{ "__asm__",	T_ASM,		0,	0,	0,	  0, 0, 0, 0 },
+	{ "auto",	T_SCLASS,	AUTO,	0,	0,	  0, 0, 0, 0 },
+	{ "break",	T_BREAK,	0,	0,	0,	  0, 0, 0, 0 },
+	{ "_Bool",	T_TYPE,		0,	BOOL,	0,	  0, 1, 0, 0 },
+	{ "case",	T_CASE,		0,	0,	0,	  0, 0, 0, 0 },
+	{ "char",	T_TYPE,		0,	CHAR,	0,	  0, 0, 0, 0 },
+	{ "const",	T_QUAL,		0,	0,	CONST,	  1, 0, 0, 0 },
+	{ "_Complex",	T_TYPE,		0,	COMPLEX,0,	  0, 1, 0, 0 },
+	{ "__const__",	T_QUAL,		0,	0,	CONST,	  0, 0, 0, 0 },
+	{ "__const",	T_QUAL,		0,	0,	CONST,	  0, 0, 0, 0 },
+	{ "continue",	T_CONTINUE,	0,	0,	0,	  0, 0, 0, 0 },
+	{ "default",	T_DEFAULT,	0,	0,	0,	  0, 0, 0, 0 },
+	{ "do",		T_DO,		0,	0,	0,	  0, 0, 0, 0 },
+	{ "double",	T_TYPE,		0,	DOUBLE,	0,	  0, 0, 0, 0 },
+	{ "else",	T_ELSE,		0,	0,	0,	  0, 0, 0, 0 },
+	{ "enum",	T_ENUM,		0,	0,	0,	  0, 0, 0, 0 },
+	{ "__extension__", T_EXTENSION,	0,	0,	0,	  0, 0, 1, 0 },
+	{ "extern",	T_SCLASS,	EXTERN,	0,	0,	  0, 0, 0, 0 },
+	{ "float",	T_TYPE,		0,	FLOAT,	0,	  0, 0, 0, 0 },
+	{ "for",	T_FOR,		0,	0,	0,	  0, 0, 0, 0 },
+	{ "goto",	T_GOTO,		0,	0,	0,	  0, 0, 0, 0 },
+	{ "if",		T_IF,		0,	0,	0,	  0, 0, 0, 0 },
+	{ "__imag__",	T_IMAG,		0,	0,	0,	  0, 1, 0, 0 },
+	{ "inline",	T_SCLASS,	INLINE,	0,	0,	  0, 1, 0, 0 },
+	{ "__inline__",	T_SCLASS,	INLINE,	0,	0,	  0, 0, 0, 0 },
+	{ "__inline",	T_SCLASS,	INLINE,	0,	0,	  0, 0, 0, 0 },
+	{ "int",	T_TYPE,		0,	INT,	0,	  0, 0, 0, 0 },
+	{ "__symbolrename", T_SYMBOLRENAME, 0,	0,	0,	  0, 0, 0, 0 },
+	{ "long",	T_TYPE,		0,	LONG,	0,	  0, 0, 0, 0 },
+	{ "__real__",	T_REAL,		0,	0,	0,	  0, 1, 0, 0 },
+	{ "register",	T_SCLASS,	REG,	0,	0,	  0, 0, 0, 0 },
+	{ "__restrict__",T_QUAL,	0,	0,	RESTRICT, 0, 1, 0, 0 },
+	{ "restrict",	T_QUAL,		0,	0,	RESTRICT, 0, 1, 0, 0 },
+	{ "return",	T_RETURN,	0,	0,	0,	  0, 0, 0, 0 },
+	{ "__packed",	T_PACKED,	0,	0,	0,	  0, 0, 0, 0 },
+	{ "short",	T_TYPE,		0,	SHORT,	0,	  0, 0, 0, 0 },
+	{ "signed",	T_TYPE,		0,	SIGNED,	0,	  1, 0, 0, 0 },
+	{ "__signed__",	T_TYPE,		0,	SIGNED,	0,	  0, 0, 0, 0 },
+	{ "__signed",	T_TYPE,		0,	SIGNED,	0,	  0, 0, 0, 0 },
+	{ "sizeof",	T_SIZEOF,	0,	0,	0,	  0, 0, 0, 0 },
+	{ "static",	T_SCLASS,	STATIC,	0,	0,	  0, 0, 0, 0 },
+	{ "struct",	T_SOU,		0,	STRUCT,	0,	  0, 0, 0, 0 },
+	{ "switch",	T_SWITCH,	0,	0,	0,	  0, 0, 0, 0 },
+	{ "typedef",	T_SCLASS,	TYPEDEF, 0,	0,	  0, 0, 0, 0 },
+	{ "typeof",	T_TYPEOF,	0,	0,	0,	  0, 0, 1, 0 },
+	{ "__typeof",	T_TYPEOF,	0,	0,	0,	  0, 0, 1, 0 },
+	{ "__typeof__",	T_TYPEOF,	0,	0,	0,	  0, 0, 1, 0 },
+	{ "union",	T_SOU,		0,	UNION,	0,	  0, 0, 0, 0 },
+	{ "unsigned",	T_TYPE,		0,	UNSIGN,	0,	  0, 0, 0, 0 },
+	{ "void",	T_TYPE,		0,	VOID,	0,	  0, 0, 0, 0 },
+	{ "volatile",	T_QUAL,		0,	0,	VOLATILE, 1, 0, 0, 0 },
+	{ "__volatile__", T_QUAL,	0,	0,	VOLATILE, 0, 0, 0, 0 },
+	{ "__volatile",	T_QUAL,		0,	0,	VOLATILE, 0, 0, 0, 0 },
+	{ "while",	T_WHILE,	0,	0,	0,	  0, 0, 0, 0 },
+	{ NULL,		0,		0,	0,	0,	  0, 0, 0, 0 }
 };
 
 /* Symbol table */
@@ -310,7 +335,7 @@ initscan(void)
 			continue;
 		sym = getblk(sizeof (sym_t));
 		sym->s_name = kw->kw_name;
-		sym->s_keyw = 1;
+		sym->s_keyw = kw;
 		sym->s_value.v_quad = kw->kw_token;
 		if (kw->kw_token == T_TYPE || kw->kw_token == T_SOU) {
 			sym->s_tspec = kw->kw_tspec;
@@ -347,10 +372,15 @@ allocsb(void)
 
 	if ((sb = sbfrlst) != NULL) {
 		sbfrlst = sb->sb_nxt;
+#ifdef BLKDEBUG
+		(void)memset(sb, 0, sizeof (*sb));
+#else
+		sb->sb_nxt = NULL;
+#endif
 	} else {
 		sb = xmalloc(sizeof (sbuf_t));
+		(void)memset(sb, 0, sizeof (*sb));
 	}
-	(void)memset(sb, 0, sizeof (*sb));
 	return (sb);
 }
 
@@ -361,6 +391,7 @@ static void
 freesb(sbuf_t *sb)
 {
 
+	(void)memset(sb, ZERO, sizeof (*sb));
 	sb->sb_nxt = sbfrlst;
 	sbfrlst = sb;
 }
@@ -452,8 +483,12 @@ search(sbuf_t *sb)
 
 	for (sym = symtab[sb->sb_hash]; sym != NULL; sym = sym->s_link) {
 		if (strcmp(sym->s_name, sb->sb_name) == 0) {
-			if (sym->s_keyw || sym->s_kind == symtyp)
-				return (sym);
+			if (sym->s_keyw) {
+				struct kwtab *kw = sym->s_keyw;
+				if (!kw->kw_attr || attron)
+					return (sym);
+			} else if (sym->s_kind == symtyp)
+				return sym;
 		}
 	}
 
@@ -1361,7 +1396,7 @@ getsym(sbuf_t *sb)
 
 	if (sym != NULL) {
 		if (sym->s_kind != symtyp)
-			LERROR("storesym()");
+			LERROR("storesym(%d, %d)", sym->s_kind, symtyp);
 		symtyp = FVFT;
 		freesb(sb);
 		return (sym);

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.75 src/usr.bin/xlint/lint1/tree.c:1.75.2.1
--- src/usr.bin/xlint/lint1/tree.c:1.75	Tue Feb 18 22:01:36 2014
+++ src/usr.bin/xlint/lint1/tree.c	Sun Aug 10 06:59:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.75 2014/02/18 22:01:36 christos Exp $	*/
+/*	$NetBSD: tree.c,v 1.75.2.1 2014/08/10 06:59:20 tls Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.75 2014/02/18 22:01:36 christos Exp $");
+__RCSID("$NetBSD: tree.c,v 1.75.2.1 2014/08/10 06:59:20 tls Exp $");
 #endif
 
 #include <stdlib.h>
@@ -89,6 +89,45 @@ static	void	precconf(tnode_t *);
 
 extern sig_atomic_t fpe;
 
+#if 0
+static char *
+dumpnode(char *buf, size_t len, tnode_t *tn) {
+	const char *n = getopname(tn->tn_op);
+	const char *s;
+	char tbuf[256];
+
+	switch (tn->tn_op) {
+	case NAME:
+		s = tn->tn_sym->s_name;
+		break;
+	case CON:
+	case STRING:
+		s = "*";	/* todo */
+		break;
+	default:
+		s = NULL;
+		break;
+	}
+	char lb[1024];
+	char rb[1024];
+
+	if (s == NULL && tn->tn_left != NULL)
+		dumpnode(lb, sizeof(lb), tn->tn_left);
+	else
+		strcpy(lb, "(null)");
+
+	if (s == NULL && tn->tn_right != NULL)
+		dumpnode(rb, sizeof(rb), tn->tn_right);
+	else
+		strcpy(rb, "(null)");
+
+
+	snprintf(buf, len, "%s: (%s) = %s [%s, %s]", n,
+	    tyname(tbuf, sizeof(tbuf), tn->tn_type), s, lb, rb);
+	return buf;
+}
+#endif
+
 /*
  * Increase degree of reference.
  * This is most often used to change type "T" in type "pointer to T".
@@ -204,7 +243,7 @@ getnnode(sym_t *sym, int ntok)
 	}
 
 	if (sym->s_kind != FVFT && sym->s_kind != FMOS)
-		LERROR("getnnode()");
+		LERROR("getnnode(%d)", sym->s_kind);
 
 	n = getnode();
 	n->tn_type = sym->s_type;
@@ -1616,9 +1655,6 @@ convert(op_t op, int arg, type_t *tp, tn
 	tnode_t	*ntn;
 	tspec_t	nt, ot, ost = NOTSPEC;
 
-	if (tn->tn_lvalue)
-		LERROR("convert()");
-
 	nt = tp->t_tspec;
 	if ((ot = tn->tn_type->t_tspec) == PTR)
 		ost = tn->tn_type->t_subt->t_tspec;
@@ -1640,6 +1676,7 @@ convert(op_t op, int arg, type_t *tp, tn
 	ntn->tn_op = CVT;
 	ntn->tn_type = tp;
 	ntn->tn_cast = op == CVT;
+	ntn->tn_right = NULL;
 	if (tn->tn_op != CON || nt == VOID) {
 		ntn->tn_left = tn;
 	} else {
@@ -3569,7 +3606,9 @@ chkmisc(tnode_t *tn, int vctx, int tctx,
 		break;
 	case CALL:
 		if (ln->tn_op != AMPER || ln->tn_left->tn_op != NAME)
-			LERROR("chkmisc()");
+			LERROR("chkmisc(op=%s != %s || %s != %s)",
+			    getopname(ln->tn_op), getopname(AMPER),
+			    getopname(ln->tn_left->tn_op), getopname(NAME));
 		if (!szof)
 			outcall(tn, vctx || tctx, rvdisc);
 		break;

Reply via email to