Allow dependency on undefined attributes, so that attribute definitions can

be written out-of-order, like:

	# b is not defined yet
	define	a: b
	file	a.c	a

	# b is defined here
	define	b
	fine	b.c
This commit is contained in:
uebayasi 2014-10-10 11:09:50 +00:00
parent 2d22d80ac8
commit d23bf64337
3 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: gram.y,v 1.42 2014/10/10 06:13:30 uebayasi Exp $ */
/* $NetBSD: gram.y,v 1.43 2014/10/10 11:09:50 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@ -587,7 +587,7 @@ depends:
/* one depend item (which is an attribute) */
depend:
WORD { $$ = getattr($1); }
WORD { $$ = refattr($1); }
;
/* list of option depends, may be empty */

View File

@ -1,4 +1,4 @@
/* $NetBSD: sem.c,v 1.54 2014/10/10 10:16:19 uebayasi Exp $ */
/* $NetBSD: sem.c,v 1.55 2014/10/10 11:09:50 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@ -672,12 +672,14 @@ getattr(const char *name)
/*
* Implicit attribute definition.
*/
void
struct attr *
refattr(const char *name)
{
struct attr *a;
if ((ht_lookup(attrtab, name)) == NULL)
(void)mkattr(name);
if ((a = ht_lookup(attrtab, name)) == NULL)
a = mkattr(name);
return a;
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: sem.h,v 1.13 2014/10/10 07:48:50 uebayasi Exp $ */
/* $NetBSD: sem.h,v 1.14 2014/10/10 11:09:50 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@ -57,7 +57,7 @@ struct devbase *getdevbase(const char *);
struct deva *getdevattach(const char *);
struct attr *mkattr(const char *);
struct attr *getattr(const char *);
void refattr(const char *);
struct attr *refattr(const char *);
int getrefattr(const char *, struct attr **);
void expandattr(struct attr *, void (*)(struct attr *));
void selectattr(struct attr *);