diff options
author | peter <peter@FreeBSD.org> | 1995-12-11 10:52:34 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1995-12-11 10:52:34 +0000 |
commit | 7a7fb14fa9b36f5a77f0861c85e6bb995aa6b757 (patch) | |
tree | ef03c70fe9e388e67ab0c2e18b675681568a8009 /usr.sbin/config/config.y | |
parent | d7af2f0a80cee1f5b4fa606c79490ec68445ee7b (diff) | |
download | FreeBSD-src-7a7fb14fa9b36f5a77f0861c85e6bb995aa6b757.zip FreeBSD-src-7a7fb14fa9b36f5a77f0861c85e6bb995aa6b757.tar.gz |
Implement support for conf/options and i386/conf/options.i386
Note that this code is dormant unless the options files exist.
Also, parsing of quoted options in the config files is improved.
What this allows, is all the options in LINT to be specified to be
configured as #defines in a file rather than on the CC command line at
kernel build time. This means that 'make depend' will catch dependencies
on actual *options*, meaning that you can run 'config' and 'make depend'
in complete safety WITHOUT removing the compile directory each time.
Unfortunately, this requires a pass over the source to get the individual
files to #include the new .h files that would be generated by config.
This has a small compile time penalty (appears up to about 2% slower)
from a "fresh" build. Of course, you should not be needing to do complete
rebuilds very often once this was completed, so it would be an overall
win for most people.
Since this code is dormant and we've got a lot of other things happening
on the kernel tree at the moment (prototypes, devfs, static declarations
etc) I am not planning on doing any changes to activate this feature just
yet.
Diffstat (limited to 'usr.sbin/config/config.y')
-rw-r--r-- | usr.sbin/config/config.y | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index c161952..78d8bf4 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -9,6 +9,7 @@ %token ANY %token ARGS %token AT +%token AUTO %token BIO %token BUS %token COMMA @@ -37,6 +38,7 @@ %token MINUS %token NET %token NEXUS +%token NONE %token ON %token OPTIONS %token MAKEOPTIONS @@ -118,6 +120,7 @@ #include <ctype.h> #include <stdio.h> #include <err.h> +#include <string.h> struct device cur; struct device *curp = 0; @@ -183,6 +186,7 @@ Config_spec: = { struct cputype *cp = (struct cputype *)malloc(sizeof (struct cputype)); + memset(cp, 0, sizeof(*cp)); cp->cpu_name = ns($2); cp->cpu_next = cputype; cputype = cp; @@ -389,15 +393,23 @@ Option: Save_id = { struct opt *op = (struct opt *)malloc(sizeof (struct opt)); + char *s; + memset(op, 0, sizeof(*op)); op->op_name = ns($1); op->op_next = opt; op->op_value = 0; opt = op; + if (s = strchr(op->op_name, '=')) { + /* AARGH!!!! Old-style bogon */ + *s = '\0'; + op->op_value = ns(s + 1); + } free(temp_id); } | Save_id EQUALS Opt_value = { struct opt *op = (struct opt *)malloc(sizeof (struct opt)); + memset(op, 0, sizeof(*op)); op->op_name = ns($1); op->op_next = opt; op->op_value = ns($3); @@ -432,7 +444,9 @@ Mkoption: Save_id EQUALS Opt_value = { struct opt *op = (struct opt *)malloc(sizeof (struct opt)); + memset(op, 0, sizeof(*op)); op->op_name = ns($1); + op->op_ownfile = 0; /* for now */ op->op_next = mkopt; op->op_value = ns($3); mkopt = op; @@ -607,6 +621,10 @@ Info: = { cur.d_port = ns($2); } | PORT NUMBER = { cur.d_portn = $2; } | + PORT AUTO + = { cur.d_portn = -1; } | + PORT NONE + = { cur.d_portn = -2; } | TTY = { cur.d_mask = "tty"; } | BIO @@ -630,11 +648,13 @@ Id_list: Save_id = { struct idlst *a = (struct idlst *)malloc(sizeof(struct idlst)); + memset(a, 0, sizeof(*a)); a->id = $1; a->id_next = 0; $$ = a; } | Save_id Id_list = { struct idlst *a = (struct idlst *)malloc(sizeof(struct idlst)); + memset(a, 0, sizeof(*a)); a->id = $1; a->id_next = $2; $$ = a; }; @@ -670,6 +690,7 @@ newdev(dp) register struct device *np; np = (struct device *) malloc(sizeof *np); + memset(np, 0, sizeof(*np)); *np = *dp; np->d_next = 0; if (curp == 0) @@ -688,6 +709,7 @@ mkconf(sysname) register struct file_list *fl, **flp; fl = (struct file_list *) malloc(sizeof *fl); + memset(fl, 0, sizeof(*fl)); fl->f_type = SYSTEMSPEC; fl->f_needs = sysname; fl->f_rootdev = NODEV; @@ -705,6 +727,7 @@ newflist(ftype) u_char ftype; { struct file_list *fl = (struct file_list *)malloc(sizeof (*fl)); + memset(fl, 0, sizeof(*fl)); fl->f_type = ftype; fl->f_next = 0; @@ -763,6 +786,7 @@ mkcomp(dp) char buf[80]; fl = (struct file_list *) malloc(sizeof *fl); + memset(fl, 0, sizeof(*fl)); fl->f_type = COMPDEVICE; fl->f_compinfo = dp->d_unit; fl->f_fn = ns(dp->d_name); |