Don't abort on unknown type label
authorOlivier Dion <odion@efficios.com>
Thu, 24 Oct 2024 15:09:25 +0000 (11:09 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 24 Oct 2024 20:30:31 +0000 (16:30 -0400)
When a mismatch is detected by the visitor, type label are converted
to string to help debugging.  On unknown label, instead of aborting
during the error dump, return `<UNKNOWN>'.

Also added missing `SIDE_TYPE_OPTIONAL' case.

Change-Id: Ia654c1a293c8a033a15aed3c9fe6473182cbc018
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/visit-arg-vec.c

index 7b54d9adb6a7d6eaaa3af6c2f5f1a6c3e08b0b9a..4960ad3620334c4f264074abe900a7d7391b18d2 100644 (file)
@@ -1083,6 +1083,7 @@ const char *side_type_label_to_string(enum side_type_label label)
        case SIDE_TYPE_STRING_UTF32: return "SIDE_TYPE_STRING_UTF32";
        case SIDE_TYPE_STRUCT: return "SIDE_TYPE_STRUCT";
        case SIDE_TYPE_VARIANT: return "SIDE_TYPE_VARIANT";
+       case SIDE_TYPE_OPTIONAL: return "SIDE_TYPE_OPTIONAL";
        case SIDE_TYPE_ARRAY: return "SIDE_TYPE_ARRAY";
        case SIDE_TYPE_VLA: return "SIDE_TYPE_VLA";
        case SIDE_TYPE_VLA_VISITOR: return "SIDE_TYPE_VLA_VISITOR";
@@ -1111,7 +1112,7 @@ const char *side_type_label_to_string(enum side_type_label label)
        case SIDE_TYPE_DYNAMIC_VLA: return "SIDE_TYPE_DYNAMIC_VLA";
        case SIDE_TYPE_DYNAMIC_VLA_VISITOR: return "SIDE_TYPE_DYNAMIC_VLA_VISITOR";
        default:
-               abort();
+               return "<UNKNOWN>";
        }
 }
 
This page took 0.024037 seconds and 4 git commands to generate.