diff mbox

[RFC,20/48] dump-ir: make it more flexible

Message ID 20170823201554.90551-21-luc.vanoostenryck@gmail.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Luc Van Oostenryck Aug. 23, 2017, 8:15 p.m. UTC
---
 lib.c                                  | 17 +++++++++--------
 validation/linear/bitfield-init-mask.c |  2 +-
 2 files changed, 10 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/lib.c b/lib.c
index c107505a7..d3aaf10d2 100644
--- a/lib.c
+++ b/lib.c
@@ -490,7 +490,6 @@  static unsigned long lookup_mask(const char *name, const struct mask_map *map)
 	return 0;
 }
 
-inline
 static unsigned long handle_suboption_mask(char *arg, const struct mask_map *map)
 {
 	const char *token;
@@ -757,16 +756,18 @@  static char **handle_switch_ftabstop(char *arg, char **next)
 	return next;
 }
 
+static const struct mask_map dump_ir_options[] = {
+	{ "$default",		DUMP_IR_LINEARIZE },
+	{ "linearize",		DUMP_IR_LINEARIZE },
+	{ "only",		DUMP_IR_ONLY },
+	{ },
+};
+
 static char **handle_switch_fdump(char *arg, char **next)
 {
 	if (!strncmp(arg, "ir", 2)) {
-		fdump_ir = DUMP_IR_LINEARIZE;
-		arg += 2;
-		if (*arg == '\0')
-			fdump_ir = DUMP_IR_LINEARIZE;
-		else if (!strcmp(arg, "=only"))
-			fdump_ir |= DUMP_IR_ONLY;
-		else
+		fdump_ir = handle_suboption_mask(arg+2, dump_ir_options);
+		if (fdump_ir == ~0UL)
 			goto err;
 	}
 
diff --git a/validation/linear/bitfield-init-mask.c b/validation/linear/bitfield-init-mask.c
index f43605855..fa91fec90 100644
--- a/validation/linear/bitfield-init-mask.c
+++ b/validation/linear/bitfield-init-mask.c
@@ -18,7 +18,7 @@  struct bfu bfu_init_20_23(int a)
 
 /*
  * check-name: bitfield initializer mask
- * check-command: test-linearize -fdump-ir=only -Wno-decl $file
+ * check-command: test-linearize -fdump-ir=linearize,only -Wno-decl $file
  * check-output-ignore
  *
  * check-output-contains: and\\..*fffff800\$