drop cmdline limits

This commit is contained in:
2026-10-06 00:13:14 +02:00
parent fd8f59649e
commit 57b1d338ac
2 changed files with 3 additions and 64 deletions
+2 -23
View File
@@ -4,7 +4,7 @@
#include <zinnia/utils.h>
#include <stdint.h>
#define _CMDLINE_OPTION(x, opt_name, opt_desc, opt_func, opt_limit) \
#define _CMDLINE_OPTION(x, opt_name, opt_desc, opt_func) \
static const struct cmdline_option x = { \
.name = opt_name, \
.desc = opt_desc, \
@@ -16,23 +16,12 @@
void (*)(uintptr_t): CMDLINE_UINTPTR \
), \
.func = (void*)(opt_func), \
.limit = (void*)(opt_limit) \
}; \
static_assert(_Generic( \
(opt_limit), \
const char**: true, \
const struct cmdline_range_int*: true, \
const struct cmdline_range_uint*: true, \
void*: true \
)); \
[[__used, __section(".cmdline")]] \
static const struct cmdline_option* CONCAT(x, _ptr) = &x
#define CMDLINE_OPTION(opt_name, opt_desc, opt_func) \
_CMDLINE_OPTION(UNIQUE_IDENT(cmdline_option), opt_name, opt_desc, opt_func, (void*)nullptr)
#define CMDLINE_OPTION_RANGE(opt_name, opt_desc, opt_func, opt_values) \
_CMDLINE_OPTION(UNIQUE_IDENT(cmdline_option), opt_name, opt_desc, opt_func, opt_values)
_CMDLINE_OPTION(UNIQUE_IDENT(cmdline_option), opt_name, opt_desc, opt_func)
enum cmdline_type {
CMDLINE_STRING,
@@ -55,16 +44,6 @@ struct cmdline_option {
void (*func_uintptr)(uintptr_t value);
void* func;
};
union {
const char** str_limit;
struct cmdline_range_int {
intptr_t min, max;
}* intptr_limit;
struct cmdline_range_uint {
uintptr_t min, max;
}* uintptr_limit;
void* limit;
};
};
// Parses the command line and invokes all options.