? o Index: defs.h =================================================================== RCS file: /cvsroot/src/usr.bin/config/defs.h,v retrieving revision 1.95 diff -u -p -u -r1.95 defs.h --- defs.h 18 Mar 2016 15:05:49 -0000 1.95 +++ defs.h 6 Aug 2016 08:33:10 -0000 @@ -569,9 +569,9 @@ void deffilesystem(struct nvlist *, stru void defoption(const char *, struct defoptlist *, struct nvlist *); void defflag(const char *, struct defoptlist *, struct nvlist *, int); void defparam(const char *, struct defoptlist *, struct nvlist *, int); -void deloption(const char *); -void delfsoption(const char *); -void delmkoption(const char *); +void deloption(const char *, int); +void delfsoption(const char *, int); +void delmkoption(const char *, int); int devbase_has_instances(struct devbase *, int); int is_declared_option(const char *); int deva_has_instances(struct deva *, int); Index: gram.y =================================================================== RCS file: /cvsroot/src/usr.bin/config/gram.y,v retrieving revision 1.53 diff -u -p -u -r1.53 gram.y --- gram.y 29 Apr 2016 18:18:22 -0000 1.53 +++ gram.y 6 Aug 2016 08:33:12 -0000 @@ -60,6 +60,7 @@ __RCSID("$NetBSD: gram.y,v 1.53 2016/04/ #define stop(s) cfgerror(s), exit(1) static struct config conf; /* at most one active at a time */ +static int nowarn; /* if warning suppression is on */ /* @@ -178,7 +179,7 @@ static struct loclist *namelocvals(const %token IDENT IOCONF %token LINKZERO %token XMACHINE MAJOR MAKEOPTIONS MAXUSERS MAXPARTITIONS MINOR -%token NEEDS_COUNT NEEDS_FLAG NO +%token NEEDS_COUNT NEEDS_FLAG NO CNO %token XOBJECT OBSOLETE ON OPTIONS %token PACKAGE PLUSEQ PREFIX BUILDPREFIX PSEUDO_DEVICE PSEUDO_ROOT %token ROOT @@ -213,7 +214,7 @@ static struct loclist *namelocvals(const %type value %type major_minor %type signed_number -%type int32 npseudo device_flags +%type int32 npseudo device_flags no %type deffs %type deffses %type defopt @@ -292,6 +293,11 @@ subarches: | subarches WORD { $$ = new_nx($2, $1); } ; +no: + NO { $$ = 0; } + | CNO { $$ = 1; } +; + /************************************************************/ /* @@ -740,11 +746,11 @@ select_attr: ; select_no_attr: - NO SELECT WORD { delattr($3); } + no SELECT WORD { delattr($3, $1); } ; select_no_filesystems: - NO FILE_SYSTEM no_fs_list + no FILE_SYSTEM { nowarn = $1; } no_fs_list { nowarn = 0; } ; select_filesystems: @@ -752,7 +758,7 @@ select_filesystems: ; select_no_makeoptions: - NO MAKEOPTIONS no_mkopt_list + no MAKEOPTIONS { nowarn = $1; } no_mkopt_list { nowarn = 0; } ; select_makeoptions: @@ -760,7 +766,7 @@ select_makeoptions: ; select_no_options: - NO OPTIONS no_opt_list + no OPTIONS { nowarn = $1; } no_opt_list { nowarn = 0; } ; select_options: @@ -776,7 +782,7 @@ select_ident: ; select_no_ident: - NO IDENT { setident(NULL); } + no IDENT { setident(NULL); } ; select_config: @@ -785,11 +791,11 @@ select_config: ; select_no_config: - NO CONFIG WORD { delconf($3); } + no CONFIG WORD { delconf($3, $1); } ; select_no_pseudodev: - NO PSEUDO_DEVICE WORD { delpseudo($3); } + no PSEUDO_DEVICE WORD { delpseudo($3, $1); } ; select_pseudodev: @@ -801,16 +807,16 @@ select_pseudoroot: ; select_no_device_instance_attachment: - NO device_instance AT attachment - { deldevi($2, $4); } + no device_instance AT attachment + { deldevi($2, $4, $1); } ; select_no_device_attachment: - NO DEVICE AT attachment { deldeva($4); } + no DEVICE AT attachment { deldeva($4, $1); } ; select_no_device_instance: - NO device_instance { deldev($2); } + no device_instance { deldev($2, $1); } ; select_device_instance: @@ -837,7 +843,7 @@ no_fs_list: /* one filesystem that had NO in front */ no_fsoption: - WORD { delfsoption($1); } + WORD { delfsoption($1, nowarn); } ; /* list of make options */ @@ -862,7 +868,7 @@ no_mkopt_list: /* one make option that had NO in front */ /* XXX shouldn't this be mkvarname rather than WORD? */ no_mkoption: - WORD { delmkoption($1); } + WORD { delmkoption($1, nowarn); } ; /* list of options */ @@ -885,7 +891,7 @@ no_opt_list: /* one option that had NO in front */ no_option: - WORD { deloption($1); } + WORD { deloption($1, nowarn); } ; /* the name in "config name root on ..." */ Index: main.c =================================================================== RCS file: /cvsroot/src/usr.bin/config/main.c,v retrieving revision 1.89 diff -u -p -u -r1.89 main.c --- main.c 4 Sep 2015 06:01:40 -0000 1.89 +++ main.c 6 Aug 2016 08:33:24 -0000 @@ -119,7 +119,7 @@ static int do_option(struct hashtab *, s struct nvlist ***, const char *, const char *, const char *, struct hashtab *); static int undo_option(struct hashtab *, struct nvlist **, - struct nvlist ***, const char *, const char *); + struct nvlist ***, const char *, const char *, int); static int crosscheck(void); static int badstar(void); int main(int, char **); @@ -1082,13 +1082,13 @@ addoption(const char *name, const char * } void -deloption(const char *name) +deloption(const char *name, int nowarn) { CFGDBG(4, "deselecting opt `%s'", name); - if (undo_option(opttab, &options, &nextopt, name, "options")) + if (undo_option(opttab, &options, &nextopt, name, "options", nowarn)) return; - if (undo_option(selecttab, NULL, NULL, strtolower(name), "options")) + if (undo_option(selecttab, NULL, NULL, strtolower(name), "options", nowarn)) return; } @@ -1131,15 +1131,15 @@ addfsoption(const char *name) } void -delfsoption(const char *name) +delfsoption(const char *name, int nowarn) { const char *n; CFGDBG(4, "deselecting fs `%s'", name); n = strtolower(name); - if (undo_option(fsopttab, &fsoptions, &nextfsopt, name, "file-system")) + if (undo_option(fsopttab, &fsoptions, &nextfsopt, name, "file-system", nowarn)) return; - if (undo_option(selecttab, NULL, NULL, n, "file-system")) + if (undo_option(selecttab, NULL, NULL, n, "file-system", nowarn)) return; } @@ -1155,12 +1155,12 @@ addmkoption(const char *name, const char } void -delmkoption(const char *name) +delmkoption(const char *name, int nowarn) { CFGDBG(4, "deselecting mkopt `%s'", name); (void)undo_option(mkopttab, &mkoptions, &nextmkopt, name, - "makeoptions"); + "makeoptions", nowarn); } /* @@ -1243,10 +1243,10 @@ do_option(struct hashtab *ht, struct nvl else cfgwarn("already have %s `%s'", type, name); - if (undo_option(ht, npp, next, name, type)) + if (undo_option(ht, npp, next, name, type, 0)) panic("do_option 2"); if (stab != NULL && - undo_option(stab, NULL, NULL, strtolower(name), type)) + undo_option(stab, NULL, NULL, strtolower(name), type, 0)) panic("do_option 3"); /* now try adding it again */ @@ -1267,7 +1267,7 @@ do_option(struct hashtab *ht, struct nvl */ static int undo_option(struct hashtab *ht, struct nvlist **npp, - struct nvlist ***next, const char *name, const char *type) + struct nvlist ***next, const char *name, const char *type, int nowarn) { struct nvlist *nv; @@ -1275,7 +1275,7 @@ undo_option(struct hashtab *ht, struct n /* * -U command line option removals are always silent */ - if (!handling_cmdlineopts) + if (!handling_cmdlineopts && !nowarn) cfgwarn("%s `%s' is not defined", type, name); return (1); } @@ -2018,7 +2018,7 @@ handle_cmdline_makeoptions(void) handling_cmdlineopts = 1; for (p = cmdlineundefs; p; p = n) { n = p->nv_next; - delmkoption(intern(p->nv_name)); + delmkoption(intern(p->nv_name), 0); free(__UNCONST(p->nv_name)); nvfree(p); } @@ -2026,7 +2026,7 @@ handle_cmdline_makeoptions(void) const char *name = intern(p->nv_name); n = p->nv_next; - delmkoption(name); + delmkoption(name, 0); addmkoption(name, intern(p->nv_str)); free(__UNCONST(p->nv_name)); free(__UNCONST(p->nv_str)); Index: scan.l =================================================================== RCS file: /cvsroot/src/usr.bin/config/scan.l,v retrieving revision 1.25 diff -u -p -u -r1.25 scan.l --- scan.l 4 Sep 2015 10:16:35 -0000 1.25 +++ scan.l 6 Aug 2016 08:33:25 -0000 @@ -131,6 +131,7 @@ attach return ATTACH; block return BLOCK; build return BUILD; char return CHAR; +cno return CNO; compile-with return COMPILE_WITH; config return CONFIG; deffs return DEFFS; Index: sem.c =================================================================== RCS file: /cvsroot/src/usr.bin/config/sem.c,v retrieving revision 1.74 diff -u -p -u -r1.74 sem.c --- sem.c 29 Apr 2016 18:18:22 -0000 1.74 +++ sem.c 6 Aug 2016 08:33:32 -0000 @@ -1051,13 +1051,14 @@ setconf(struct nvlist **npp, const char } void -delconf(const char *name) +delconf(const char *name, int nowarn) { struct config *cf; CFGDBG(5, "deselecting config `%s'", name); if (ht_lookup(cfhashtab, name) == NULL) { - cfgerror("configuration `%s' undefined", name); + if (!nowarn) + cfgerror("configuration `%s' undefined", name); return; } (void)ht_remove(cfhashtab, name); @@ -1266,7 +1267,7 @@ adddev(const char *name, const char *at, } void -deldevi(const char *name, const char *at) +deldevi(const char *name, const char *at, int nowarn) { struct devi *firsti, *i; struct devbase *d; @@ -1275,12 +1276,15 @@ deldevi(const char *name, const char *at CFGDBG(5, "deselecting devi `%s'", name); if (split(name, strlen(name), base, sizeof base, &unit)) { - cfgerror("invalid device name `%s'", name); - return; + if (!nowarn) { + cfgerror("invalid device name `%s'", name); + return; + } } d = ht_lookup(devbasetab, intern(base)); if (d == NULL) { - cfgerror("%s: unknown device `%s'", name, base); + if (!nowarn) + cfgerror("%s: unknown device `%s'", name, base); return; } if (d->d_ispseudo) { @@ -1466,7 +1470,7 @@ remove_devi(struct devi *i) } void -deldeva(const char *at) +deldeva(const char *at, int nowarn) { int unit; const char *cp; @@ -1565,7 +1569,7 @@ out: } void -deldev(const char *name) +deldev(const char *name, int nowarn) { size_t l; struct devi *firsti, *i; @@ -1581,7 +1585,8 @@ deldev(const char *name) firsti = ht_lookup(devitab, name); if (firsti == NULL) { out: - cfgerror("unknown instance %s", name); + if (!nowarn) + cfgerror("unknown instance %s", name); return; } for (i = firsti; i != NULL; i = i->i_alias) @@ -1721,7 +1726,7 @@ addpseudo(const char *name, int number) } void -delpseudo(const char *name) +delpseudo(const char *name, int nowarn) { struct devbase *d; struct devi *i; @@ -1729,7 +1734,8 @@ delpseudo(const char *name) CFGDBG(5, "deselecting pseudo `%s'", name); d = ht_lookup(devbasetab, name); if (d == NULL) { - cfgerror("undefined pseudo-device %s", name); + if (!nowarn) + cfgerror("undefined pseudo-device %s", name); return; } if (!d->d_ispseudo) { @@ -1737,7 +1743,8 @@ delpseudo(const char *name) return; } if ((i = ht_lookup(devitab, name)) == NULL) { - cfgerror("`%s' not defined", name); + if (!nowarn) + cfgerror("`%s' not defined", name); return; } d->d_umax = 0; /* clear neads-count entries */ @@ -1969,7 +1976,7 @@ addattr(const char *name) } void -delattr(const char *name) +delattr(const char *name, int nowarn) { struct attr *a; @@ -1999,7 +2006,7 @@ deselectattrcb2(const char *name1, const const char *name = arg; if (strcmp(name, name2) == 0) - delattr(name1); + delattr(name1, 0); return 0; } Index: sem.h =================================================================== RCS file: /cvsroot/src/usr.bin/config/sem.h,v retrieving revision 1.19 diff -u -p -u -r1.19 sem.h --- sem.h 21 Nov 2014 20:46:56 -0000 1.19 +++ sem.h 6 Aug 2016 08:33:32 -0000 @@ -61,21 +61,21 @@ struct attr *refattr(const char *); int getrefattr(const char *, struct attr **); void expandattr(struct attr *, void (*)(struct attr *)); void addattr(const char *); -void delattr(const char *); +void delattr(const char *, int); void selectattr(struct attr *); void deselectattr(struct attr *); void dependattrs(void); void setmajor(struct devbase *, int); void addconf(struct config *); void setconf(struct nvlist **, const char *, struct nvlist *); -void delconf(const char *); +void delconf(const char *, int); void setfstype(const char **, const char *); void adddev(const char *, const char *, struct loclist *, int); -void deldevi(const char *, const char *); -void deldeva(const char *); -void deldev(const char *); +void deldevi(const char *, const char *, int); +void deldeva(const char *, int); +void deldev(const char *, int); void addpseudo(const char *, int); -void delpseudo(const char *); +void delpseudo(const char *, int); void addpseudoroot(const char *); void adddevm(const char *, devmajor_t, devmajor_t, struct condexpr *, struct nvlist *);