summaryrefslogtreecommitdiffhomepage
path: root/src/build/codegen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/build/codegen.c')
-rw-r--r--src/build/codegen.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/build/codegen.c b/src/build/codegen.c
index 3cf4d8b..70b5e12 100644
--- a/src/build/codegen.c
+++ b/src/build/codegen.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2023 Michael Smith <mikesmiffy128@gmail.com>
+ * Copyright © 2024 Michael Smith <mikesmiffy128@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -20,6 +20,7 @@
#include <string.h>
#include "../intdefs.h"
+#include "../langext.h"
#include "../os.h"
#include "cmeta.h"
#include "skiplist.h"
@@ -45,8 +46,8 @@ static struct conent {
static int nconents;
#define PUT(name_, isvar_, unreg_) do { \
- if (nconents == sizeof(conents) / sizeof(*conents)) { \
- fprintf(stderr, "codegen: out of space; make ents bigger!\n"); \
+ if (nconents == countof(conents)) { \
+ fprintf(stderr, "codegen: out of space; make conents bigger!\n"); \
exit(1); \
} \
conents[nconents].name = name_; \
@@ -116,7 +117,7 @@ static struct skiplist_hdr_feature_bydesc features_bydesc = {0};
static void onfeatinfo(enum cmeta_featmacro type, const char *param,
void *ctxt) {
struct feature *f = ctxt;
- switch (type) {
+ switch_exhaust_enum (cmeta_featmacro, type) {
case CMETA_FEAT_REQUIRE:; bool optional = false; goto dep;
case CMETA_FEAT_REQUEST: optional = true;
dep:; struct feature *dep = skiplist_get_feature(&features, param);