Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/config On second thought, resolving "device" depende...



details:   https://anonhg.NetBSD.org/src/rev/49c4f5b802ea
branches:  trunk
changeset: 803048:49c4f5b802ea
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Sat Oct 11 15:20:36 2014 +0000

description:
On second thought, resolving "device" dependency in enddefs() is correct.
The problem was to select things.  So put back the code to record dependency
as attributes.

While here, sprinkle more debug messages.

diffstat:

 usr.bin/config/scan.l |   3 ++-
 usr.bin/config/sem.c  |  25 +++++++++++++++++--------
 2 files changed, 19 insertions(+), 9 deletions(-)

diffs (130 lines):

diff -r 96fe5def0ae5 -r 49c4f5b802ea usr.bin/config/scan.l
--- a/usr.bin/config/scan.l     Sat Oct 11 14:52:15 2014 +0000
+++ b/usr.bin/config/scan.l     Sat Oct 11 15:20:36 2014 +0000
@@ -1,5 +1,5 @@
 %{
-/*     $NetBSD: scan.l,v 1.17 2012/03/20 20:34:57 matt Exp $   */
+/*     $NetBSD: scan.l,v 1.18 2014/10/11 15:20:36 uebayasi Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -530,6 +530,7 @@
        if (interesting)
                logconfig_include(fp, fname);
        incl = in;
+       CFGDBG(1, "include `%s' from `%s' line %d", fname, yyfile, yyline);
        yy_switch_to_buffer(yy_create_buffer(fp, YY_BUF_SIZE));
        yyfile = intern(s);
        yyline = 1;
diff -r 96fe5def0ae5 -r 49c4f5b802ea usr.bin/config/sem.c
--- a/usr.bin/config/sem.c      Sat Oct 11 14:52:15 2014 +0000
+++ b/usr.bin/config/sem.c      Sat Oct 11 15:20:36 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sem.c,v 1.59 2014/10/11 09:27:51 uebayasi Exp $        */
+/*     $NetBSD: sem.c,v 1.60 2014/10/11 15:20:36 uebayasi Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -142,12 +142,12 @@
 }
 
 static void
-mergedeps(struct devbase *dev, const char *name)
+mergedeps(const char *devname, const char *name)
 {
        struct attr *a, *newa;
 
-       CFGDBG(4, "merging attr `%s' to devbase `%s'", name, dev->d_name);
-       a = refattr(dev->d_name);
+       CFGDBG(4, "merging attr `%s' to devbase `%s'", name, devname);
+       a = refattr(devname);
        if (finddep(a, name) == NULL) {
                newa = refattr(name);
                a->a_deps = attrlist_cons(a->a_deps, newa);
@@ -169,6 +169,7 @@
        CFGDBG(4, "fixing devbase `%s'", dev->d_name);
        for (al = dev->d_attrs; al != NULL; al = al->al_next) {
                a = al->al_this;
+               CFGDBG(4, "fixing devbase `%s' attr `%s'", dev->d_name, a->a_name);
                if (a->a_iattr) {
                        a->a_refs = addtoattr(a->a_refs, dev);
                        CFGDBG(3, "device `%s' has iattr `%s'", dev->d_name,
@@ -187,7 +188,7 @@
                        }
                } else {
                        if (strcmp(dev->d_name, a->a_name) != 0) {
-                               mergedeps(dev, a->a_name);
+                               mergedeps(dev->d_name, a->a_name);
                        }
                }
        }
@@ -208,6 +209,7 @@
                        errors++;
                        continue;
                }
+               fixdev(dev);
        }
        if (errors) {
                (void)fprintf(stderr, "*** Stop.\n");
@@ -301,6 +303,7 @@
                            "attribute", name, dep->a_name);
                        return (1);
                }
+               CFGDBG(2, "attr `%s' depends on attr `%s'", name, dep->a_name);
        }
 
        if (getrefattr(name, &a)) {
@@ -453,6 +456,7 @@
 {
        struct loclist *ll;
        struct attrlist *al;
+       struct attr *a;
 
        if (dev == &errdev)
                goto bad;
@@ -511,7 +515,7 @@
        /*
         * Implicit attribute definition for device.
         */
-       refattr(dev->d_name);
+       a = refattr(dev->d_name);
 
        /*
         * For each interface attribute this device refers to, add this
@@ -526,7 +530,9 @@
                /*
                 * Implicit attribute definition for device dependencies.
                 */
-               refattr(dev->d_name);
+               refattr(al->al_this->a_name);
+               CFGDBG(2, "device `%s' depends on attr `%s'", dev->d_name,
+                   al->al_this->a_name);
        }
        return;
  bad:
@@ -1235,6 +1241,7 @@
        i->i_pspec = p;
        i->i_atdeva = iba;
        i->i_cfflags = flags;
+       CFGDBG(3, "devi `%s' added", i->i_name);
 
        *iba->d_ipp = i;
        iba->d_ipp = &i->i_asame;
@@ -1759,7 +1766,8 @@
        struct devi *i;
        int error = 0;
 
-       TAILQ_FOREACH(i, &alldevi, i_next)
+       TAILQ_FOREACH(i, &alldevi, i_next) {
+               CFGDBG(3, "fixing devis `%s'", i->i_name);
                if (i->i_active == DEVI_ACTIVE)
                        selectbase(i->i_base, i->i_atdeva);
                else if (i->i_active == DEVI_ORPHAN) {
@@ -1776,6 +1784,7 @@
                        cfgxwarn(i->i_srcfile, i->i_lineno, "ignoring "
                            "explicitly orphaned instance `%s at %s'",
                            i->i_name, i->i_at);
+       }
 
        if (error)
                return error;



Home | Main Index | Thread Index | Old Index