Tweaked CFLAGS, and fixed related errors

This commit is contained in:
2024-12-12 16:18:41 +11:00
parent 5f4dfdccc5
commit fce71a6cda
19 changed files with 29 additions and 56 deletions

View File

@@ -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+=

View File

@@ -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+=

View File

@@ -25,10 +25,10 @@ int test_buckets() {
Toy_Bucket* bucket = Toy_allocateBucket(sizeof(int) * 32);
//grab some memory
int* a = Toy_partitionBucket(&bucket, sizeof(int));
int* b = Toy_partitionBucket(&bucket, sizeof(int));
int* c = Toy_partitionBucket(&bucket, sizeof(int));
int* d = Toy_partitionBucket(&bucket, sizeof(int));
Toy_partitionBucket(&bucket, sizeof(int));
Toy_partitionBucket(&bucket, sizeof(int));
Toy_partitionBucket(&bucket, sizeof(int));
Toy_partitionBucket(&bucket, sizeof(int));
//check
if (bucket == NULL || bucket->count != 4 * sizeof(int)) {
@@ -46,12 +46,12 @@ int test_buckets() {
Toy_Bucket* bucket = Toy_allocateBucket(sizeof(int) * 4);
//grab some memory
int* a = Toy_partitionBucket(&bucket, sizeof(int));
int* b = Toy_partitionBucket(&bucket, sizeof(int));
int* c = Toy_partitionBucket(&bucket, sizeof(int));
int* d = Toy_partitionBucket(&bucket, sizeof(int));
int* e = Toy_partitionBucket(&bucket, sizeof(int));
int* f = Toy_partitionBucket(&bucket, sizeof(int));
Toy_partitionBucket(&bucket, sizeof(int));
Toy_partitionBucket(&bucket, sizeof(int));
Toy_partitionBucket(&bucket, sizeof(int));
Toy_partitionBucket(&bucket, sizeof(int));
Toy_partitionBucket(&bucket, sizeof(int));
Toy_partitionBucket(&bucket, sizeof(int));
//checks - please note that the top-most bucket is what is being filled - older buckets are further along
if (

View File

@@ -5,7 +5,7 @@
int counter = 0;
void count(const char* msg) {
void count(const char*) {
counter++;
}

View File

@@ -19,7 +19,6 @@ int test_routine_expressions(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -68,7 +67,6 @@ int test_routine_expressions(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -117,7 +115,6 @@ int test_routine_expressions(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -170,7 +167,6 @@ int test_routine_expressions(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -223,7 +219,6 @@ int test_routine_expressions(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -277,7 +272,6 @@ int test_routine_expressions(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -331,7 +325,6 @@ int test_routine_expressions(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* header = (int*)buffer;
@@ -438,7 +431,6 @@ int test_routine_binary(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -504,7 +496,6 @@ int test_routine_binary(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -570,7 +561,6 @@ int test_routine_binary(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -636,7 +626,6 @@ int test_routine_binary(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -732,7 +721,6 @@ int test_routine_keywords(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -791,7 +779,6 @@ int test_routine_keywords(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -855,7 +842,6 @@ int test_routine_keywords(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -946,7 +932,6 @@ int test_routine_keywords(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -1061,7 +1046,6 @@ int test_routine_keywords(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* ptr = (int*)buffer;
@@ -1119,7 +1103,6 @@ int test_routine_keywords(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* header = (int*)buffer;
@@ -1227,7 +1210,6 @@ int test_routine_keywords(Toy_Bucket** bucketHandle) {
//run
void* buffer = Toy_compileRoutine(ast);
int len = ((int*)buffer)[0];
//check header
int* header = (int*)buffer;

View File

@@ -400,7 +400,6 @@ int test_string_equality() {
Toy_Bucket* bucket = Toy_allocateBucket(1024);
Toy_String* helloWorldOne = Toy_createString(&bucket, "Hello world");
Toy_String* helloWorldTwo = Toy_concatStrings(&bucket, Toy_createString(&bucket, "Hello "), Toy_createString(&bucket, "world"));
Toy_String* helloEveryone = Toy_createString(&bucket, "Hello everyone");
int result = 0; //for print the errors

View File

@@ -1,12 +1,2 @@
set breakpoint pending on
break main if argc > 1
command 1
set $i=0
while($i < argc)
p argv[$i++]
end
continue
end

View File

@@ -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+=

View File

@@ -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+=

View File

@@ -40,7 +40,7 @@ unsigned char* readFile(char* path, int* size) {
}
//read the file
if (fread(buffer, sizeof(unsigned char), *size, file) < *size) {
if (fread(buffer, sizeof(unsigned char), *size, file) < (unsigned int)(*size)) {
fclose(file);
*size = -2; //singal a read error
return NULL;
@@ -144,4 +144,4 @@ int main() {
}
return 0;
}
}