- Keep track of the file in which we find the device instance
- Introduce xwarn() for delayed warnings - Use xerror() and xwarn() in fixdevis() to notify about orphans That way the correct file is printed when listing orphaned devices. Reported by Juergen Hannken-Illjes in private mail.
This commit is contained in:
parent
70200ecd34
commit
0dbd1c0e04
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: defs.h,v 1.4 2005/10/01 23:30:37 cube Exp $ */
|
||||
/* $NetBSD: defs.h,v 1.5 2005/10/04 12:35:00 cube Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -243,6 +243,7 @@ struct devi {
|
|||
const char **i_locs; /* locators (as given by pspec's iattr) */
|
||||
int i_cfflags; /* flags from config line */
|
||||
int i_lineno; /* line # in config, for later errors */
|
||||
const char *i_srcfile; /* file it appears in */
|
||||
int i_active;
|
||||
#define DEVI_ORPHAN 0 /* instance has no active parent */
|
||||
#define DEVI_ACTIVE 1 /* instance has an active parent */
|
||||
|
@ -506,6 +507,8 @@ void prefix_pop(void);
|
|||
char *sourcepath(const char *);
|
||||
void warn(const char *, ...) /* immediate warns */
|
||||
__attribute__((__format__(__printf__, 1, 2)));
|
||||
void xwarn(const char *, int, const char *, ...) /* delayed warns */
|
||||
__attribute__((__format__(__printf__, 3, 4)));
|
||||
void error(const char *, ...) /* immediate errs */
|
||||
__attribute__((__format__(__printf__, 1, 2)));
|
||||
void xerror(const char *, int, const char *, ...) /* delayed errs */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sem.c,v 1.9 2005/10/02 00:18:09 cube Exp $ */
|
||||
/* $NetBSD: sem.c,v 1.10 2005/10/04 12:35:00 cube Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -880,6 +880,7 @@ newdevi(const char *name, int unit, struct devbase *d)
|
|||
i->i_locs = NULL;
|
||||
i->i_cfflags = 0;
|
||||
i->i_lineno = currentline();
|
||||
i->i_srcfile = yyfile;
|
||||
i->i_active = DEVI_ORPHAN; /* Proper analysis comes later */
|
||||
if (unit >= d->d_umax)
|
||||
d->d_umax = unit + 1;
|
||||
|
@ -1441,15 +1442,14 @@ fixdevis(void)
|
|||
* i_at or i_pspec are NULL.
|
||||
*/
|
||||
++error;
|
||||
(void)fprintf(stderr,
|
||||
"%s:%d: `%s at %s' is orphaned"
|
||||
" (%s `%s' found)\n", conffile, i->i_lineno,
|
||||
xerror(i->i_srcfile, i->i_lineno,
|
||||
"`%s at %s' is orphaned (%s `%s' found)",
|
||||
i->i_name, i->i_at, i->i_pspec->p_atunit == WILD ?
|
||||
"nothing matching" : "no", i->i_at);
|
||||
} else if (vflag && i->i_active == DEVI_IGNORED)
|
||||
(void)fprintf(stderr, "%s:%d: ignoring explicitely"
|
||||
" orphaned instance `%s at %s'\n", conffile,
|
||||
i->i_lineno, i->i_name, i->i_at);
|
||||
xwarn(i->i_srcfile, i->i_lineno, "ignoring explicitely"
|
||||
" orphaned instance `%s at %s'\n", i->i_name,
|
||||
i->i_at);
|
||||
|
||||
if (error)
|
||||
return error;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: util.c,v 1.1 2005/06/05 18:19:53 thorpej Exp $ */
|
||||
/* $NetBSD: util.c,v 1.2 2005/10/04 12:35:00 cube Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -259,6 +259,15 @@ warn(const char *fmt, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
xwarn(const char *file, int line, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vxwarn(file, line, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void
|
||||
vxwarn(const char *file, int line, const char *fmt, va_list ap)
|
||||
|
|
Loading…
Reference in New Issue