Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/usr.bin/config Pull up the following, requested by christ...
details: https://anonhg.NetBSD.org/src/rev/5e0fd06f63b4
branches: netbsd-9
changeset: 963703:5e0fd06f63b4
user: martin <martin%NetBSD.org@localhost>
date: Mon Mar 09 15:22:21 2020 +0000
description:
Pull up the following, requested by christos in ticket #776:
usr.bin/config/TODO up to 1.32
usr.bin/config/defs.h up to 1.105
usr.bin/config/files.c up to 1.37
usr.bin/config/gram.y up to 1.55
usr.bin/config/main.c up to 1.99
usr.bin/config/scan.l up to 1.30
usr.bin/config/sem.c up to 1.84
usr.bin/config/util.c up to 1.21
config(1): fix issue with incorrect handling of elifdef statements.
diffstat:
usr.bin/config/TODO | 2 +-
usr.bin/config/defs.h | 31 ++++----
usr.bin/config/files.c | 66 +++++++++--------
usr.bin/config/gram.y | 6 +-
usr.bin/config/main.c | 41 ++++++----
usr.bin/config/scan.l | 178 ++++++++++++++++++++++++++----------------------
usr.bin/config/sem.c | 60 ++++++++++-----
usr.bin/config/util.c | 10 ++-
8 files changed, 221 insertions(+), 173 deletions(-)
diffs (truncated from 967 to 300 lines):
diff -r 03719e800501 -r 5e0fd06f63b4 usr.bin/config/TODO
--- a/usr.bin/config/TODO Mon Mar 09 13:12:14 2020 +0000
+++ b/usr.bin/config/TODO Mon Mar 09 15:22:21 2020 +0000
@@ -259,7 +259,7 @@
*.ko ---> *.ro Modular MI linkage
*.ro ---> *.kmod Modular MD linkage
- Genric MI linkage is for processing MI linkage that can be applied generally.
+ Generic MI linkage is for processing MI linkage that can be applied generally.
Data section alignment (.data.read_mostly and .data.cacheline_aligned) is
processed here.
diff -r 03719e800501 -r 5e0fd06f63b4 usr.bin/config/defs.h
--- a/usr.bin/config/defs.h Mon Mar 09 13:12:14 2020 +0000
+++ b/usr.bin/config/defs.h Mon Mar 09 15:22:21 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.104 2018/08/27 16:04:45 riastradh Exp $ */
+/* $NetBSD: defs.h,v 1.104.2.1 2020/03/09 15:22:21 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -110,6 +110,10 @@
#define CONFIG_VERSION 20180827
#define CONFIG_MINVERSION 0
+struct where {
+ const char *w_srcfile; /* file name where we are defined */
+ u_short w_srcline; /* line number where we are defined */
+};
/*
* Name/value lists. Values can be strings or pointers and/or can carry
* integers. The names can be NULL, resulting in simple value lists.
@@ -123,6 +127,7 @@
int nv_ifunit; /* XXX XXX XXX */
int nv_flags;
#define NV_DEPENDED 1
+ struct where nv_where;
};
/*
@@ -131,10 +136,10 @@
struct config {
TAILQ_ENTRY(config) cf_next;
const char *cf_name; /* "netbsd" */
- int cf_lineno; /* source line */
const char *cf_fstype; /* file system type */
struct nvlist *cf_root; /* "root on ra0a" */
struct nvlist *cf_dump; /* "dumps on ra0b" */
+ struct where cf_where;
};
/*
@@ -147,6 +152,7 @@
const char *dl_lintvalue;
int dl_obsolete;
struct nvlist *dl_depends;
+ struct where dl_where;
};
struct files;
@@ -199,6 +205,7 @@
/* "device class" */
const char *a_devclass; /* device class described */
+ struct where a_where;
};
/*
@@ -277,8 +284,7 @@
struct deva *d_ahead; /* first attachment, if any */
struct deva **d_app; /* used for tacking on attachments */
struct attr *d_classattr; /* device class attribute (if any) */
- const char *d_srcfile; /* file name where we are defined */
- u_short d_srcline; /* line number where we are defined */
+ struct where d_where;
};
struct deva {
@@ -291,8 +297,7 @@
struct attrlist *d_attrs; /* attributes, if any */
struct devi *d_ihead; /* first instance, if any */
struct devi **d_ipp; /* used for tacking on more instances */
- const char *d_srcfile; /* file name where we are defined */
- u_short d_srcline; /* line number where we are defined */
+ struct where d_where;
};
/*
@@ -319,8 +324,6 @@
struct deva *i_atdeva;
const char **i_locs; /* locators (as given by pspec's iattr) */
int i_cfflags; /* flags from config line */
- int i_lineno; /* line # in config, for later errors */
- const char *i_srcfile; /* file it appears in */
int i_level; /* position between negated instances */
int i_active;
#define DEVI_ORPHAN 0 /* instance has no active parent */
@@ -333,7 +336,7 @@
short i_collapsed; /* set => this alias no longer needed */
u_short i_cfindex; /* our index in cfdata */
int i_locoff; /* offset in locators.vec */
-
+ struct where i_where;
};
/* special units */
#define STAR (-1) /* unit number for, e.g., "sd*" */
@@ -346,8 +349,7 @@
struct files {
TAILQ_ENTRY(files) fi_next;
TAILQ_ENTRY(files) fi_snext; /* per-suffix list */
- const char *fi_srcfile; /* the name of the "files" file that got us */
- u_short fi_srcline; /* and the line number */
+ struct where fi_where;
u_char fi_flags; /* as below */
const char *fi_tail; /* name, i.e., strrchr(fi_path, '/') + 1 */
const char *fi_base; /* tail minus ".c" (or whatever) */
@@ -418,13 +420,12 @@
*/
struct devm {
TAILQ_ENTRY(devm) dm_next;
- const char *dm_srcfile; /* the name of the "majors" file */
- u_short dm_srcline; /* the line number */
const char *dm_name; /* [bc]devsw name */
devmajor_t dm_cmajor; /* character major */
devmajor_t dm_bmajor; /* block major */
struct condexpr *dm_opts; /* options */
struct nvlist *dm_devnodes; /* information on /dev nodes */
+ struct where dm_where;
};
/*
@@ -581,7 +582,7 @@
void delfsoption(const char *, int);
void delmkoption(const char *, int);
int devbase_has_instances(struct devbase *, int);
-int is_declared_option(const char *);
+struct where *find_declared_option(const char *);
int deva_has_instances(struct deva *, int);
void setupdirs(void);
void fixmaxusers(void);
@@ -594,7 +595,7 @@
#define OPT_DEFFLAG(n) (dlhash_lookup(defflagtab, (n)) != NULL)
#define OPT_DEFPARAM(n) (dlhash_lookup(defparamtab, (n)) != NULL)
#define OPT_OBSOLETE(n) (dlhash_lookup(obsopttab, (n)) != NULL)
-#define DEFINED_OPTION(n) (is_declared_option((n)))
+#define DEFINED_OPTION(n) (find_declared_option((n)))
/* main.c */
void logconfig_include(FILE *, const char *);
diff -r 03719e800501 -r 5e0fd06f63b4 usr.bin/config/files.c
--- a/usr.bin/config/files.c Mon Mar 09 13:12:14 2020 +0000
+++ b/usr.bin/config/files.c Mon Mar 09 15:22:21 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: files.c,v 1.36 2016/09/09 21:09:11 christos Exp $ */
+/* $NetBSD: files.c,v 1.36.16.1 2020/03/09 15:22:21 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: files.c,v 1.36 2016/09/09 21:09:11 christos Exp $");
+__RCSID("$NetBSD: files.c,v 1.36.16.1 2020/03/09 15:22:21 martin Exp $");
#include <sys/param.h>
#include <assert.h>
@@ -158,19 +158,19 @@
* options for specific files.
*/
if (rule != NULL && optx == NULL && flags == 0 &&
- yyfile != fi->fi_srcfile) {
+ yyfile != fi->fi_where.w_srcfile) {
fi->fi_mkrule = rule;
return;
}
cfgerror("duplicate file %s", path);
- cfgxerror(fi->fi_srcfile, fi->fi_srcline,
+ cfgxerror(fi->fi_where.w_srcfile, fi->fi_where.w_srcline,
"here is the original definition");
goto bad;
}
memcpy(base, tail, baselen);
base[baselen] = '\0';
- fi->fi_srcfile = yyfile;
- fi->fi_srcline = currentline();
+ fi->fi_where.w_srcfile = yyfile;
+ fi->fi_where.w_srcline = currentline();
fi->fi_flags = flags;
fi->fi_path = path;
fi->fi_tail = tail;
@@ -204,7 +204,7 @@
TAILQ_INSERT_TAIL(&allfiles, fi, fi_next);
break;
default:
- cfgxerror(fi->fi_srcfile, fi->fi_srcline,
+ cfgxerror(fi->fi_where.w_srcfile, fi->fi_where.w_srcline,
"unknown suffix");
break;
}
@@ -262,7 +262,7 @@
struct files *fi = context;
if (ht_lookup(devbasetab, name) == NULL) {
- cfgxerror(fi->fi_srcfile, fi->fi_srcline,
+ cfgxerror(fi->fi_where.w_srcfile, fi->fi_where.w_srcline,
"`%s' is not a countable device",
name);
/* keep fixfiles() from complaining again */
@@ -356,10 +356,10 @@
ofi->fi_flags &= (u_char)~FI_SEL;
ofi->fi_flags |= FI_HIDDEN;
} else {
- cfgxerror(fi->fi_srcfile, fi->fi_srcline,
+ cfgxerror(fi->fi_where.w_srcfile, fi->fi_where.w_srcline,
"object file collision on %s.o, from %s",
fi->fi_base, fi->fi_path);
- cfgxerror(ofi->fi_srcfile, ofi->fi_srcline,
+ cfgxerror(ofi->fi_where.w_srcfile, ofi->fi_where.w_srcline,
"here is the previous file: %s",
ofi->fi_path);
err = 1;
@@ -412,22 +412,25 @@
if (res != NULL) {
if (res->dm_cmajor != dm->dm_cmajor ||
res->dm_bmajor != dm->dm_bmajor) {
- cfgxerror(res->dm_srcfile, res->dm_srcline,
- "device-major '%s' "
- "block %d, char %d redefined"
- " at %s:%d as block %d, char %d",
- res->dm_name,
- res->dm_bmajor, res->dm_cmajor,
- dm->dm_srcfile, dm->dm_srcline,
- dm->dm_bmajor, dm->dm_cmajor);
+ cfgxerror(res->dm_where.w_srcfile,
+ res->dm_where.w_srcline,
+ "device-major '%s' "
+ "block %d, char %d redefined"
+ " at %s:%d as block %d, char %d",
+ res->dm_name,
+ res->dm_bmajor, res->dm_cmajor,
+ dm->dm_where.w_srcfile, dm->dm_where.w_srcline,
+ dm->dm_bmajor, dm->dm_cmajor);
} else {
- cfgxerror(res->dm_srcfile, res->dm_srcline,
- "device-major '%s' "
- "(block %d, char %d) duplicated"
- " at %s:%d",
- dm->dm_name, dm->dm_bmajor,
- dm->dm_cmajor,
- dm->dm_srcfile, dm->dm_srcline);
+ cfgxerror(res->dm_where.w_srcfile,
+ res->dm_where.w_srcline,
+ "device-major '%s' "
+ "(block %d, char %d) duplicated"
+ " at %s:%d",
+ dm->dm_name, dm->dm_bmajor,
+ dm->dm_cmajor,
+ dm->dm_where.w_srcfile,
+ dm->dm_where.w_srcline);
}
error = 1;
goto out;
@@ -443,15 +446,16 @@
if (dm->dm_cmajor != NODEVMAJOR) {
if (ht_lookup(cdevmtab, intern(dm->dm_name)) != NULL) {
- cfgxerror(dm->dm_srcfile, dm->dm_srcline,
- "device-major of character device '%s' "
- "is already defined", dm->dm_name);
+ cfgxerror(dm->dm_where.w_srcfile,
+ dm->dm_where.w_srcline,
+ "device-major of character device '%s' "
+ "is already defined", dm->dm_name);
error = 1;
goto out;
}
(void)snprintf(mstr, sizeof(mstr), "%d", dm->dm_cmajor);
if (ht_lookup(cdevmtab, intern(mstr)) != NULL) {
- cfgxerror(dm->dm_srcfile, dm->dm_srcline,
+ cfgxerror(dm->dm_where.w_srcfile, dm->dm_where.w_srcline,
"device-major of character major '%d' "
"is already defined", dm->dm_cmajor);
error = 1;
@@ -465,7 +469,7 @@
}
if (dm->dm_bmajor != NODEVMAJOR) {
if (ht_lookup(bdevmtab, intern(dm->dm_name)) != NULL) {
- cfgxerror(dm->dm_srcfile, dm->dm_srcline,
+ cfgxerror(dm->dm_where.w_srcfile, dm->dm_where.w_srcline,
"device-major of block device '%s' "
"is already defined", dm->dm_name);
error = 1;
@@ -473,7 +477,7 @@
}
(void)snprintf(mstr, sizeof(mstr), "%d", dm->dm_bmajor);
if (ht_lookup(bdevmtab, intern(mstr)) != NULL) {
- cfgxerror(dm->dm_srcfile, dm->dm_srcline,
+ cfgxerror(dm->dm_where.w_srcfile, dm->dm_where.w_srcline,
"device-major of block major '%d' "
Home |
Main Index |
Thread Index |
Old Index