Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/config If a file is marked by an atom expression, li...



details:   https://anonhg.NetBSD.org/src/rev/18c32dcd0f77
branches:  trunk
changeset: 332788:18c32dcd0f77
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Thu Oct 09 10:29:36 2014 +0000

description:
If a file is marked by an atom expression, like "file a.c foo", and if the
specified expression is an attribute, mark the file as belonging to the
attribute.

At this moment this information is not used for any purpose, but can be
traced by config -ddd.

diffstat:

 usr.bin/config/defs.h  |   7 ++++++-
 usr.bin/config/files.c |  22 +++++++++++++++++++++-
 usr.bin/config/sem.c   |   3 ++-
 3 files changed, 29 insertions(+), 3 deletions(-)

diffs (116 lines):

diff -r 64abb8b962c5 -r 18c32dcd0f77 usr.bin/config/defs.h
--- a/usr.bin/config/defs.h     Thu Oct 09 09:39:24 2014 +0000
+++ b/usr.bin/config/defs.h     Thu Oct 09 10:29:36 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.48 2014/10/09 07:43:55 martin Exp $ */
+/*     $NetBSD: defs.h,v 1.49 2014/10/09 10:29:36 uebayasi Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -174,6 +174,7 @@
        struct  nvlist *a_refs;         /* parents */
        struct  attrlist *a_deps;       /* we depend on these other attrs */
        int     a_expanding;            /* to detect cycles in attr graph */
+       TAILQ_HEAD(, files) a_files;    /* files in this attr */
 };
 
 /*
@@ -319,6 +320,8 @@
        char    fit_lastc;      /* last char from path */
        const char *fit_path;   /* full file path */
        const char *fit_prefix; /* any file prefix */
+       struct attr *fit_attr;  /* owner attr */
+       TAILQ_ENTRY(files) fit_anext;   /* next file in attr */
 };
 /* Anything less than 0x10 is sub-type specific */
 #define FIT_NOPROLOGUE  0x10    /* Don't prepend $S/ */
@@ -350,6 +353,8 @@
 #define fi_lastc   fi_fit.fit_lastc
 #define fi_path    fi_fit.fit_path
 #define fi_prefix  fi_fit.fit_prefix
+#define fi_attr    fi_fit.fit_attr
+#define fi_anext   fi_fit.fit_anext
 
 /* flags */
 #define        FI_SEL          0x01    /* selected */
diff -r 64abb8b962c5 -r 18c32dcd0f77 usr.bin/config/files.c
--- a/usr.bin/config/files.c    Thu Oct 09 09:39:24 2014 +0000
+++ b/usr.bin/config/files.c    Thu Oct 09 10:29:36 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: files.c,v 1.13 2014/10/09 06:49:53 uebayasi Exp $      */
+/*     $NetBSD: files.c,v 1.14 2014/10/09 10:29:36 uebayasi Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -65,6 +65,7 @@
 
 static struct files **unchecked;
 
+static void    addfiletoattr(const char *, struct files *);
 static int     checkaux(const char *, void *);
 static int     fixcount(const char *, void *);
 static int     fixfsel(const char *, void *);
@@ -157,6 +158,7 @@
        fi->fi_optx = optx;
        fi->fi_optf = NULL;
        fi->fi_mkrule = rule;
+       fi->fi_attr = NULL;
        TAILQ_INSERT_TAIL(&allfiles, fi, fi_next);
        return;
  bad:
@@ -195,6 +197,18 @@
        return;
 }     
 
+static void
+addfiletoattr(const char *name, struct files *fi)
+{
+       struct attr *a;
+
+       a = ht_lookup(attrtab, name);
+       if (a != NULL) {
+               TAILQ_INSERT_TAIL(&a->a_files, fi, fi_anext);
+               fi->fi_attr = a;
+       }
+}
+
 /*
  * We have finished reading some "files" file, either ../../conf/files
  * or ./files.$machine.  Make sure that everything that is flagged as
@@ -260,6 +274,9 @@
                        /* include it */ ;
                }
                else if (fi->fi_optx != NULL) {
+                       if (fi->fi_optx->cx_type == CX_ATOM) {
+                               addfiletoattr(fi->fi_optx->cx_u.atom, fi);
+                       }
                        flathead = NULL;
                        flatp = &flathead;
                        sel = expr_eval(fi->fi_optx,
@@ -298,6 +315,9 @@
                }
                fi->fi_flags |= FI_SEL;
                CFGDBG(3, "file slected `%s'", fi->fi_path);
+               if (fi->fi_attr != NULL)
+                       CFGDBG(3, "file `%s' belongs to attr `%s'", fi->fi_path,
+                           fi->fi_attr->a_name);
        }
        return (err);
 }
diff -r 64abb8b962c5 -r 18c32dcd0f77 usr.bin/config/sem.c
--- a/usr.bin/config/sem.c      Thu Oct 09 09:39:24 2014 +0000
+++ b/usr.bin/config/sem.c      Thu Oct 09 10:29:36 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sem.c,v 1.44 2014/10/09 06:49:53 uebayasi Exp $        */
+/*     $NetBSD: sem.c,v 1.45 2014/10/09 10:29:36 uebayasi Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -269,6 +269,7 @@
        a->a_refs = NULL;
        a->a_deps = deps;
        a->a_expanding = 0;
+       TAILQ_INIT(&a->a_files);
 
        /* Expand the attribute to check for cycles in the graph. */
        expandattr(a, NULL);



Home | Main Index | Thread Index | Old Index