Reworked Toy_String as a union, enabled -Wpedantic

Toy now fits into the C spec.

Fixed #158

Addendum: MacOS test caught an error:

error: a function declaration without a prototype is deprecated in all versions of C

That took 3 attempts to fix correctly.

Addendum: 'No new line at the end of file' are you shitting me?
This commit is contained in:
2024-12-15 15:34:57 +11:00
parent 93fce94e9c
commit a28053d4e9
41 changed files with 322 additions and 309 deletions

View File

@@ -379,14 +379,14 @@ static void debugScopePrint(Toy_Scope* scope, int depth) {
printf("Scope %d Dump\n-------------------------\ntype\tname\tvalue\n", depth);
for (unsigned int i = 0; i < scope->table->capacity; i++) {
if ( (TOY_VALUE_IS_STRING(scope->table->data[i].key) && TOY_VALUE_AS_STRING(scope->table->data[i].key)->type == TOY_STRING_NAME) != true) {
if ( (TOY_VALUE_IS_STRING(scope->table->data[i].key) && TOY_VALUE_AS_STRING(scope->table->data[i].key)->info.type == TOY_STRING_NAME) != true) {
continue;
}
Toy_Value k = scope->table->data[i].key;
Toy_Value v = scope->table->data[i].value;
printf("%s\t%s\t", Toy_private_getValueTypeAsCString(v.type), TOY_VALUE_AS_STRING(k)->as.name.data);
printf("%s\t%s\t", Toy_private_getValueTypeAsCString(v.type), TOY_VALUE_AS_STRING(k)->name.data);
//print value
Toy_String* string = Toy_stringifyValue(&stringBucket, Toy_unwrapValue(v));