Code formatting

This commit is contained in:
2025-04-04 22:06:22 +02:00
parent 389eecfd73
commit e3497e315c
3 changed files with 13 additions and 4 deletions

10
haxcc.h
View File

@@ -12,8 +12,14 @@ typedef struct mod {
done_fn done; done_fn done;
} mod; } mod;
#define HAX_MOD(name) \ // Define a macro to place a 'mod' struct into a special section called '__haxmod'
static const struct mod name __attribute__((used, section("__haxmod"), aligned(__alignof__(struct mod)))) #define HAX_MOD(name) \
static const struct mod name \
__attribute__(( \
used, \
section("__haxmod"), \
aligned(__alignof__(struct mod)) \
))
mod* mod_begin(void); mod* mod_begin(void);
mod* mod_end(void); mod* mod_end(void);

View File

@@ -1,6 +1,9 @@
SECTIONS SECTIONS
{ {
haxmods (READONLY) : ALIGN(4) { /**
* Define a custom section named 'haxmods' that is marked as READONLY.
*/
haxmods (READONLY) : {
PROVIDE(haxmods_begin = .); PROVIDE(haxmods_begin = .);
KEEP(*(__haxmod)) KEEP(*(__haxmod))
PROVIDE(haxmods_end = .); PROVIDE(haxmods_end = .);

View File

@@ -5,7 +5,7 @@ project(
default_options : [ default_options : [
'warning_level=3', 'warning_level=3',
'c_std=c2x', 'c_std=c2x',
'cpp_std=c++23' 'cpp_std=c++20'
]) ])
ldscript = 'haxcc.ld' ldscript = 'haxcc.ld'