4 Commits b977e409e2 ... d1999f157a

Author SHA1 Message Date
  Kajetan Johannes Hammerle d1999f157a Option for all clang errors and fixes 3 weeks ago
  Kajetan Johannes Hammerle ee8fb7bc35 Cleanup cmake, move warnings to own files 3 weeks ago
  Kajetan Johannes Hammerle c68f5915e2 Fix memory error, fix release build 3 weeks ago
  Kajetan Johannes Hammerle 3a86a409ed Fix gcc errors, use defines for old C version 3 weeks ago

+ 1 - 1
.clangd

@@ -1,3 +1,3 @@
 CompileFlags:
-  Add: [-std=c2x, -DERROR_SIMULATOR=true]
+  Add: [-ferror-limit=0, -std=c2x, -DERROR_SIMULATOR=true]
   CompilationDatabase: ./build_debug/

+ 12 - 70
CMakeLists.txt

@@ -54,94 +54,36 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
     set(LOG_LEVEL 2)
     set(DEFINITIONS "")
 else()
+    set(DEFINITIONS ERROR_SIMULATOR CORE_CHECK_MEMORY)
     if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
         set(COMPILE_OPTIONS --coverage)
         set(LINK_OPTIONS gcov)
-    else()
+    elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
         set(COMPILE_OPTIONS -fprofile-instr-generate -fcoverage-mapping)
         set(LINK_OPTIONS ${COMPILE_OPTIONS})
     endif()
     set(LOG_LEVEL 4)
-    set(DEFINITIONS ERROR_SIMULATOR CORE_CHECK_MEMORY)
     list(APPEND SRC "src/ErrorSimulator.c")
 endif()
 
 if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
-    set(MORE_WARNINGS
-        -Walloc-zero
-        -Wanalyzer-too-complex
-        -Warith-conversion
-        -Warray-bounds=2
-        -Wattribute-alias=2
-        -Wbidi-chars=any
-        -Wcast-align=strict
-        -Wduplicated-branches
-        -Wduplicated-cond
-        -Wformat-overflow=2
-        -Wformat-signedness
-        -Wformat-truncation=2
-        -Wimplicit-fallthrough=5
-        -Wjump-misses-init
-        -Wlogical-op
-        -Wnormalized=nfkc
-        -Wshift-overflow=2
-        -Wstack-usage=8388608
-        -Wstringop-overflow=4
-        -Wtrampolines
-        -Wtrivial-auto-var-init
-        -Wunused-const-variable=2
-        -Wuse-after-free=3
+    include("cmake/gcc_warnings.cmake")
+    set(DEFINITIONS ${DEFINITIONS}
+        bool=_Bool
+        true=1
+        false=0
+        nullptr=0
+        static_assert=_Static_assert
     )
+elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+    include("cmake/clang_warnings.cmake")
 endif()
 
 add_library(core STATIC ${SRC})
 target_compile_options(core PUBLIC
     ${COMPILE_OPTIONS}
-    -Wall
-    -Walloca
-    -Warray-parameter
-    -Wbad-function-cast
-    -Wcast-qual
-    -Wconversion
-    -Wdate-time
-    -Wdisabled-optimization
-    -Wdouble-promotion
-    -Wenum-compare
-    -Wenum-conversion
-    -Werror
-    -Wextra
-    -Wfloat-equal
-    -Wformat=2
-    -Wframe-larger-than=8388608
-    -Winfinite-recursion
-    -Winit-self
-    -Winvalid-pch
-    -Wlarger-than=1073741824
-    -Wmissing-braces
-    -Wmissing-declarations
-    -Wmissing-include-dirs
-    -Wmissing-prototypes
-    -Wmultichar
-    -Wnarrowing
-    -Wnested-externs
-    -Wnull-dereference
-    -Wold-style-definition
-    -Woverlength-strings
-    -Wredundant-decls
-    -Wshadow
-    -Wsign-conversion
-    -Wstack-protector
-    -Wstrict-overflow=2
-    -Wstrict-prototypes
-    -Wswitch-enum
-    -Wundef
-    -Wunreachable-code
-    -Wvla
-    -Wwrite-strings
+    ${WARNINGS}
     -fdiagnostics-color=always
-    -pedantic
-    -pedantic-errors
-    ${MORE_WARNINGS}
 )
 target_compile_definitions(core 
     PUBLIC CORE_LOG_LEVEL=${LOG_LEVEL}

+ 59 - 0
cmake/clang_warnings.cmake

@@ -0,0 +1,59 @@
+set(WARNINGS
+    -Wall
+    -Walloca
+    -Warray-parameter
+    -Wbad-function-cast
+    -Wcast-qual
+    -Wconditional-uninitialized
+    -Wconversion
+    -Wdate-time
+    -Wdisabled-optimization
+    -Wdouble-promotion
+    -Wenum-compare
+    -Wenum-conversion
+    -Werror
+    -Wextra
+    -Wextra-semi-stmt
+    -Wfloat-equal
+    -Wformat=2
+    -Wframe-larger-than=8388608
+    -Winfinite-recursion
+    -Winit-self
+    -Winvalid-pch
+    -Wlarger-than=1073741824
+    -Wmissing-braces
+    -Wmissing-declarations
+    -Wmissing-include-dirs
+    -Wmissing-noreturn 
+    -Wmissing-prototypes
+    -Wmultichar
+    -Wnarrowing
+    -Wnested-externs
+    -Wnull-dereference
+    -Wold-style-definition
+    -Woverlength-strings
+    -Wredundant-decls
+    -Wshadow
+    -Wsign-conversion
+    -Wstack-protector
+    -Wstrict-overflow=2
+    -Wstrict-prototypes
+    -Wswitch-enum
+    -Wundef
+    -Wunreachable-code
+    -Wvla
+    -Wwrite-strings
+    -pedantic
+    -pedantic-errors
+)
+
+if(0)
+    set(WARNINGS ${WARNINGS} 
+        -Weverything
+        -Wno-unsafe-buffer-usage
+        -Wno-c++98-compat
+        -Wno-declaration-after-statement
+        -Wno-pre-c2x-compat
+        -Wno-padded
+    )
+endif()

+ 70 - 0
cmake/gcc_warnings.cmake

@@ -0,0 +1,70 @@
+set(WARNINGS
+    -Wno-attributes
+
+    -Wall
+    -Walloc-zero
+    -Walloca
+    -Wanalyzer-too-complex
+    -Warith-conversion
+    -Warray-bounds=2
+    -Warray-parameter
+    -Wattribute-alias=2
+    -Wbad-function-cast
+    -Wbidi-chars=any
+    -Wcast-align=strict
+    -Wcast-qual
+    -Wconversion
+    -Wdate-time
+    -Wdisabled-optimization
+    -Wdouble-promotion
+    -Wduplicated-branches
+    -Wduplicated-cond
+    -Wenum-compare
+    -Wenum-conversion
+    -Werror
+    -Wextra
+    -Wfloat-equal
+    -Wformat-overflow=2
+    -Wformat-signedness
+    -Wformat-truncation=2
+    -Wformat=2
+    -Wframe-larger-than=8388608
+    -Wimplicit-fallthrough=5
+    -Winfinite-recursion
+    -Winit-self
+    -Winvalid-pch
+    -Wjump-misses-init
+    -Wlarger-than=1073741824
+    -Wlogical-op
+    -Wmissing-braces
+    -Wmissing-declarations
+    -Wmissing-include-dirs
+    -Wmissing-prototypes
+    -Wmultichar
+    -Wnarrowing
+    -Wnested-externs
+    -Wnormalized=nfkc
+    -Wnull-dereference
+    -Wold-style-definition
+    -Woverlength-strings
+    -Wredundant-decls
+    -Wshadow
+    -Wshift-overflow=2
+    -Wsign-conversion
+    -Wstack-protector
+    -Wstack-usage=8388608
+    -Wstrict-overflow=2
+    -Wstrict-prototypes
+    -Wstringop-overflow=4
+    -Wswitch-enum
+    -Wtrampolines
+    -Wtrivial-auto-var-init
+    -Wundef
+    -Wunreachable-code
+    -Wunused-const-variable=2
+    -Wuse-after-free=3
+    -Wvla
+    -Wwrite-strings
+    -pedantic
+    -pedantic-errors
+)

+ 4 - 4
include/core/Logger.h

@@ -27,7 +27,7 @@ check_format(6, 7) void coreLog(CoreLogLevel l, const char* file, int line,
 #if defined(CORE_LOG_LEVEL) && CORE_LOG_LEVEL >= 1
 #define CORE_LOG_ERROR(...)                                                    \
     coreLog(CORE_LOG_ERROR, __FILE__, __LINE__, CORE_TERMINAL_RED, "[ERROR] ", \
-            __VA_ARGS__);
+            __VA_ARGS__)
 #else
 #define CORE_LOG_ERROR(...)
 #endif
@@ -35,7 +35,7 @@ check_format(6, 7) void coreLog(CoreLogLevel l, const char* file, int line,
 #if defined(CORE_LOG_LEVEL) && CORE_LOG_LEVEL >= 2
 #define CORE_LOG_WARNING(...)                                                  \
     coreLog(CORE_LOG_WARNING, __FILE__, __LINE__, CORE_TERMINAL_YELLOW,        \
-            "[WARNING] ", __VA_ARGS__);
+            "[WARNING] ", __VA_ARGS__)
 #else
 #define CORE_LOG_WARNING(...)
 #endif
@@ -43,7 +43,7 @@ check_format(6, 7) void coreLog(CoreLogLevel l, const char* file, int line,
 #if defined(CORE_LOG_LEVEL) && CORE_LOG_LEVEL >= 3
 #define CORE_LOG_INFO(...)                                                     \
     coreLog(CORE_LOG_INFO, __FILE__, __LINE__, CORE_TERMINAL_GRAY, "[INFO] ",  \
-            __VA_ARGS__);
+            __VA_ARGS__)
 #else
 #define CORE_LOG_INFO(...)
 #endif
@@ -51,7 +51,7 @@ check_format(6, 7) void coreLog(CoreLogLevel l, const char* file, int line,
 #if defined(CORE_LOG_LEVEL) && CORE_LOG_LEVEL >= 4
 #define CORE_LOG_DEBUG(...)                                                    \
     coreLog(CORE_LOG_DEBUG, __FILE__, __LINE__, CORE_TERMINAL_GREEN,           \
-            "[DEBUG] ", __VA_ARGS__);
+            "[DEBUG] ", __VA_ARGS__)
 #else
 #define CORE_LOG_DEBUG(...)
 #endif

+ 2 - 1
include/core/Matrix.h

@@ -10,7 +10,8 @@ typedef struct {
 
 #define CORE_ZERO_MATRIX ((CoreMatrix){0})
 #define CORE_UNIT_MATRIX                                                       \
-    ((CoreMatrix){{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}})
+    ((CoreMatrix){                                                             \
+        {{{1, 0, 0, 0}}, {{0, 1, 0, 0}}, {{0, 0, 1, 0}}, {{0, 0, 0, 1}}}})
 
 CoreMatrix* coreTransposeMatrix(CoreMatrix* m);
 CoreMatrix* coreMulSetMatrix(CoreMatrix* m, const CoreMatrix* a);

+ 1 - 1
include/core/Quaternion.h

@@ -8,7 +8,7 @@ typedef struct {
     float w;
 } CoreQuaternion;
 
-#define CORE_UNIT_QUATERNION ((CoreQuaternion){{0.0f, 0.0f, 0.0f}, 1.0f})
+#define CORE_UNIT_QUATERNION ((CoreQuaternion){{{0.0f, 0.0f, 0.0f}}, 1.0f})
 
 CoreQuaternion* coreAxisAngleQ(CoreQuaternion* q, const CoreVector3* axis,
                                float angle);

+ 2 - 2
include/core/Utility.h

@@ -11,7 +11,7 @@ size_t corePopCount(u64 u);
 #define coreDegreeToRadian(degrees) (degrees * (CORE_PI / 180.0f))
 
 typedef void (*CoreExitHandler)(int, void*);
-void coreExitWithHandler(const char* file, int line, int value);
+[[noreturn]] void coreExitWithHandler(const char* file, int line, int value);
 void coreSetExitHandler(CoreExitHandler h, void* data);
 #define CORE_EXIT(exitValue) coreExitWithHandler(__FILE__, __LINE__, exitValue)
 
@@ -22,7 +22,7 @@ void coreSetOutOfMemoryHandler(CoreOutOfMemoryHandler h, void* data);
 void* coreDebugAllocate(const char* file, int line, size_t n);
 void* coreDebugReallocate(const char* file, int line, void* p, size_t n);
 void coreFreeDebug(const char* file, int line, void* p);
-void corePrintMemoryReport();
+void corePrintMemoryReport(void);
 #define coreAllocate(n) coreDebugAllocate(__FILE__, __LINE__, n)
 #define coreReallocate(p, n) coreDebugReallocate(__FILE__, __LINE__, p, n)
 #define coreFree(p) coreFreeDebug(__FILE__, __LINE__, p)

+ 18 - 18
src/Matrix.c

@@ -6,7 +6,7 @@
 #include "core/Utility.h"
 
 CoreMatrix* coreTransposeMatrix(CoreMatrix* m) {
-    CoreMatrix c;
+    CoreMatrix c = {0};
     for(size_t x = 0; x < 4; x++) {
         for(size_t y = 0; y < 4; y++) {
             c.data[x].data[y] = m->data[y].data[x];
@@ -39,7 +39,7 @@ CoreMatrix* coreMulMatrix(CoreMatrix* m, const CoreMatrix* a,
 
 CoreVector3* coreMulMatrixV3(CoreVector3* v, const CoreMatrix* m,
                              const CoreVector3* a) {
-    CoreVector4 v4 = {a->data[0], a->data[1], a->data[2], 1.0f};
+    CoreVector4 v4 = {{a->data[0], a->data[1], a->data[2], 1.0f}};
     v->data[0] = coreDotV4(m->data + 0, &v4);
     v->data[1] = coreDotV4(m->data + 1, &v4);
     v->data[2] = coreDotV4(m->data + 2, &v4);
@@ -55,7 +55,7 @@ CoreMatrix* coreScaleMatrix(CoreMatrix* m, const CoreVector3* v) {
 }
 
 CoreMatrix* coreScaleMatrixF(CoreMatrix* m, float f) {
-    return coreScaleMatrix(m, &(CoreVector3){f, f, f});
+    return coreScaleMatrix(m, &(CoreVector3){{f, f, f}});
 }
 
 CoreMatrix* coreTranslateMatrix(CoreMatrix* m, const CoreVector3* v) {
@@ -81,10 +81,10 @@ CoreMatrix* coreTranslateMatrixZ(CoreMatrix* m, float tz) {
 }
 
 CoreMatrix* coreTranslateMatrixTo(CoreMatrix* m, const CoreVector3* v) {
-    m->data[0] = (CoreVector4){1.0f, 0.0f, 0.0f, v->data[0]};
-    m->data[1] = (CoreVector4){0.0f, 1.0f, 0.0f, v->data[1]};
-    m->data[2] = (CoreVector4){0.0f, 0.0f, 1.0f, v->data[2]};
-    m->data[3] = (CoreVector4){0.0f, 0.0f, 0.0f, 1.0f};
+    m->data[0] = (CoreVector4){{1.0f, 0.0f, 0.0f, v->data[0]}};
+    m->data[1] = (CoreVector4){{0.0f, 1.0f, 0.0f, v->data[1]}};
+    m->data[2] = (CoreVector4){{0.0f, 0.0f, 1.0f, v->data[2]}};
+    m->data[3] = (CoreVector4){{0.0f, 0.0f, 0.0f, 1.0f}};
     return m;
 }
 
@@ -118,20 +118,20 @@ CoreMatrix* coreRotateMatrix(CoreMatrix* m, const CoreQuaternion* q) {
     CoreVector3 c;
     CoreVector3 d;
     coreMulQV3(&a, q,
-               &(CoreVector3){m->data[0].data[0], m->data[1].data[0],
-                              m->data[2].data[0]});
+               &(CoreVector3){{m->data[0].data[0], m->data[1].data[0],
+                               m->data[2].data[0]}});
     coreMulQV3(&b, q,
-               &(CoreVector3){m->data[0].data[1], m->data[1].data[1],
-                              m->data[2].data[1]});
+               &(CoreVector3){{m->data[0].data[1], m->data[1].data[1],
+                               m->data[2].data[1]}});
     coreMulQV3(&c, q,
-               &(CoreVector3){m->data[0].data[2], m->data[1].data[2],
-                              m->data[2].data[2]});
+               &(CoreVector3){{m->data[0].data[2], m->data[1].data[2],
+                               m->data[2].data[2]}});
     coreMulQV3(&d, q,
-               &(CoreVector3){m->data[0].data[3], m->data[1].data[3],
-                              m->data[2].data[3]});
-    m->data[0] = (CoreVector4){a.data[0], b.data[0], c.data[0], d.data[0]};
-    m->data[1] = (CoreVector4){a.data[1], b.data[1], c.data[1], d.data[1]};
-    m->data[2] = (CoreVector4){a.data[2], b.data[2], c.data[2], d.data[2]};
+               &(CoreVector3){{m->data[0].data[3], m->data[1].data[3],
+                               m->data[2].data[3]}});
+    m->data[0] = (CoreVector4){{a.data[0], b.data[0], c.data[0], d.data[0]}};
+    m->data[1] = (CoreVector4){{a.data[1], b.data[1], c.data[1], d.data[1]}};
+    m->data[2] = (CoreVector4){{a.data[2], b.data[2], c.data[2], d.data[2]}};
 
     //    Vector3 a = q * Vector3(data[0][0], data[1][0], data[2][0]);
     //    Vector3 b = q * Vector3(data[0][1], data[1][1], data[2][1]);

+ 1 - 0
src/Random.c

@@ -3,6 +3,7 @@
 static const size_t M = 7;
 
 void coreInitRandom(CoreRandom* r, u32 seed) {
+    r->index = 0;
     for(size_t i = 0; i < CORE_ARRAY_LENGTH(r->data); i++) {
         r->data[i] = seed;
         seed = seed * 7 + 31;

+ 13 - 6
src/Utility.c

@@ -23,7 +23,7 @@ size_t corePopCount(u64 u) {
     return sum;
 }
 
-void coreExitWithHandler(const char* file, int line, int value) {
+[[noreturn]] void coreExitWithHandler(const char* file, int line, int value) {
     if(value != 0) {
         file = coreGetShortFileName(file);
         CORE_LOG_ERROR("Exit from %s:%d with value %d", file, line, value);
@@ -46,7 +46,7 @@ void coreSetOutOfMemoryHandler(CoreOutOfMemoryHandler h, void* data) {
 
 static void* exitOnNull(void* p, size_t n) {
     if(p == nullptr) {
-        CORE_LOG_ERROR("Out of memory, requested '%zd' bytes", n)
+        CORE_LOG_ERROR("Out of memory, requested '%zu' bytes", n);
         CORE_EXIT(1);
     }
     return p;
@@ -67,9 +67,11 @@ static void* coreRealReallocate(void* oldP, size_t n) {
         return nullptr;
     }
     void* p = realloc(oldP, n);
-    while(p == nullptr && outOfMemoryHandler != nullptr) {
-        outOfMemoryHandler(outOfMemoryData);
-        p = realloc(oldP, n);
+    if(p == nullptr) {
+        while(p == nullptr && outOfMemoryHandler != nullptr) {
+            outOfMemoryHandler(outOfMemoryData);
+            p = realloc(oldP, n);
+        }
     }
     return exitOnNull(p, n);
 }
@@ -163,7 +165,12 @@ void coreFreeDebug(const char* file, int line, void* p) {
     if(p == nullptr) {
         return;
     }
-    CoreMemoryInfo* rp = (CoreMemoryInfo*)((char*)p - sizeof(CoreMemoryInfo));
+    CoreMemoryInfo* rp = nullptr;
+    void* w = (char*)p - sizeof(CoreMemoryInfo);
+    memcpy(&rp, &w, sizeof(rp));
+
+    // CoreMemoryInfo* rp = (CoreMemoryInfo*)((char*)p -
+    // sizeof(CoreMemoryInfo));
     if(checkCanary(rp->canary)) {
         file = coreGetShortFileName(file);
         CORE_LOG_ERROR("Free at %s:%d violated pre canary", file, line);

+ 0 - 1
test/Main.c

@@ -59,5 +59,4 @@ int main(int argAmount, const char** args) {
     coreSetExitHandler(onExit, &data);
 
     CORE_EXIT(1);
-    return 0;
 }

+ 4 - 4
test/Test.c

@@ -88,7 +88,7 @@ CORE_TEST_NAMED_COMPARE(Size, size_t, "%zu")
 CORE_TEST_NAMED_COMPARE(Bool, bool, "%d")
 
 bool coreTestString(CORE_TEST_ARGS, const char* wanted, const char* actual) {
-    CORE_TEST_SUCCESS(strcmp(wanted, actual) == 0);
+    CORE_TEST_SUCCESS(strcmp(wanted, actual) == 0)
     fputs(CORE_TERMINAL_RED, stdout);
     printf("%s:%d - expected '%s' got '%s'", file, line, wanted, actual);
     puts(CORE_TERMINAL_RESET);
@@ -98,7 +98,7 @@ bool coreTestString(CORE_TEST_ARGS, const char* wanted, const char* actual) {
 bool coreTestFloat(CORE_TEST_ARGS, float wanted, float actual, float error) {
     float diff = wanted - actual;
     diff = diff < 0.0f ? -diff : diff;
-    CORE_TEST_SUCCESS(diff <= error);
+    CORE_TEST_SUCCESS(diff <= error)
     fputs(CORE_TERMINAL_RED, stdout);
     printf("%s:%d - expected '%.3f' got '%.3f'", file, line, (double)wanted,
            (double)actual);
@@ -107,7 +107,7 @@ bool coreTestFloat(CORE_TEST_ARGS, float wanted, float actual, float error) {
 }
 
 bool coreTestNull(CORE_TEST_ARGS, const void* actual) {
-    CORE_TEST_SUCCESS(actual == nullptr);
+    CORE_TEST_SUCCESS(actual == nullptr)
     fputs(CORE_TERMINAL_RED, stdout);
     printf("%s:%d - expected null", file, line);
     puts(CORE_TERMINAL_RESET);
@@ -115,7 +115,7 @@ bool coreTestNull(CORE_TEST_ARGS, const void* actual) {
 }
 
 bool coreTestNotNull(CORE_TEST_ARGS, const void* actual) {
-    CORE_TEST_SUCCESS(actual != nullptr);
+    CORE_TEST_SUCCESS(actual != nullptr)
     fputs(CORE_TERMINAL_RED, stdout);
     printf("%s:%d - expected valid pointer", file, line);
     puts(CORE_TERMINAL_RESET);

+ 2 - 2
test/Tests.h

@@ -21,8 +21,8 @@ void coreTestRingBuffer(void);
 void coreTestStack(bool light);
 void coreTestThread(void);
 void coreTestUtility(bool light);
-void coreTestInvalidAllocate(void);
-void coreTestInvalidReallocate(void);
+[[noreturn]] void coreTestInvalidAllocate(void);
+[[noreturn]] void coreTestInvalidReallocate(void);
 void coreTestPreCanary(void);
 void coreTestPostCanary(void);
 void coreTestVector(void);

+ 1 - 1
test/modules/MatrixTests.c

@@ -3,7 +3,7 @@
 
 typedef CoreMatrix Matrix;
 typedef CoreVector3 V3;
-#define CV3(a, b, c) (&(V3){a, b, c})
+#define CV3(a, b, c) (&(V3){{a, b, c}})
 #define CV30 CV3(0.0f, 0.0f, 0.0f)
 
 static void testInit() {

+ 4 - 5
test/modules/QuaternionTests.c

@@ -2,8 +2,7 @@
 #include "core/Quaternion.h"
 
 typedef CoreQuaternion Q;
-#define Q(a, b, c, d) (&(Q){{a, b, c}, d})
-#define CV3(a, b, c) (&(CoreVector3){a, b, c})
+#define CV3(a, b, c) (&(CoreVector3){{a, b, c}})
 #define CV30 CV3(0.0f, 0.0f, 0.0f)
 
 static void testInit() {
@@ -84,9 +83,9 @@ static void testMulVector() {
     Q q3 = CORE_UNIT_QUATERNION;
     coreAxisAngleQ(&q3, CV3(0.0f, 0.0f, 1.0f), 90.0f);
 
-    CoreVector3 v1 = {1.0f, 0.0f, 0.0f};
-    CoreVector3 v2 = {0.0f, 1.0f, 0.0f};
-    CoreVector3 v3 = {0.0f, 0.0f, 1.0f};
+    CoreVector3 v1 = {{1.0f, 0.0f, 0.0f}};
+    CoreVector3 v2 = {{0.0f, 1.0f, 0.0f}};
+    CoreVector3 v3 = {{0.0f, 0.0f, 1.0f}};
 
     CORE_TEST_V3(CV3(1.0f, 0.0f, 0.0f), coreMulQV3(CV30, &q1, &v1));
     CORE_TEST_V3(CV3(0.0f, 0.0f, 1.0f), coreMulQV3(CV30, &q1, &v2));

+ 2 - 2
test/modules/UtilityTests.c

@@ -105,7 +105,7 @@ void coreTestInvalidReallocate(void) {
     CORE_EXIT(0);
 }
 
-void coreTestPreCanary(void) {
+[[noreturn]] void coreTestPreCanary(void) {
 #ifdef CORE_CHECK_MEMORY
     char* p = coreAllocate(16);
     p[-1] = 0;
@@ -116,7 +116,7 @@ void coreTestPreCanary(void) {
     CORE_EXIT(0);
 }
 
-void coreTestPostCanary(void) {
+[[noreturn]] void coreTestPostCanary(void) {
 #ifdef CORE_CHECK_MEMORY
     char* p = coreAllocate(16);
     p[17] = 0;

+ 13 - 13
test/modules/VectorTests.c

@@ -3,34 +3,34 @@
 #include "../Tests.h"
 #include "core/Vector.h"
 
-const float eps = 0.0001f;
+static const float eps = 0.0001f;
 
 #define V2 CoreVector2
-#define CV2(a, b, c, d) (&(V2){a, b})
+#define CV2(a, b, c, d) (&(V2){{a, b}})
 #define FV2(a, b) CV2(a, b, 0, 0)
 #define CV20 CV2(0, 0, 0, 0)
 
 #define V3 CoreVector3
-#define CV3(a, b, c, d) (&(V3){a, b, c})
+#define CV3(a, b, c, d) (&(V3){{a, b, c}})
 #define FV3(a, b, c) CV3(a, b, c, 0)
 #define CV30 CV3(0, 0, 0, 0)
 
 #define V4 CoreVector4
-#define CV4(a, b, c, d) (&(V4){a, b, c, d})
+#define CV4(a, b, c, d) (&(V4){{a, b, c, d}})
 #define CV40 CV4(0, 0, 0, 0)
 
 #define IV2 CoreIntVector2
-#define CIV2(a, b, c, d) (&(IV2){a, b})
+#define CIV2(a, b, c, d) (&(IV2){{a, b}})
 #define FIV2(a, b) CIV2(a, b, 0, 0)
 #define CIV20 CIV2(0, 0, 0, 0)
 
 #define IV3 CoreIntVector3
-#define CIV3(a, b, c, d) (&(IV3){a, b, c})
+#define CIV3(a, b, c, d) (&(IV3){{a, b, c}})
 #define FIV3(a, b, c) CIV3(a, b, c, 0)
 #define CIV30 CIV3(0, 0, 0, 0)
 
 #define IV4 CoreIntVector4
-#define CIV4(a, b, c, d) (&(IV4){a, b, c, d})
+#define CIV4(a, b, c, d) (&(IV4){{a, b, c, d}})
 #define CIV40 CIV4(0, 0, 0, 0)
 
 #define TESTS X(V2) X(V3) X(V4) X(IV2) X(IV3) X(IV4)
@@ -222,39 +222,39 @@ static void testLength() {
 
 static void testNormalize() {
     {
-        V2 v1 = {-15, 20};
+        V2 v1 = {{-15, 20}};
         V2 v2;
         coreMulV2F(&v2, &v1, 1.0f / 25.0f);
         coreNormalizeV2(&v1);
         CORE_TEST_V2(&v2, &v1);
 
-        V2 v3 = {15, 36};
+        V2 v3 = {{15, 36}};
         V2 v4;
         coreMulV2F(&v4, &v3, 1.0f / 39.0f);
         coreNormalizeV2(&v3);
         CORE_TEST_V2(&v4, &v3);
     }
     {
-        V3 v1 = {-2, 2, -1};
+        V3 v1 = {{-2, 2, -1}};
         V3 v2;
         coreMulV3F(&v2, &v1, 1.0f / 3.0f);
         coreNormalizeV3(&v1);
         CORE_TEST_V3(&v2, &v1);
 
-        V3 v3 = {6, 2, -3};
+        V3 v3 = {{6, 2, -3}};
         V3 v4;
         coreMulV3F(&v4, &v3, 1.0f / 7.0f);
         coreNormalizeV3(&v3);
         CORE_TEST_V3(&v4, &v3);
     }
     {
-        V4 v1 = {-2, 2, 0, -1};
+        V4 v1 = {{-2, 2, 0, -1}};
         V4 v2;
         coreMulV4F(&v2, &v1, 1.0f / 3.0f);
         coreNormalizeV4(&v1);
         CORE_TEST_V4(&v2, &v1);
 
-        V4 v3 = {6, 0, -6, 3};
+        V4 v3 = {{6, 0, -6, 3}};
         V4 v4;
         coreMulV4F(&v4, &v3, 1.0f / 9.0f);
         coreNormalizeV4(&v3);