mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Tweaked CFLAGS, and fixed related errors
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#compiler settings
|
||||
CC=gcc
|
||||
CFLAGS+=-std=c17 -g -Wall -Werror -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wformat=2
|
||||
CFLAGS+=-std=c17 -g -Wall -Werror -Wextra -Wformat=2
|
||||
LIBS+=-lm
|
||||
LDFLAGS+=
|
||||
|
||||
|
||||
@@ -406,6 +406,7 @@ static unsigned int writeInstructionWhileThen(Toy_Routine** rt, Toy_AstWhileThen
|
||||
|
||||
static unsigned int writeInstructionBreak(Toy_Routine** rt, Toy_AstBreak ast) {
|
||||
//TODO: implement break
|
||||
(void)ast;
|
||||
fprintf(stderr, TOY_CC_ERROR "COMPILER ERROR: Keyword 'break' not yet implemented\n" TOY_CC_RESET);
|
||||
(*rt)->panic = true;
|
||||
|
||||
@@ -414,6 +415,7 @@ static unsigned int writeInstructionBreak(Toy_Routine** rt, Toy_AstBreak ast) {
|
||||
|
||||
static unsigned int writeInstructionContinue(Toy_Routine** rt, Toy_AstContinue ast) {
|
||||
//TODO: implement continue
|
||||
(void)ast;
|
||||
fprintf(stderr, TOY_CC_ERROR "COMPILER ERROR: Keyword 'continue' not yet implemented\n" TOY_CC_RESET);
|
||||
(*rt)->panic = true;
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ Toy_Scope* Toy_deepCopyScope(Toy_Bucket** bucketHandle, Toy_Scope* scope) {
|
||||
incrementRefCount(newScope);
|
||||
|
||||
//forcibly copy the contents
|
||||
for (int i = 0; i < scope->table->capacity; i++) {
|
||||
for (unsigned int i = 0; i < scope->table->capacity; i++) {
|
||||
if (!TOY_VALUE_IS_NULL(scope->table->data[i].key)) {
|
||||
Toy_insertTable(&newScope->table, Toy_copyValue(scope->table->data[i].key), Toy_copyValue(scope->table->data[i].value));
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ char* Toy_getStringRawBuffer(Toy_String* str) {
|
||||
}
|
||||
|
||||
//BUGFIX: Make sure it's aligned, and there's space for the null
|
||||
int len = (str->length + 3) & ~3;
|
||||
unsigned int len = (str->length + 3) & ~3;
|
||||
if (len == str->length) {
|
||||
len += 4;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ typedef struct Toy_String { //32 | 64 BITNESS
|
||||
|
||||
struct {
|
||||
Toy_ValueType type; //4 | 4
|
||||
bool constant; //1 | 1
|
||||
bool constant; //1 | 1
|
||||
char data[]; //- | -
|
||||
} name; //8 | 8
|
||||
} as; //8 | 16
|
||||
|
||||
@@ -74,7 +74,7 @@ Toy_Table* Toy_private_adjustTableCapacity(Toy_Table* oldTable, unsigned int new
|
||||
}
|
||||
|
||||
//for each entry in the old table, copy it into the new table
|
||||
for (int i = 0; i < oldTable->capacity; i++) {
|
||||
for (unsigned int i = 0; i < oldTable->capacity; i++) {
|
||||
if (!TOY_VALUE_IS_NULL(oldTable->data[i].key)) {
|
||||
probeAndInsert(&newTable, oldTable->data[i].key, oldTable->data[i].value);
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ static void processAssignCompound(Toy_VM* vm) {
|
||||
int index = TOY_VALUE_AS_INTEGER(key);
|
||||
|
||||
//bounds check
|
||||
if (index < 0 || index >= array->count) {
|
||||
if (index < 0 || (unsigned int)index >= array->count) {
|
||||
Toy_error("Index of assignment target out of bounds");
|
||||
Toy_freeValue(target);
|
||||
Toy_freeValue(key);
|
||||
@@ -671,7 +671,7 @@ static void processIndex(Toy_VM* vm) {
|
||||
Toy_String* str = TOY_VALUE_AS_STRING(value);
|
||||
|
||||
//check indexing is within bounds
|
||||
if ( (i < 0 || i >= str->length) || (i+l <= 0 || i+l > str->length)) {
|
||||
if ( (i < 0 || (unsigned int)i >= str->length) || (i+l <= 0 || (unsigned int)(i+l) > str->length)) {
|
||||
Toy_error("String index is out of bounds");
|
||||
if (TOY_VALUE_IS_REFERENCE(value) != true) {
|
||||
Toy_freeValue(value);
|
||||
@@ -743,7 +743,7 @@ static void processIndex(Toy_VM* vm) {
|
||||
Toy_Array* array = TOY_VALUE_AS_ARRAY(value);
|
||||
|
||||
//check indexing is within bounds
|
||||
if ( (i < 0 || i >= array->count) || (i+l <= 0 || i+l > array->count)) {
|
||||
if ( (i < 0 || (unsigned int)i >= array->count) || (i+l <= 0 || (unsigned int)(i+l) > array->count)) {
|
||||
Toy_error("Array index is out of bounds");
|
||||
if (TOY_VALUE_IS_REFERENCE(value) != true) {
|
||||
Toy_freeValue(value);
|
||||
|
||||
Reference in New Issue
Block a user