Module Name:    src
Committed By:   christos
Date:           Tue Dec 26 17:02:19 UTC 2017

Modified Files:
        src/usr.bin/xlint/lint1: emit1.c
        src/usr.bin/xlint/lint2: chk.c lint2.h read.c

Log Message:
Don't print duplicate definitions for inline symbols.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/lint2/chk.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/lint2/lint2.h
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/xlint/lint2/read.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/lint1/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.19 src/usr.bin/xlint/lint1/emit1.c:1.20
--- src/usr.bin/xlint/lint1/emit1.c:1.19	Fri Sep 26 18:52:24 2008
+++ src/usr.bin/xlint/lint1/emit1.c	Tue Dec 26 12:02:19 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.19 2008/09/26 22:52:24 matt Exp $ */
+/* $NetBSD: emit1.c,v 1.20 2017/12/26 17:02:19 christos 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: emit1.c,v 1.19 2008/09/26 22:52:24 matt Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.20 2017/12/26 17:02:19 christos Exp $");
 #endif
 
 #include <ctype.h>
@@ -367,6 +367,9 @@ outfdef(sym_t *fsym, pos_t *posp, int rv
 		/* old style function definition */
 		outchar('o');
 
+	if (fsym->s_inline)
+		outchar('i');
+
 	if (fsym->s_scl == STATIC)
 		outchar('s');
 

Index: src/usr.bin/xlint/lint2/chk.c
diff -u src/usr.bin/xlint/lint2/chk.c:1.22 src/usr.bin/xlint/lint2/chk.c:1.23
--- src/usr.bin/xlint/lint2/chk.c:1.22	Mon Oct 17 12:31:14 2011
+++ src/usr.bin/xlint/lint2/chk.c	Tue Dec 26 12:02:19 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: chk.c,v 1.22 2011/10/17 16:31:14 mbalmer Exp $ */
+/* $NetBSD: chk.c,v 1.23 2017/12/26 17:02:19 christos 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: chk.c,v 1.22 2011/10/17 16:31:14 mbalmer Exp $");
+__RCSID("$NetBSD: chk.c,v 1.23 2017/12/26 17:02:19 christos Exp $");
 #endif
 
 #include <ctype.h>
@@ -211,6 +211,8 @@ chkmd(hte_t *hte)
 		 */
 		if (sym->s_def != DEF && (!sflag || sym->s_def != TDEF))
 			continue;
+		if (sym->s_inline)
+			continue;
 		if (def1 == NULL) {
 			def1 = sym;
 			continue;

Index: src/usr.bin/xlint/lint2/lint2.h
diff -u src/usr.bin/xlint/lint2/lint2.h:1.7 src/usr.bin/xlint/lint2/lint2.h:1.8
--- src/usr.bin/xlint/lint2/lint2.h:1.7	Thu Apr  7 12:28:40 2005
+++ src/usr.bin/xlint/lint2/lint2.h	Tue Dec 26 12:02:19 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: lint2.h,v 1.7 2005/04/07 16:28:40 christos Exp $ */
+/* $NetBSD: lint2.h,v 1.8 2017/12/26 17:02:19 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -119,6 +119,7 @@ typedef	struct sym {
 		def_t	s_def;
 #endif
 		u_int	s_rval : 1;	/* function has return value */
+		u_int	s_inline : 1;	/* function is inline */
 		u_int	s_osdef : 1;	/* old style function definition */
 		u_int	s_static : 1;	/* symbol is static */
 		u_int	s_va : 1;	/* check only first s_nva arguments */
@@ -135,6 +136,7 @@ typedef	struct sym {
 #define s_pos		s_s.s_pos
 #define s_rval		s_s.s_rval
 #define s_osdef		s_s.s_osdef
+#define s_inline	s_s.s_inline
 #define s_static	s_s.s_static
 #define s_def		s_s.s_def
 #define s_va		s_s.s_va

Index: src/usr.bin/xlint/lint2/read.c
diff -u src/usr.bin/xlint/lint2/read.c:1.26 src/usr.bin/xlint/lint2/read.c:1.27
--- src/usr.bin/xlint/lint2/read.c:1.26	Sat Oct 18 04:33:30 2014
+++ src/usr.bin/xlint/lint2/read.c	Tue Dec 26 12:02:19 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.26 2014/10/18 08:33:30 snj Exp $ */
+/* $NetBSD: read.c,v 1.27 2017/12/26 17:02:19 christos 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: read.c,v 1.26 2014/10/18 08:33:30 snj Exp $");
+__RCSID("$NetBSD: read.c,v 1.27 2017/12/26 17:02:19 christos Exp $");
 #endif
 
 #include <ctype.h>
@@ -371,14 +371,9 @@ decldef(pos_t *posp, const char *cp)
 
 	used = 0;
 
-	while (strchr("tdeurosvPS", (c = *cp)) != NULL) {
+	while (strchr("deiorstuvPS", (c = *cp)) != NULL) {
 		cp++;
 		switch (c) {
-		case 't':
-			if (sym.s_def != NODECL)
-				inperr("nodecl %c", c);
-			sym.s_def = TDEF;
-			break;
 		case 'd':
 			if (sym.s_def != NODECL)
 				inperr("nodecl %c", c);
@@ -389,26 +384,36 @@ decldef(pos_t *posp, const char *cp)
 				inperr("nodecl %c", c);
 			sym.s_def = DECL;
 			break;
-		case 'u':
-			if (used)
-				inperr("used %c", c);
-			used = 1;
-			break;
-		case 'r':
-			if (sym.s_rval)
-				inperr("rval");
-			sym.s_rval = 1;
+		case 'i':
+			if (sym.s_inline != NODECL)
+				inperr("inline %c", c);
+			sym.s_inline = DECL;
 			break;
 		case 'o':
 			if (sym.s_osdef)
 				inperr("osdef");
 			sym.s_osdef = 1;
 			break;
+		case 'r':
+			if (sym.s_rval)
+				inperr("rval");
+			sym.s_rval = 1;
+			break;
 		case 's':
 			if (sym.s_static)
 				inperr("static");
 			sym.s_static = 1;
 			break;
+		case 't':
+			if (sym.s_def != NODECL)
+				inperr("nodecl %c", c);
+			sym.s_def = TDEF;
+			break;
+		case 'u':
+			if (used)
+				inperr("used %c", c);
+			used = 1;
+			break;
 		case 'v':
 			if (sym.s_va)
 				inperr("va");

Reply via email to