Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint Don't print duplicate definitions for inline s...
details: https://anonhg.NetBSD.org/src/rev/011b31bc1992
branches: trunk
changeset: 358379:011b31bc1992
user: christos <christos%NetBSD.org@localhost>
date: Tue Dec 26 17:02:19 2017 +0000
description:
Don't print duplicate definitions for inline symbols.
diffstat:
usr.bin/xlint/lint1/emit1.c | 7 +++++--
usr.bin/xlint/lint2/chk.c | 6 ++++--
usr.bin/xlint/lint2/lint2.h | 4 +++-
usr.bin/xlint/lint2/read.c | 39 ++++++++++++++++++++++-----------------
4 files changed, 34 insertions(+), 22 deletions(-)
diffs (160 lines):
diff -r 4b082fa3db22 -r 011b31bc1992 usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c Tue Dec 26 17:01:25 2017 +0000
+++ b/usr.bin/xlint/lint1/emit1.c Tue Dec 26 17:02:19 2017 +0000
@@ -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 @@
/* old style function definition */
outchar('o');
+ if (fsym->s_inline)
+ outchar('i');
+
if (fsym->s_scl == STATIC)
outchar('s');
diff -r 4b082fa3db22 -r 011b31bc1992 usr.bin/xlint/lint2/chk.c
--- a/usr.bin/xlint/lint2/chk.c Tue Dec 26 17:01:25 2017 +0000
+++ b/usr.bin/xlint/lint2/chk.c Tue Dec 26 17:02:19 2017 +0000
@@ -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 @@
*/
if (sym->s_def != DEF && (!sflag || sym->s_def != TDEF))
continue;
+ if (sym->s_inline)
+ continue;
if (def1 == NULL) {
def1 = sym;
continue;
diff -r 4b082fa3db22 -r 011b31bc1992 usr.bin/xlint/lint2/lint2.h
--- a/usr.bin/xlint/lint2/lint2.h Tue Dec 26 17:01:25 2017 +0000
+++ b/usr.bin/xlint/lint2/lint2.h Tue Dec 26 17:02:19 2017 +0000
@@ -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 @@
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 @@
#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
diff -r 4b082fa3db22 -r 011b31bc1992 usr.bin/xlint/lint2/read.c
--- a/usr.bin/xlint/lint2/read.c Tue Dec 26 17:01:25 2017 +0000
+++ b/usr.bin/xlint/lint2/read.c Tue Dec 26 17:02:19 2017 +0000
@@ -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 @@
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 @@
inperr("nodecl %c", c);
sym.s_def = DECL;
break;
- case 'u':
- if (used)
- inperr("used %c", c);
- used = 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 'o':
- if (sym.s_osdef)
- inperr("osdef");
- sym.s_osdef = 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");
Home |
Main Index |
Thread Index |
Old Index