Page MenuHomeFreeBSD

D19424.id56265.diff
No OneTemporary

D19424.id56265.diff

Index: head/usr.sbin/config/config.h
===================================================================
--- head/usr.sbin/config/config.h
+++ head/usr.sbin/config/config.h
@@ -86,6 +86,7 @@
struct device {
int d_done; /* processed */
char *d_name; /* name of device (e.g. rk11) */
+ char *yyfile; /* name of the file that first include the device */
#define UNKNOWN -2 /* -2 means not set yet */
STAILQ_ENTRY(device) d_next; /* Next one in list */
};
@@ -125,6 +126,7 @@
char *op_name;
char *op_value;
int op_ownfile; /* true = own file, false = makefile */
+ char *yyfile; /* name of the file that first include the option */
SLIST_ENTRY(opt) op_next;
SLIST_ENTRY(opt) op_append;
};
Index: head/usr.sbin/config/config.y
===================================================================
--- head/usr.sbin/config/config.y
+++ head/usr.sbin/config/config.y
@@ -382,11 +382,13 @@
static void
newdev(char *name)
{
- struct device *np;
+ struct device *np, *dp;
- if (finddev(&dtab, name)) {
- fprintf(stderr,
- "WARNING: duplicate device `%s' encountered.\n", name);
+ if ((dp = finddev(&dtab, name)) != NULL) {
+ if (strcmp(dp->yyfile, yyfile) == 0)
+ fprintf(stderr,
+ "WARNING: duplicate device `%s' encountered in %s\n",
+ name, yyfile);
return;
}
@@ -394,6 +396,7 @@
if (np == NULL)
err(EXIT_FAILURE, "calloc");
np->d_name = name;
+ np->yyfile = strdup(yyfile);
STAILQ_INSERT_TAIL(&dtab, np, d_next);
}
@@ -408,6 +411,7 @@
dp = finddev(dh, name);
if (dp != NULL) {
STAILQ_REMOVE(dh, dp, device, d_next);
+ free(dp->yyfile);
free(dp->d_name);
free(dp);
}
@@ -446,8 +450,9 @@
op2 = findopt(list, name);
if (op2 != NULL && !append && !dupe) {
- fprintf(stderr,
- "WARNING: duplicate option `%s' encountered.\n", name);
+ if (strcmp(op2->yyfile, yyfile) == 0)
+ fprintf(stderr,
+ "WARNING: duplicate option `%s' encountered.\n", name);
return;
}
@@ -457,6 +462,7 @@
op->op_name = name;
op->op_ownfile = 0;
op->op_value = value;
+ op->yyfile = strdup(yyfile);
if (op2 != NULL) {
if (append) {
while (SLIST_NEXT(op2, op_append) != NULL)
@@ -481,6 +487,7 @@
while ((op = findopt(list, name)) != NULL) {
SLIST_REMOVE(list, op, opt, op_next);
+ free(op->yyfile);
free(op->op_name);
free(op);
}

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 21, 3:27 PM (35 m, 57 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27115173
Default Alt Text
D19424.id56265.diff (2 KB)

Event Timeline