in chkdnud(), don't warn if the defined-but-not-used object is a function.

chkdnud() is used (only) to implement the -x option, which is supposed to
warn for variables only.
This commit is contained in:
cgd 1997-11-03 22:33:53 +00:00
parent 1abecf9a70
commit 206f92eed6
1 changed files with 12 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: chk.c,v 1.3 1996/12/22 11:31:37 cgd Exp $ */
/* $NetBSD: chk.c,v 1.4 1997/11/03 22:33:53 cgd Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@ -33,7 +33,7 @@
*/
#ifndef lint
static char rcsid[] = "$NetBSD: chk.c,v 1.3 1996/12/22 11:31:37 cgd Exp $";
static char rcsid[] = "$NetBSD: chk.c,v 1.4 1997/11/03 22:33:53 cgd Exp $";
#endif
#include <stdlib.h>
@ -261,7 +261,7 @@ chkdnu(hte)
}
/*
* Print a warning if the name has been declared, but is not used
* Print a warning if the variable has been declared, but is not used
* or defined.
*/
static void
@ -272,13 +272,15 @@ chkdnud(hte)
if (hte->h_syms == NULL || hte->h_used || hte->h_def)
return;
if ((sym = hte->h_syms) != NULL) {
if (sym->s_def != DECL)
errx(1, "internal error: chkdnud() 1");
/* %s declared( %s ), but never used or defined */
msg(2, hte->h_name, mkpos(&sym->s_pos));
}
sym = hte->h_syms;
if (TP(sym->s_type)->t_tspec == FUNC)
return;
if (sym->s_def != DECL)
errx(1, "internal error: chkdnud() 1");
/* %s declared( %s ), but never used or defined */
msg(2, hte->h_name, mkpos(&sym->s_pos));
}
/*