diff options
author | 2025-03-10 20:37:28 +0000 | |
---|---|---|
committer | 2025-04-06 16:41:13 +0100 | |
commit | daa55cade14146f04814cf8a7ad2028becf4db66 (patch) | |
tree | 62933a231e8068f4498596a9064f59e1a4842723 /src/build | |
parent | 244fea664121acf12871ab5858a5fe95a2606b52 (diff) | |
download | sst-daa55cade14146f04814cf8a7ad2028becf4db66.tar.gz sst-daa55cade14146f04814cf8a7ad2028becf4db66.zip |
Use C23 void-argument-free prototypes
In the future we can also consider moving to {} instead of {0} for
initialisers, but my old Clang (16) doesn't support this, so it might be
wise to wait longer on that one so people don't need too bleeding-edge
of a compiler just to build this thing.
Diffstat (limited to 'src/build')
-rw-r--r-- | src/build/gluegen.c | 24 | ||||
-rw-r--r-- | src/build/mkentprops.c | 6 | ||||
-rw-r--r-- | src/build/mkgamedata.c | 4 |
3 files changed, 17 insertions, 17 deletions
diff --git a/src/build/gluegen.c b/src/build/gluegen.c index 4a0f4a1..717ff97 100644 --- a/src/build/gluegen.c +++ b/src/build/gluegen.c @@ -50,7 +50,7 @@ static _Alignas(64) char _arena[ARENASZ] = {0}, *const arena = _arena - 64; static int arena_last = 0; static int arena_used = 64; // using 0 indices as null; reserve and stay aligned -static inline void _arena_align(void) { +static inline void _arena_align() { enum { ALIGN = ssizeof(void *) }; if (arena_used & ALIGN - 1) arena_used = (arena_used + ALIGN) & ~(ALIGN - 1); } @@ -124,7 +124,7 @@ static inline void *list_grow_p(struct list_chunkhdr **tailp, int amt) { /* ... */ #define DEF_NEW(type, func, nvar, maxvar, desc) \ - static inline type func(void) { \ + static inline type func() { \ if_cold (nvar == maxvar) { \ die(2, "out of " desc " - increase " #maxvar " in gluegen.c!"); \ } \ @@ -195,7 +195,7 @@ static SHUNT(struct radix, radices)[MAX_MODULES * 2 + MAX_EVENTS]; static int nradices = 1; // also reserve a null value // NOTE: this will never fail, as node count is bounded by modules * 2 + events -static inline s16 radix_new(void) { return nradices++; } +static inline s16 radix_new() { return nradices++; } static int matchlen(const char *s1, const char *s2, int len, bool ignorecase) { uchar c1, c2; @@ -591,13 +591,13 @@ static int dfs(s16 mod, bool first) { return 0; } -static inline void sortfeatures(void) { +static inline void sortfeatures() { for (int i = 1; i < nmods; ++i) { if ((mod_flags[i] & HAS_INIT) && dfs(i, true)) exit(2); } } -static inline noreturn diewrite(void) { die(100, "couldn't write to file"); } +static inline noreturn diewrite() { die(100, "couldn't write to file"); } #define _(x) \ if (fprintf(out, "%s\n", x) < 0) diewrite(); #define F(f, ...) \ @@ -667,13 +667,13 @@ static int evargs_notype(FILE *out, s16 i, const char *suffix) { static inline void gencode(FILE *out, s16 featdescs) { for (int i = 1; i < nmods; ++i) { if (mod_flags[i] & HAS_INIT) { -F( "extern int _feat_init_%.*s(void);", mod_names[i].len, mod_names[i].s) +F( "extern int _feat_init_%.*s();", mod_names[i].len, mod_names[i].s) } if (mod_flags[i] & HAS_PREINIT) { -F( "extern int _feat_preinit_%.*s(void);", mod_names[i].len, mod_names[i].s) +F( "extern int _feat_preinit_%.*s();", mod_names[i].len, mod_names[i].s) } if (mod_flags[i] & HAS_END) { -F( "extern void _feat_end_%.*s(void);", mod_names[i].len, mod_names[i].s) +F( "extern void _feat_end_%.*s();", mod_names[i].len, mod_names[i].s) } } _( "") @@ -717,7 +717,7 @@ F( "extern struct con_var *%.*s;", cvar_names[i].len, cvar_names[i].s); F( "extern struct con_cmd *%.*s;", ccmd_names[i].len, ccmd_names[i].s); } _( "") -_( "static inline void preinitfeatures(void) {") +_( "static inline void preinitfeatures() {") for (int i = 1; i < nmods; ++i) { if (mod_flags[i] & HAS_PREINIT) { F( " feats.preinit_%.*s = _feat_preinit_%.*s();", @@ -726,7 +726,7 @@ F( " feats.preinit_%.*s = _feat_preinit_%.*s();", } _( "}") _( "") -_( "static inline void initfeatures(void) {") +_( "static inline void initfeatures() {") for (int i = 0; i < nfeatures; ++i) { // N.B.: this *should* be 0-indexed! const char *else_ = ""; s16 mod = feat_initorder[i]; @@ -825,7 +825,7 @@ _( " con_colourmsg(&white, \"---- List of plugin features ---\\n\");"); recursefeatdescs(out, featdescs); _( "}") _( "") -_( "static inline void endfeatures(void) {") +_( "static inline void endfeatures() {") for (int i = nfeatures - 1; i >= 0; --i) { s16 mod = feat_initorder[i]; if (mod_flags[mod] & HAS_END) { @@ -836,7 +836,7 @@ F( " if (has_%.*s) _feat_end_%.*s();", } _( "}") _( "") -_( "static inline void freevars(void) {") +_( "static inline void freevars() {") for (int i = 1; i < ncvars; ++i) { F( " extfree(%.*s->strval);", cvar_names[i].len, cvar_names[i].s) } diff --git a/src/build/mkentprops.c b/src/build/mkentprops.c index 3df21ed..802aeaf 100644 --- a/src/build/mkentprops.c +++ b/src/build/mkentprops.c @@ -56,7 +56,7 @@ static int art_nnodes = 0; #define ART_NULL ((u16)-1) -static inline int art_newnode(void) { +static inline int art_newnode() { if (art_nnodes == ART_MAXNODES) die(2, "out of tree nodes"); return art_nnodes++; } @@ -78,7 +78,7 @@ static u16 nclasses = 0; // similar short circuit for ServerClasses static int decls[MAXDECLS]; static int ndecls = 0; -static inline int art_newleaf(void) { +static inline int art_newleaf() { if (art_nleaves == ART_MAXLEAVES) die(2, "out of leaf nodes"); return art_nleaves++; } @@ -239,7 +239,7 @@ static inline void parse(const os_char *file, int len) { } } -static inline noreturn diewrite(void) { die(100, "couldn't write to file"); } +static inline noreturn diewrite() { die(100, "couldn't write to file"); } #define _(x) if (fprintf(out, "%s\n", x) < 0) diewrite(); #define _i(x) for (int i = 0; i < indent; ++i) fputc('\t', out); _(x) #define F(f, ...) if (fprintf(out, f "\n", __VA_ARGS__) < 0) diewrite(); diff --git a/src/build/mkgamedata.c b/src/build/mkgamedata.c index ed8cf97..2f9c0cb 100644 --- a/src/build/mkgamedata.c +++ b/src/build/mkgamedata.c @@ -147,7 +147,7 @@ static void parse(int file, char *s, int len) { } } -static inline noreturn diewrite(void) { die(100, "couldn't write to file"); } +static inline noreturn diewrite() { die(100, "couldn't write to file"); } #define _(x) if (fprintf(out, "%s\n", x) < 0) diewrite(); #define _i(x) for (int i = 0; i < indent; ++i) fputc('\t', out); _(x) #define F(f, ...) if (fprintf(out, f "\n", __VA_ARGS__) < 0) diewrite(); @@ -227,7 +227,7 @@ F( "int %s = -2147483648;", sbase + tags[i]) } static inline void init(FILE *out) { -_( "static void initgamedata(void) {") +_( "static void initgamedata() {") int varidx; int indent = 0; for (int i = 0; i < nents; ++i) { |