summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/targ.c
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-05-13 13:47:41 +0000
committerharti <harti@FreeBSD.org>2005-05-13 13:47:41 +0000
commitc52091a829f09826ff39dc62da6eae2507746aa5 (patch)
treeaba8baf678d2a6c141693d6db6bf039399c89e13 /usr.bin/make/targ.c
parent407f5f009c8e5a70c5fa5d8f7e21fbb26dfb71c0 (diff)
downloadFreeBSD-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.c55
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);
}
/**
OpenPOWER on IntegriCloud