diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2005-12-17 20:19:47 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2005-12-17 20:19:47 +0000 |
commit | 5e2c01731eeeb93a50ed8f3f133a869801b94bbf (patch) | |
tree | 7791dc20f476f51a21765b26fe84502669a9e6d7 /usr.bin | |
parent | 538c5953ad727adc8581431f557811c23044733e (diff) |
Check for functions declared with ARGSUSED but having no arguments.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/xlint/lint1/err.c | 5 | ||||
-rw-r--r-- | usr.bin/xlint/lint1/func.c | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/xlint/lint1/err.c b/usr.bin/xlint/lint1/err.c index a46486bceae..cc3c72b31bd 100644 --- a/usr.bin/xlint/lint1/err.c +++ b/usr.bin/xlint/lint1/err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err.c,v 1.16 2005/12/15 05:49:48 cloder Exp $ */ +/* $OpenBSD: err.c,v 1.17 2005/12/17 20:19:46 cloder Exp $ */ /* $NetBSD: err.c,v 1.8 1995/10/02 17:37:00 jpo Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: err.c,v 1.16 2005/12/15 05:49:48 cloder Exp $"; +static char rcsid[] = "$OpenBSD: err.c,v 1.17 2005/12/17 20:19:46 cloder Exp $"; #endif /* number of errors found */ @@ -367,6 +367,7 @@ const char *msgs[] = { "case ranges are illegal in ANSI C", /* 311 */ "suspicious operator for sizeof: %s", /* 312 */ "conversion of %s return value from '%s' to '%s'", /* 313 */ + "function %s declared with %s, but takes no arguments", /* 314 */ }; /* diff --git a/usr.bin/xlint/lint1/func.c b/usr.bin/xlint/lint1/func.c index 8d406ea9696..c3ee8e6350b 100644 --- a/usr.bin/xlint/lint1/func.c +++ b/usr.bin/xlint/lint1/func.c @@ -1,4 +1,4 @@ -/* $OpenBSD: func.c,v 1.8 2005/11/29 19:38:09 cloder Exp $ */ +/* $OpenBSD: func.c,v 1.9 2005/12/17 20:19:46 cloder Exp $ */ /* $NetBSD: func.c,v 1.7 1995/10/02 17:31:40 jpo Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: func.c,v 1.8 2005/11/29 19:38:09 cloder Exp $"; +static char rcsid[] = "$OpenBSD: func.c,v 1.9 2005/12/17 20:19:46 cloder Exp $"; #endif #include <stdlib.h> @@ -376,6 +376,10 @@ funcend(void) /* Print warnings for unused arguments */ arg = dcs->d_fargs; n = 0; + if (arg == NULL && nargusg == 0) { + warning(314, funcsym->s_name, "ARGSUSED"); + } + while (arg != NULL && (nargusg == -1 || n < nargusg)) { chkusg1(dcs->d_asm, arg); arg = arg->s_nxt; |