diff --git a/cia.c b/cia.c index 2117646..717b678 100644 --- a/cia.c +++ b/cia.c @@ -1,5 +1,5 @@ -#include +#include // Platform-dependent sources #include _CIA_OS_CONF @@ -8,7 +8,7 @@ #include #include #include -#include +#include // Module cia_memory #include "src/cia-mem/util.c" diff --git a/include/bin/elf.h b/include/bin/elf.h index 041f7a6..5fdd8a9 100644 --- a/include/bin/elf.h +++ b/include/bin/elf.h @@ -1,7 +1,7 @@ #pragma once -#include +#include typedef u64 Elf64_Addr; typedef u64 Elf64_Off; diff --git a/include/cia-conf.h b/include/cia-conf.h deleted file mode 100644 index c302c1e..0000000 --- a/include/cia-conf.h +++ /dev/null @@ -1,6 +0,0 @@ - -// This file is AUTO-GENERATED -// See os folder (e.g. src/linux) for conf.h file - -#define CIA_OS_LINUX -#define CIA_DATA_LP64 diff --git a/include/cia/conf.h b/include/cia/conf.h new file mode 100644 index 0000000..f067e8a --- /dev/null +++ b/include/cia/conf.h @@ -0,0 +1,6 @@ + +#pragma once + +#define CIA_DATA_LP64 +#define CIA_OS_LINUX + diff --git a/include/cia-def.h b/include/cia/def.h similarity index 89% rename from include/cia-def.h rename to include/cia/def.h index 8967626..b367d90 100644 --- a/include/cia-def.h +++ b/include/cia/def.h @@ -1,9 +1,6 @@ #pragma once -// Include platform stuff -#include - // Pre-C23 keyword macros #define static_assert _Static_assert diff --git a/include/cia-mem.h b/include/cia/mem.h similarity index 100% rename from include/cia-mem.h rename to include/cia/mem.h diff --git a/include/linux/sys/syscall.h b/include/linux/sys/syscall.h index 6ba0d5b..9cef5ec 100644 --- a/include/linux/sys/syscall.h +++ b/include/linux/sys/syscall.h @@ -1,7 +1,7 @@ #pragma once -#include +#include // For now these definitions will live here #if !defined(STDIN_FILENO) diff --git a/include/stddef.h b/include/stddef.h index 3bcc162..8e6f00e 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -1,7 +1,7 @@ #pragma once -#include +#include typedef u64 size_t; diff --git a/include/stdint.h b/include/stdint.h index f0b80ed..9eb853a 100644 --- a/include/stdint.h +++ b/include/stdint.h @@ -1,6 +1,8 @@ #pragma once +#include + static_assert(sizeof(char) == 1, "Char isn't 1 bytes long"); static_assert(sizeof(short) == 2, "Short isn't 2 bytes long"); static_assert(sizeof(int) == 4, "Int isn't 4 bytes long"); @@ -9,6 +11,8 @@ static_assert(sizeof(long long int) == 8, "Long long isn't 8 bytes long"); static_assert(sizeof(long) == 8, "Long on linux isn't 8 bytes"); #elif defined(CIA_DATA_LLP64) static_assert(sizeof(long) == 4, "Long on windows isn't 4 bytes"); +#else + #error "Data model not implemented" #endif typedef signed char int8_t; diff --git a/include/stdio.h b/include/stdio.h index 1fbea3b..3742f30 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -1,7 +1,7 @@ #pragma once -#include +#include #include typedef struct FILE FILE; diff --git a/include/stdlib.h b/include/stdlib.h index cdd6193..1362e8e 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,7 +1,7 @@ #pragma once -#include +#include int atexit(void (*func)(void)); int at_quick_exit(void (*func)(void)); diff --git a/loader/loader-self-reloc.c b/loader/loader-self-reloc.c index 1a08821..4d394bd 100644 --- a/loader/loader-self-reloc.c +++ b/loader/loader-self-reloc.c @@ -13,7 +13,7 @@ // any externally-defined functions (static functions // are fine with gcc and clang (I think)) -#include +#include #include #include #include diff --git a/loader/loader.c b/loader/loader.c index 911fe43..e0558e4 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -1,5 +1,5 @@ -#include +#include #include #include #include @@ -12,7 +12,7 @@ #include #include "../os/linux/tinyrt.c" -#include +#include #include "../src/cia-mem/util.c" #include "../src/cia-mem/allocator.c" #include "../src/cia-mem/arena.c" diff --git a/tests/hello.c b/tests/hello.c index 3de02c0..063856f 100644 --- a/tests/hello.c +++ b/tests/hello.c @@ -1,5 +1,5 @@ -#include +#include #include int main(int argc, char **argv, char **envp) {