diff options
author | harti <harti@FreeBSD.org> | 2005-05-13 13:47:41 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2005-05-13 13:47:41 +0000 |
commit | c52091a829f09826ff39dc62da6eae2507746aa5 (patch) | |
tree | aba8baf678d2a6c141693d6db6bf039399c89e13 /usr.bin/make/targ.c | |
parent | 407f5f009c8e5a70c5fa5d8f7e21fbb26dfb71c0 (diff) | |
download | FreeBSD-src-c52091a829f09826ff39dc62da6eae2507746aa5.zip FreeBSD-src-c52091a829f09826ff39dc62da6eae2507746aa5.tar.gz |
Use the print_flags function to print the OP_ flags of a target.
Give the function one more argument to decide whether it should
print the flags like a C-expression or just space-delimited.
Diffstat (limited to 'usr.bin/make/targ.c')
-rw-r--r-- | usr.bin/make/targ.c | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index c738d18..fab3189 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -335,43 +335,28 @@ Targ_FmtTime(time_t modtime) void Targ_PrintType(int type) { - int tbit; - -#define PRINTBIT(attr) \ - case CONCAT(OP_,attr): \ - printf("." #attr " "); \ - break - -#define PRINTDBIT(attr) \ - case CONCAT(OP_,attr): \ - DEBUGF(TARG, ("." #attr " ")); \ - break + static const struct flag2str type2str[] = { + { OP_OPTIONAL, ".OPTIONAL" }, + { OP_USE, ".USE" }, + { OP_EXEC, ".EXEC" }, + { OP_IGNORE, ".IGNORE" }, + { OP_PRECIOUS, ".PRECIOUS" }, + { OP_SILENT, ".SILENT" }, + { OP_MAKE, ".MAKE" }, + { OP_JOIN, ".JOIN" }, + { OP_INVISIBLE, ".INVISIBLE" }, + { OP_NOTMAIN, ".NOTMAIN" }, + { OP_PHONY, ".PHONY" }, + { OP_LIB, ".LIB" }, + { OP_MEMBER, ".MEMBER" }, + { OP_ARCHV, ".ARCHV" }, + { 0, NULL } + }; type &= ~OP_OPMASK; - - while (type) { - tbit = 1 << (ffs(type) - 1); - type &= ~tbit; - - switch(tbit) { - PRINTBIT(OPTIONAL); - PRINTBIT(USE); - PRINTBIT(EXEC); - PRINTBIT(IGNORE); - PRINTBIT(PRECIOUS); - PRINTBIT(SILENT); - PRINTBIT(MAKE); - PRINTBIT(JOIN); - PRINTBIT(INVISIBLE); - PRINTBIT(NOTMAIN); - PRINTDBIT(LIB); - /*XXX: MEMBER is defined, so CONCAT(OP_,MEMBER) gives OP_"%" */ - case OP_MEMBER: - DEBUGF(TARG, (".MEMBER ")); - break; - PRINTDBIT(ARCHV); - } - } + if (!DEBUG(TARG)) + type &= ~(OP_ARCHV | OP_LIB | OP_MEMBER); + print_flags(stdout, type2str, type, 0); } /** |