about summary refs log tree commit diff
path: root/boot/tree.c
diff options
context:
space:
mode:
authorMel <mel@rnrd.eu>2025-05-24 14:18:51 +0200
committerMel <mel@rnrd.eu>2025-05-24 14:18:51 +0200
commit41e0e31b8586c1f93b5e65cd62ef910227a6677d (patch)
tree0b26a7dc66fc1c2ed17b6750c2b3ee0482c344f5 /boot/tree.c
parent577c6b4339b7ddc5af011ca06ccae97459f5ec76 (diff)
downloadcatskill-41e0e31b8586c1f93b5e65cd62ef910227a6677d.tar.zst
catskill-41e0e31b8586c1f93b5e65cd62ef910227a6677d.zip
Failure when default case reached in non-optional switch functions
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'boot/tree.c')
-rw-r--r--boot/tree.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/boot/tree.c b/boot/tree.c
index e6c5b78..593103a 100644
--- a/boot/tree.c
+++ b/boot/tree.c
@@ -40,7 +40,8 @@ unary_operation_to_string(enum Unary_Operation operation)
         return "~";
 
     default:
-        return "unknown";
+        failure("unexpected unary operation passed to `unary_operation_to_string`");
+        return nil;
     }
 }
 
@@ -212,6 +213,7 @@ binary_operation_precedence(enum Binary_Operation operation)
         // strongest
 
     default:
+        failure("unexpected binary operation passed to `binary_operation_precedence`");
         return 0;
     }
 }
@@ -316,7 +318,8 @@ binary_operation_to_string(enum Binary_Operation operation)
         return ">>=";
 
     default:
-        return "unknown";
+        failure("unexpected binary operation passed to `binary_operation_to_string`");
+        return nil;
     }
 }
 
@@ -511,6 +514,7 @@ expression_print(const struct Expression* expression)
         printf(")");
         break;
     default:
+        failure("unexpected expression kind passed to `expression_print`");
         break;
     }
     printf(")");
@@ -572,7 +576,7 @@ statement_print(const struct Statement* statement)
         break;
     }
     default:
-        printf("unknown");
+        failure("unexpected statement kind passed to `statement_print`");
         break;
     }
     printf(")");