changeset 1067:bb96d18d080d

post fmt4: assert that ENCAP helper has been told how to handle all types Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sun, 06 Aug 2017 12:51:36 +0300
parents fa56c651dced
children 100c7709f585
files post_fmt4_ast.c
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/post_fmt4_ast.c	Sun Aug 06 12:47:04 2017 +0300
+++ b/post_fmt4_ast.c	Sun Aug 06 12:51:36 2017 +0300
@@ -164,6 +164,14 @@
 	struct ptnode *pnode;
 	struct ptree *pt;
 
+	/* check for types specified in multiple masks */
+	ASSERT0(ptypes_nop & ptypes_assert);
+	ASSERT0(ptypes_nop & ptypes_process);
+	ASSERT0(ptypes_assert & ptypes_process);
+
+	/* check that all types occur somewhere */
+	ASSERT3U(ptypes_nop | ptypes_assert | ptypes_process, ==, ALL_PT_TYPES);
+
 	ASSERT3U(node->type, ==, AST_ENCAP);
 
 	pt = node->u.encap.data;
@@ -190,8 +198,8 @@
 			      "but we shouldn't have (listed as 'assert')",
 			      pnode->type);
 
-		panic("encountered a parse tree node of with "
-		      "unexpected type %#x (unspecified)", pnode->type);
+		panic("encountered a parse tree node with unknown type %#x",
+		      pnode->type);
 	} else {
 		struct ptnode *pnode_tmp;
 
@@ -207,8 +215,8 @@
 				panic("encountered a parse tree node that "
 				      "should have been solo");
 
-			panic("encountered a parse tree node of with "
-			      "unexpected type %#x", pnode->type);
+			panic("encountered a parse tree node with unknown type "
+			      "%#x", pnode->type);
 		}
 
 		return false;