Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/lint1 teach lint __attribute__((__unused__))
details: https://anonhg.NetBSD.org/src/rev/55bde5f59874
branches: trunk
changeset: 349910:55bde5f59874
user: christos <christos%NetBSD.org@localhost>
date: Tue Dec 27 21:52:35 2016 +0000
description:
teach lint __attribute__((__unused__))
diffstat:
usr.bin/xlint/lint1/cgram.y | 8 +++++---
usr.bin/xlint/lint1/decl.c | 11 +++++++++--
usr.bin/xlint/lint1/externs1.h | 3 ++-
usr.bin/xlint/lint1/lint1.h | 3 ++-
4 files changed, 18 insertions(+), 7 deletions(-)
diffs (103 lines):
diff -r a0900e14f66c -r 55bde5f59874 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Tue Dec 27 21:52:01 2016 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Tue Dec 27 21:52:35 2016 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.81 2016/11/05 01:09:30 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.82 2016/12/27 21:52:35 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.81 2016/11/05 01:09:30 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.82 2016/12/27 21:52:35 christos Exp $");
#endif
#include <stdlib.h>
@@ -516,7 +516,9 @@
| T_AT_GNU_INLINE
| T_AT_FORMAT T_LPARN type_attribute_format_type T_COMMA
constant T_COMMA constant T_RPARN
- | T_AT_UNUSED
+ | T_AT_UNUSED {
+ addused();
+ }
| T_AT_WEAK
| T_AT_VISIBILITY T_LPARN constant T_RPARN
| T_QUAL {
diff -r a0900e14f66c -r 55bde5f59874 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Tue Dec 27 21:52:01 2016 +0000
+++ b/usr.bin/xlint/lint1/decl.c Tue Dec 27 21:52:35 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.66 2016/11/03 22:08:30 kamil Exp $ */
+/* $NetBSD: decl.c,v 1.67 2016/12/27 21:52:35 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: decl.c,v 1.66 2016/11/03 22:08:30 kamil Exp $");
+__RCSID("$NetBSD: decl.c,v 1.67 2016/12/27 21:52:35 christos Exp $");
#endif
#include <sys/param.h>
@@ -537,6 +537,12 @@
setpackedsize(dcs->d_type);
}
+void
+addused(void)
+{
+ dcs->d_used = 1;
+}
+
/*
* Remember a qualifier which is part of the declaration specifiers
* (and not the declarator) in the top element of the declaration stack.
@@ -2365,6 +2371,7 @@
if (sym->s_type->t_tspec != VOID)
(void)length(sym->s_type, sym->s_name);
+ sym->s_used = dcs->d_used;
setsflg(sym);
return (sym);
diff -r a0900e14f66c -r 55bde5f59874 usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h Tue Dec 27 21:52:01 2016 +0000
+++ b/usr.bin/xlint/lint1/externs1.h Tue Dec 27 21:52:35 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: externs1.h,v 1.33 2016/12/24 17:43:45 christos Exp $ */
+/* $NetBSD: externs1.h,v 1.34 2016/12/27 21:52:35 christos Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -145,6 +145,7 @@
extern void addtype(type_t *);
extern void addqual(tqual_t);
extern void addpacked(void);
+extern void addused(void);
extern void pushdecl(scl_t);
extern void popdecl(void);
extern void setasm(void);
diff -r a0900e14f66c -r 55bde5f59874 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h Tue Dec 27 21:52:01 2016 +0000
+++ b/usr.bin/xlint/lint1/lint1.h Tue Dec 27 21:52:35 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.29 2014/07/20 23:00:49 dholland Exp $ */
+/* $NetBSD: lint1.h,v 1.30 2016/12/27 21:52:35 christos Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -344,6 +344,7 @@
u_int d_notyp : 1; /* set if no type specifier was present */
u_int d_asm : 1; /* set if d_ctx == AUTO and asm() present */
u_int d_ispacked : 1; /* packed */
+ u_int d_used : 1; /* used */
type_t *d_tagtyp; /* tag during member declaration */
sym_t *d_fargs; /* list of arguments during function def. */
pos_t d_fdpos; /* position of function definition */
Home |
Main Index |
Thread Index |
Old Index