refactor(build): don't use the preprocessor when generating headers

Using the preprocessor before generating prototypes provides some
"niceties" but the places that rely on these are pretty few.
Vastly simplifying the BUILD SYSTEM is a better trade-off.

Unbalancing { } blocks due to the preprocessor is cringe anyway (think
of the tree-sitter trees!), write these in a different way.

Add some workarounds for plattform specific features.

INCLUDE_GENERATED_DECLARATIONS flag is now technically redundant,
but will be cleaned up in a follow-up PR as it is a big mess.
This commit is contained in:
bfredl
2025-08-01 12:26:52 +02:00
parent b4c092a092
commit 79c8159f41
24 changed files with 74 additions and 143 deletions

View File

@@ -1174,7 +1174,7 @@ bool utf_printable(int c)
// Return true if "c" is in "table".
static bool intable(const struct interval *table, size_t n_items, int c)
FUNC_ATTR_PURE
FUNC_ATTR_CONST
{
assert(n_items > 0);
// first quick check for Latin1 etc. characters
@@ -1202,11 +1202,11 @@ static bool intable(const struct interval *table, size_t n_items, int c)
// Return true for characters that can be displayed in a normal way.
// Only for characters of 0x100 and above!
bool utf_printable(int c)
FUNC_ATTR_PURE
FUNC_ATTR_CONST
{
// Sorted list of non-overlapping intervals.
// 0xd800-0xdfff is reserved for UTF-16, actually illegal.
static struct interval nonprint[] = {
static const struct interval nonprint[] = {
{ 0x070f, 0x070f }, { 0x180b, 0x180e }, { 0x200b, 0x200f }, { 0x202a, 0x202e },
{ 0x2060, 0x206f }, { 0xd800, 0xdfff }, { 0xfeff, 0xfeff }, { 0xfff9, 0xfffb },
{ 0xfffe, 0xffff }