diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2012-09-17 17:36:14 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2012-09-17 17:36:14 +0000 |
commit | 90da2d415131bb0b57c6d426e148aa72348ed88e (patch) | |
tree | d976cc409e3a9a9cc080f51a34c362884065541e | |
parent | 792539ba1233c55fdd2a55ebba3615fb22de6379 (diff) |
tedu lint tendrils through config internals.
also mark some known targets as .PHONY
okay miod@
-rw-r--r-- | usr.sbin/config/config.h | 6 | ||||
-rw-r--r-- | usr.sbin/config/files.c | 8 | ||||
-rw-r--r-- | usr.sbin/config/gram.y | 11 | ||||
-rw-r--r-- | usr.sbin/config/mkmakefile.c | 60 | ||||
-rw-r--r-- | usr.sbin/config/scan.l | 3 |
5 files changed, 22 insertions, 66 deletions
diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index 373df720c2f..8ed35eafe29 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -1,4 +1,4 @@ -/* $OpenBSD: config.h,v 1.23 2007/11/25 08:26:59 deraadt Exp $ */ +/* $OpenBSD: config.h,v 1.24 2012/09/17 17:36:13 espie Exp $ */ /* $NetBSD: config.h,v 1.30 1997/02/02 21:12:30 thorpej Exp $ */ /* @@ -229,7 +229,7 @@ struct files { const char *fi_base; /* tail minus ".c" (or whatever) */ struct nvlist *fi_optx;/* options expression */ struct nvlist *fi_optf;/* flattened version of above, if needed */ - const char *fi_mkrule[2];/* special make rules, if any */ + const char *fi_mkrule;/* special make rules, if any */ }; /* @@ -319,7 +319,7 @@ void initfiles(void); void checkfiles(void); int fixfiles(void); /* finalize */ int fixobjects(void); -void addfile(struct nvlist *, struct nvlist *, int, const char *, const char *); +void addfile(struct nvlist *, struct nvlist *, int, const char *); void addobject(const char *, struct nvlist *, int); /* hash.c */ diff --git a/usr.sbin/config/files.c b/usr.sbin/config/files.c index 1e7c1efcbb4..b80f6e5cdd0 100644 --- a/usr.sbin/config/files.c +++ b/usr.sbin/config/files.c @@ -1,4 +1,4 @@ -/* $OpenBSD: files.c,v 1.18 2011/10/02 22:20:49 edd Exp $ */ +/* $OpenBSD: files.c,v 1.19 2012/09/17 17:36:13 espie Exp $ */ /* $NetBSD: files.c,v 1.6 1996/03/17 13:18:17 cgd Exp $ */ /* @@ -90,8 +90,7 @@ initfiles(void) } void -addfile(struct nvlist *nvpath, struct nvlist *optx, int flags, const char *rule, - const char *lintrule) +addfile(struct nvlist *nvpath, struct nvlist *optx, int flags, const char *rule) { struct files *fi; const char *dotp, *dotp1, *tail, *path, *tail1 = NULL; @@ -164,8 +163,7 @@ addfile(struct nvlist *nvpath, struct nvlist *optx, int flags, const char *rule, fi->fi_base = intern(base); fi->fi_optx = optx; fi->fi_optf = NULL; - fi->fi_mkrule[0] = rule; - fi->fi_mkrule[1] = lintrule; + fi->fi_mkrule = rule; *nextfile = fi; nextfile = &fi->fi_next; return; diff --git a/usr.sbin/config/gram.y b/usr.sbin/config/gram.y index 0cbd36abcf1..da4a6177a56 100644 --- a/usr.sbin/config/gram.y +++ b/usr.sbin/config/gram.y @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: gram.y,v 1.22 2008/03/24 21:35:03 maja Exp $ */ +/* $OpenBSD: gram.y,v 1.23 2012/09/17 17:36:13 espie Exp $ */ /* $NetBSD: gram.y,v 1.14 1997/02/02 21:12:32 thorpej Exp $ */ /* @@ -96,7 +96,7 @@ static void check_maxpart(void); int val; } -%token AND AT ATTACH BUILD COMPILE_WITH LINT_WITH CONFIG DEFINE DEFOPT +%token AND AT ATTACH BUILD COMPILE_WITH CONFIG DEFINE DEFOPT %token DEVICE DISABLE %token DUMPS ENDFILE XFILE XOBJECT FLAGS INCLUDE XMACHINE MAJOR MAKEOPTIONS %token MAXUSERS MAXPARTITIONS MINOR ON OPTIONS PSEUDO_DEVICE ROOT SOURCE SWAP @@ -111,7 +111,6 @@ static void check_maxpart(void); %type <list> fopts fexpr fatom %type <val> fflgs fflag oflgs oflag %type <str> rule -%type <str> lintrule %type <attr> attr %type <devb> devbase %type <deva> devattach_opt @@ -175,7 +174,7 @@ pathnames: * Various nonterminals shared between the grammars. */ file: - XFILE pathnames fopts fflgs rule lintrule { addfile($2, $3, $4, $5, $6); }; + XFILE pathnames fopts fflgs rule { addfile($2, $3, $4, $5); }; object: XOBJECT PATHNAME fopts oflgs { addobject($2, $3, $4); }; @@ -214,10 +213,6 @@ rule: COMPILE_WITH WORD { $$ = $2; } | /* empty */ { $$ = NULL; }; -lintrule: - LINT_WITH WORD { $$ = $2; } | - /* empty */ { $$ = NULL; }; - include: INCLUDE WORD { include($2, 0); }; diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 55a705036d8..1e1d90d8489 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkmakefile.c,v 1.36 2011/10/02 22:20:50 edd Exp $ */ +/* $OpenBSD: mkmakefile.c,v 1.37 2012/09/17 17:36:13 espie Exp $ */ /* $NetBSD: mkmakefile.c,v 1.34 1997/02/02 21:12:36 thorpej Exp $ */ /* @@ -282,7 +282,7 @@ emitobjs(FILE *fp) int lpos, len, sp; const char *fpath; - if (fputs("LINTS=", fp) < 0) + if (fputs("OBJS=", fp) < 0) return (1); sp = '\t'; lpos = 7; @@ -291,32 +291,6 @@ emitobjs(FILE *fp) continue; if ((fpath = srcpath(fi)) == NULL) return (1); - len = strlen(fpath); - if (fpath[len - 1] == 's' || fpath[len - 1] == 'S') - continue; - len = strlen(fi->fi_base) + 3; - if (lpos + len > 72) { - if (fputs(" \\\n", fp) < 0) - return (1); - sp = '\t'; - lpos = 7; - } - if (fprintf(fp, "%c%s.ln", sp, fi->fi_base) < 0) - return (1); - lpos += len + 1; - sp = ' '; - } - if (fputs("\n\nOBJS=\t${LINTS:.ln=.o}", fp) < 0) - return (1); - lpos = 7 + strlen("${LINTS:.ln=.o}"); - for (fi = allfiles; fi != NULL; fi = fi->fi_next) { - if ((fi->fi_flags & FI_SEL) == 0) - continue; - if ((fpath = srcpath(fi)) == NULL) - return (1); - len = strlen(fpath); - if (fpath[len - 1] != 's' && fpath[len - 1] != 'S') - continue; len = strlen(fi->fi_base) + 3; if (lpos + len > 72) { if (fputs(" \\\n", fp) < 0) @@ -406,14 +380,13 @@ emitfiles(FILE *fp, int suffix) * Emit the make-rules. */ static int -emit_1rule(FILE *fp, struct files *fi, const char *fpath, const char *suffix, - int ruleindex) +emit_1rule(FILE *fp, struct files *fi, const char *fpath, const char *suffix) { if (fprintf(fp, "%s%s: %s%s\n", fi->fi_base, suffix, *fpath != '/' ? "$S/" : "", fpath) < 0) return (1); - if (fi->fi_mkrule[ruleindex] != NULL) { - if (fprintf(fp, "\t%s\n\n", fi->fi_mkrule[ruleindex]) < 0) + if (fi->fi_mkrule != NULL) { + if (fprintf(fp, "\t%s\n\n", fi->fi_mkrule) < 0) return (1); } return (0); @@ -428,25 +401,18 @@ emitrules(FILE *fp) /* write suffixes */ if (fprintf(fp, ".SUFFIXES:\n" - ".SUFFIXES: .s .S .c .o .ln\n\n" + ".SUFFIXES: .s .S .c .o\n\n" + + ".PHONY: depend all install clean tags\n\n" ".c.o:\n" "\t${NORMAL_C}\n\n" - ".c.ln:\n" - "\t${LINT_C}\n\n" - ".s.o:\n" "\t${NORMAL_S}\n\n" - ".s.ln:\n" - "\t${LINT_S}\n\n" - ".S.o:\n" - "\t${NORMAL_S}\n\n" - - ".S.ln:\n" - "\t${LINT_S}\n\n") < 0) + "\t${NORMAL_S}\n\n") < 0) return (1); @@ -456,14 +422,12 @@ emitrules(FILE *fp) if ((fpath = srcpath(fi)) == NULL) return (1); /* special rule: need to emit them independently */ - if (fi->fi_mkrule[0] || fi->fi_mkrule[1]) { - if (emit_1rule(fp, fi, fpath, ".o", 0) || - emit_1rule(fp, fi, fpath, ".ln", 1)) + if (fi->fi_mkrule) { + if (emit_1rule(fp, fi, fpath, ".o")) return (1); /* simple default rule */ } else { - if (fprintf(fp, "%s.o %s.ln: %s%s\n", fi->fi_base, - fi->fi_base, + if (fprintf(fp, "%s.o: %s%s\n", fi->fi_base, *fpath != '/' ? "$S/" : "", fpath) < 0) return (1); } diff --git a/usr.sbin/config/scan.l b/usr.sbin/config/scan.l index 343d7772264..f37ffc24548 100644 --- a/usr.sbin/config/scan.l +++ b/usr.sbin/config/scan.l @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: scan.l,v 1.20 2007/11/25 08:26:59 deraadt Exp $ */ +/* $OpenBSD: scan.l,v 1.21 2012/09/17 17:36:13 espie Exp $ */ /* $NetBSD: scan.l,v 1.13 1997/02/02 21:12:37 thorpej Exp $ */ /* @@ -84,7 +84,6 @@ at return AT; attach return ATTACH; build return BUILD; compile-with return COMPILE_WITH; -lint-with return LINT_WITH; config return CONFIG; define return DEFINE; defopt return DEFOPT; |