summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-07-21 23:02:35 +0000
committerpeter <peter@FreeBSD.org>2002-07-21 23:02:35 +0000
commiteef62e3d23753f0556148d4cdfb6805070ff4d6f (patch)
treeb310aa0a061847b61daf86637a15eeb43b0140b5 /usr.sbin
parentfb92891b11e9cd578e0d132f8f57c0c04b8a8230 (diff)
downloadFreeBSD-src-eef62e3d23753f0556148d4cdfb6805070ff4d6f.zip
FreeBSD-src-eef62e3d23753f0556148d4cdfb6805070ff4d6f.tar.gz
Check for missing static unit 'count' declarations as well.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/config/mkheaders.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/usr.sbin/config/mkheaders.c b/usr.sbin/config/mkheaders.c
index ddd3337..1240ba8 100644
--- a/usr.sbin/config/mkheaders.c
+++ b/usr.sbin/config/mkheaders.c
@@ -51,7 +51,7 @@ static const char rcsid[] =
#include "config.h"
#include "y.tab.h"
-static void do_header(char *, int);
+static int do_header(char *, int);
static void nocount(char *);
static char *toheader(char *);
static char *tomacro(char *);
@@ -75,7 +75,7 @@ headers(void)
}
}
if (fl->f_flags & NEED_COUNT)
- do_header(fl->f_needs, match);
+ errors += do_header(fl->f_needs, match);
}
}
for (dp = dtab; dp != 0; dp = dp->d_next) {
@@ -107,7 +107,7 @@ headers(void)
errx(1, "%d errors", errors);
}
-static void
+static int
do_header(char *dev, int match)
{
char *file, *name, *inw;
@@ -116,16 +116,21 @@ do_header(char *dev, int match)
FILE *inf, *outf;
int inc, oldcount;
int count, hicount;
+ int errors;
/*
* After this loop, "count" will be the actual number of units,
* and "hicount" will be the highest unit declared. do_header()
* must use this higher of these values.
*/
+ errors = 0;
for (hicount = count = 0, dp = dtab; dp != 0; dp = dp->d_next) {
if (eq(dp->d_name, dev)) {
- count =
- dp->d_count != UNKNOWN ? dp->d_count : 1;
+ if (dp->d_count == UNKNOWN) {
+ warnx("Device \"%s\" requires a count", dev);
+ return 1;
+ }
+ count = dp->d_count;
break;
}
}
@@ -142,7 +147,7 @@ do_header(char *dev, int match)
err(1, "%s", file);
fprintf(outf, "#define %s %d\n", name, count);
(void) fclose(outf);
- return;
+ return 0;
}
fl_head = NULL;
for (;;) {
@@ -177,7 +182,7 @@ do_header(char *dev, int match)
free(fl->f_fn);
free(fl);
}
- return;
+ return 0;
}
if (oldcount == -1) {
fl = (struct file_list *) malloc(sizeof *fl);
@@ -198,6 +203,7 @@ do_header(char *dev, int match)
free(fl);
}
(void) fclose(outf);
+ return 0;
}
/*
OpenPOWER on IntegriCloud