Remove useless void checks

This commit is contained in:
2026-05-26 19:24:17 -05:00
parent 1f2657cea0
commit 109318aeaf
16 changed files with 44 additions and 94 deletions
@@ -45,8 +45,6 @@ errorret_t entityOverworldDraw(
const componentid_t componentId,
void *user
) {
(void)componentId; (void)user;
componentid_t owCompId = entityGetComponent(entityId, COMPONENT_TYPE_OVERWORLD);
entityoverworld_t *ow = entityOverworldGet(entityId, owCompId);
@@ -16,8 +16,6 @@ void overworldGroundAdd(overworldground_t *ground) {
ground->posCompId = entityAddComponent(
ground->entityId, COMPONENT_TYPE_POSITION
);
(void)entityAddComponent(ground->entityId, COMPONENT_TYPE_RENDERABLE);
vec3 pos = { -OVERWORLD_GROUND_SIZE, 0.0f, -OVERWORLD_GROUND_SIZE };
vec3 scale = { OVERWORLD_GROUND_SIZE * 2.0f, 1.0f, OVERWORLD_GROUND_SIZE * 2.0f };
entityPositionSetLocalPosition(ground->entityId, ground->posCompId, pos);
+2 -2
View File
@@ -15,8 +15,8 @@
void overworldNpcAdd(overworldnpc_t *npc, vec3 position) {
npc->entityId = entityManagerAdd();
npc->posCompId = entityAddComponent(npc->entityId, COMPONENT_TYPE_POSITION);
(void)entityAddComponent(npc->entityId, COMPONENT_TYPE_RENDERABLE);
(void)entityAddComponent(npc->entityId, COMPONENT_TYPE_PHYSICS);
entityAddComponent(npc->entityId, COMPONENT_TYPE_RENDERABLE);
entityAddComponent(npc->entityId, COMPONENT_TYPE_PHYSICS);
npc->overworldCompId = entityAddComponent(npc->entityId, COMPONENT_TYPE_OVERWORLD);
npc->triggerCompId = entityAddComponent(npc->entityId, COMPONENT_TYPE_TRIGGER);
npc->interactableCompId = entityAddComponent(
+2 -2
View File
@@ -14,8 +14,8 @@
void overworldPlayerAdd(overworldplayer_t *player) {
player->entityId = entityManagerAdd();
player->posCompId = entityAddComponent(player->entityId, COMPONENT_TYPE_POSITION);
(void)entityAddComponent(player->entityId, COMPONENT_TYPE_RENDERABLE);
(void)entityAddComponent(player->entityId, COMPONENT_TYPE_PHYSICS);
entityAddComponent(player->entityId, COMPONENT_TYPE_RENDERABLE);
entityAddComponent(player->entityId, COMPONENT_TYPE_PHYSICS);
componentid_t owCompId = entityAddComponent(player->entityId, COMPONENT_TYPE_OVERWORLD);
entityOverworldSetType(player->entityId, owCompId, OVERWORLD_ENTITY_TYPE_PLAYER);
player->playerCompId = entityAddComponent(player->entityId, COMPONENT_TYPE_PLAYER);
+2 -3
View File
@@ -28,7 +28,6 @@ static void overworldSceneNpcInteract(
const componentid_t componentId,
void *user
) {
(void)entityId; (void)componentId; (void)user;
consolePrint("NPC interacted with!");
}
@@ -100,8 +99,8 @@ void overworldSceneInit(void) {
overworldSceneConfigureSprite(OVERWORLD.npc.entityId, COLOR_BLUE, NULL);
OVERWORLD.cameraEntityId = entityManagerAdd();
(void)entityAddComponent(OVERWORLD.cameraEntityId, COMPONENT_TYPE_POSITION);
(void)entityAddComponent(OVERWORLD.cameraEntityId, COMPONENT_TYPE_CAMERA);
entityAddComponent(OVERWORLD.cameraEntityId, COMPONENT_TYPE_POSITION);
entityAddComponent(OVERWORLD.cameraEntityId, COMPONENT_TYPE_CAMERA);
OVERWORLD.cameraOverworldCompId = entityAddComponent(
OVERWORLD.cameraEntityId, COMPONENT_TYPE_OVERWORLD_CAMERA
);
+2 -2
View File
@@ -22,7 +22,7 @@ static void testSceneSpawnTestEntity(void) {
entityid_t entity = entityManagerAdd();
componentid_t posComp = entityAddComponent(entity, COMPONENT_TYPE_POSITION);
(void)entityAddComponent(entity, COMPONENT_TYPE_RENDERABLE);
entityAddComponent(entity, COMPONENT_TYPE_RENDERABLE);
const int32_t cols = 20;
const float_t spacing = 1.5f;
@@ -76,7 +76,7 @@ void testSceneInit(void) {
cameraEntityId = entityManagerAdd();
cameraCompId = entityAddComponent(cameraEntityId, COMPONENT_TYPE_POSITION);
(void)entityAddComponent(cameraEntityId, COMPONENT_TYPE_CAMERA);
entityAddComponent(cameraEntityId, COMPONENT_TYPE_CAMERA);
vec3 eye, target, up;
glm_vec3_zero(target);
-1
View File
@@ -65,7 +65,6 @@ void uiTextboxBuildLayout(void) {
float_t contentW = UI_TEXTBOX.width - 2.0f * frameTileW;
float_t contentH = UI_TEXTBOX.height - 2.0f * frameTileH;
(void)contentH;
UI_TEXTBOX.charsPerLine = (int32_t)(contentW / fontW);
UI_TEXTBOX.linesPerPage = UI_TEXTBOX_LINES_PER_PAGE_MAX;
-26
View File
@@ -9,8 +9,6 @@
#include "assert/assert.h"
static void test_assertTrueImpl(void **state) {
(void)state;
// Should not assert when true false statement
assertTrueImpl(__FILE__, __LINE__, true, "This should not assert");
@@ -19,8 +17,6 @@ static void test_assertTrueImpl(void **state) {
}
static void test_assertFalseImpl(void **state) {
(void)state;
// Should not assert when passing false statement
assertFalseImpl(__FILE__, __LINE__, false, "This should not assert");
@@ -30,15 +26,11 @@ static void test_assertFalseImpl(void **state) {
static void test_assertUnreachableImpl(void **state) {
(void)state;
// Should always assert false
expect_assert_failure(assertUnreachableImpl(__FILE__, __LINE__, "asserts"));
}
static void test_assertNotNullImpl(void **state) {
(void)state;
int someValue = 42;
// Should not assert with a valid pointer
@@ -49,15 +41,11 @@ static void test_assertNotNullImpl(void **state) {
}
static void test_assertDeprecatedImpl(void **state) {
(void)state;
// Always asserts when called
expect_assert_failure(assertDeprecatedImpl(__FILE__, __LINE__, "deprecated"));
}
static void test_assertTrue(void **state) {
(void)state;
// Should not assert when passing true statement
assertTrue(true, "This should not assert");
@@ -66,8 +54,6 @@ static void test_assertTrue(void **state) {
}
static void test_assertFalse(void **state) {
(void)state;
// Should not assert when passing true statement
assertFalse(false, "This should not assert");
@@ -76,15 +62,11 @@ static void test_assertFalse(void **state) {
}
static void test_assertUnreachable(void **state) {
(void)state;
// Should always assert false
expect_assert_failure(assertUnreachable("asserts"));
}
static void test_assertNotNull(void **state) {
(void)state;
int someValue = 42;
// Should not assert with a valid pointer
@@ -95,8 +77,6 @@ static void test_assertNotNull(void **state) {
}
static void test_assertNull(void **state) {
(void)state;
int someValue = 42;
// Should assert with a valid pointer
@@ -107,15 +87,11 @@ static void test_assertNull(void **state) {
}
static void test_assertDeprecated(void **state) {
(void)state;
// Always asserts when called
expect_assert_failure(assertDeprecated("deprecated"));
}
static void test_assertStrLenMax(void **state) {
(void)state;
// Should not assert when string length is within limit
assertStrLenMax("test", 10, "This should not assert");
@@ -124,8 +100,6 @@ static void test_assertStrLenMax(void **state) {
}
static void test_assertStrLenMin(void **state) {
(void)state;
// Should not assert when string length meets minimum
assertStrLenMin("sufficient", 5, "This should not assert");
-9
View File
@@ -9,8 +9,6 @@
#include "display/color.h"
static void test_color3f_create(void **state) {
(void)state;
color3f_t color = color3f(0.1f, 0.2f, 0.3f);
assert_float_equal(color.r, 0.1f, 0.0001f);
assert_float_equal(color.g, 0.2f, 0.0001f);
@@ -18,8 +16,6 @@ static void test_color3f_create(void **state) {
}
static void test_color4f_create(void **state) {
(void)state;
color4f_t color = color4f(0.1f, 0.2f, 0.3f, 0.4f);
assert_float_equal(color.r, 0.1f, 0.0001f);
assert_float_equal(color.g, 0.2f, 0.0001f);
@@ -28,8 +24,6 @@ static void test_color4f_create(void **state) {
}
static void test_color3b_create(void **state) {
(void)state;
color3b_t color = color3b(10, 20, 30);
assert_int_equal(color.r, 10);
assert_int_equal(color.g, 20);
@@ -37,7 +31,6 @@ static void test_color3b_create(void **state) {
}
static void test_color4b_create(void **state) {
(void)state;
color4b_t color = color4b(10, 20, 30, 40);
assert_int_equal(color.r, 10);
@@ -47,7 +40,6 @@ static void test_color4b_create(void **state) {
}
static void test_color_create(void **state) {
(void)state;
color_t color = color(10, 20, 30, 40);
assert_int_equal(color.r, 10);
@@ -57,7 +49,6 @@ static void test_color_create(void **state) {
}
static void test_colorHex_create(void **state) {
(void)state;
color_t color = colorHex(0x11223344);
assert_int_equal(color.r, 0x11);
+9 -9
View File
@@ -9,7 +9,7 @@
#include "item/inventory.h"
static void test_inventoryInit(void **state) {
(void)state;
inventorystack_t storage[5];
inventory_t inventory;
@@ -37,7 +37,7 @@ static void test_inventoryInit(void **state) {
}
static void test_inventoryItemExists(void **state) {
(void)state;
inventorystack_t storage[5];
inventory_t inventory;
@@ -77,7 +77,7 @@ static void test_inventoryItemExists(void **state) {
}
static void test_inventorySet(void **state) {
(void)state;
inventorystack_t storage[5];
inventory_t inventory;
@@ -135,7 +135,7 @@ static void test_inventorySet(void **state) {
}
static void test_inventoryAdd(void **state) {
(void)state;
inventorystack_t storage[5];
inventory_t inventory;
@@ -172,7 +172,7 @@ static void test_inventoryAdd(void **state) {
}
static void test_inventoryRemove(void **state) {
(void)state;
inventorystack_t storage[5];
inventory_t inventory;
@@ -205,7 +205,7 @@ static void test_inventoryRemove(void **state) {
}
static void test_inventoryGetCount(void **state) {
(void)state;
inventorystack_t storage[5];
inventory_t inventory;
@@ -244,7 +244,7 @@ static void test_inventoryGetCount(void **state) {
}
static void test_inventoryIsFull(void **state) {
(void)state;
inventorystack_t storage[2];
inventory_t inventory;
@@ -281,7 +281,7 @@ static void test_inventoryIsFull(void **state) {
}
static void test_inventoryItemFull(void **state) {
(void)state;
inventorystack_t storage[2];
inventory_t inventory;
@@ -327,7 +327,7 @@ static void test_inventoryItemFull(void **state) {
}
static void test_inventorySort(void **state) {
(void)state;
inventorystack_t storage[5];
inventory_t inventory;
+1 -2
View File
@@ -23,7 +23,6 @@ uint64_t SDL_GetTicks64(void) {
// Tests
static void test_timeInit(void **state) {
(void)state;
// Fill time with garbage
memorySet(&TIME, 0xFF, sizeof(TIME));
@@ -40,7 +39,7 @@ static void test_timeInit(void **state) {
}
static void test_timeUpdate(void **state) {
(void)state;
// Init first
timeInit();
+1 -1
View File
@@ -10,7 +10,7 @@
#include "util/array.h"
static void test_arrayReverse(void **state) {
(void)state;
uint8_t array1[] = { 1, 2, 3, 4, 5 };
arrayReverse(array1, 5, sizeof(uint8_t));
+4 -5
View File
@@ -9,7 +9,7 @@
#include "util/math.h"
static void test_mathNextPowTwo(void **state) {
(void)state;
// Positive integers
assert_int_equal(mathNextPowTwo(0), 1);
@@ -44,7 +44,6 @@ static void test_mathNextPowTwo(void **state) {
}
static void test_mathMax(void **state) {
(void)state;
// Test positive integers
assert_int_equal(mathMax(1, 2), 2);
assert_int_equal(mathMax(2, 1), 2);
@@ -94,7 +93,7 @@ static void test_mathMax(void **state) {
}
static void test_mathMin(void **state) {
(void)state;
// Positive integers
assert_int_equal(mathMin(1, 2), 1);
@@ -145,7 +144,7 @@ static void test_mathMin(void **state) {
}
static void test_mathClamp(void **state) {
(void)state;
// Positive Integer bounds.
assert_int_equal(mathClamp(5, 1, 10), 5); // Within bounds
@@ -203,7 +202,7 @@ static void test_mathClamp(void **state) {
}
static void test_mathAbs(void **state) {
(void)state;
// Positive integers
assert_int_equal(mathAbs(5), 5);
+11 -11
View File
@@ -9,7 +9,7 @@
#include "util/memory.h"
static void test_memoryAllocate(void **state) {
(void)state;
// Memory should allocate
void *ptr = memoryAllocate(128);
@@ -39,7 +39,7 @@ static void test_memoryAllocate(void **state) {
}
static void test_memoryFree(void **state) {
(void)state;
// Create some memory
void *ptr = memoryAllocate(64);
@@ -72,7 +72,7 @@ static void test_memoryFree(void **state) {
}
static void test_memoryCopy(void **state) {
(void)state;
// Create some memory
size_t size = 32;
@@ -112,7 +112,7 @@ static void test_memoryCopy(void **state) {
}
static void test_memorySet(void **state) {
(void)state;
// Allocate memory
size_t size = 16;
@@ -146,7 +146,7 @@ static void test_memorySet(void **state) {
}
static void test_memoryZero(void **state) {
(void)state;
// Create some memory
size_t size = 20;
@@ -174,7 +174,7 @@ static void test_memoryZero(void **state) {
}
static void test_memoryCopyRangeSafe(void **state) {
(void)state;
// Create some memory
size_t size = 10;
@@ -223,7 +223,7 @@ static void test_memoryCopyRangeSafe(void **state) {
}
static void test_memoryMove(void **state) {
(void)state;
// Create some memory
size_t size = 15;
@@ -276,7 +276,7 @@ static void test_memoryMove(void **state) {
}
static void test_memoryCompare(void **state) {
(void)state;
// Create two memory blocks
size_t size = 8;
@@ -327,7 +327,7 @@ static void test_memoryCompare(void **state) {
}
static void test_memoryReallocate(void **state) {
(void)state;
size_t initialSize = 16;
void *ptr = memoryAllocate(initialSize);
@@ -360,7 +360,7 @@ static void test_memoryReallocate(void **state) {
}
static void test_memoryResize(void **state) {
(void)state;
size_t initialSize = 32;
void *ptr = memoryAllocate(initialSize);
@@ -424,7 +424,7 @@ static void test_memoryResize(void **state) {
}
static void test_memoryCopyInterleaved(void **state) {
(void)state;
// Basic: copy 4 uint32_t values from contiguous source into every-other dest
// slot (stride = 2*sizeof(uint32_t)).
+1 -3
View File
@@ -104,17 +104,15 @@ void testSortMethod(
}
static void test_sortBubble(void **state) {
(void)state;
testSortMethod(sortBubble, "sortBubble");
}
static void test_sortQuick(void **state) {
(void)state;
testSortMethod(sortQuick, "sortQuick");
}
static void test_sortArrayU8(void **state) {
(void)state;
// Create an array of uint8_t
size_t count = 6;
+9 -14
View File
@@ -10,7 +10,6 @@
#include "util/memory.h"
static void test_stringIsWhitespace(void **state) {
(void)state;
assert_true(stringIsWhitespace(' ')); // Space is whitespace
assert_true(stringIsWhitespace('\t')); // Tab is whitespace
assert_true(stringIsWhitespace('\n')); // Newline is whitespace
@@ -27,7 +26,6 @@ static void test_stringIsWhitespace(void **state) {
}
static void test_stringCopy(void **state) {
(void)state;
char dest[16];
stringCopy(dest, "hello", sizeof(dest));
assert_string_equal(dest, "hello"); // Normal copy
@@ -57,7 +55,7 @@ static void test_stringCopy(void **state) {
}
static void test_stringCompare(void **state) {
(void)state;
// Check for equality
assert_int_equal(stringCompare("abc", "abc"), 0);
@@ -82,7 +80,7 @@ static void test_stringCompare(void **state) {
}
static void test_stringCompareInsensitive(void **state) {
(void)state;
assert_int_equal(stringCompareInsensitive("abc", "ABC"), 0);
assert_true(stringCompareInsensitive("abc", "abd") < 0);
@@ -100,7 +98,7 @@ static void test_stringCompareInsensitive(void **state) {
}
static void test_stringTrim(void **state) {
(void)state;
char buf[32];
stringCopy(buf, " hello ", sizeof(buf));
@@ -146,7 +144,7 @@ static void test_stringTrim(void **state) {
}
static void test_stringFindLastChar(void **state) {
(void)state;
const char *str = "hello world";
char *result = stringFindLastChar(str, 'o');
@@ -170,7 +168,7 @@ static void test_stringFindLastChar(void **state) {
}
static void test_stringFormat(void **state) {
(void)state;
// Test a string format
char buffer[32];
@@ -229,7 +227,6 @@ static void test_stringFormat(void **state) {
}
static void test_stringToI32(void **state) {
(void)state;
char_t buffer[64];
int32_t value;
@@ -358,7 +355,6 @@ static void test_stringToI32(void **state) {
}
static void test_stringToI64(void **state) {
(void)state;
char_t buffer[64];
int64_t value;
@@ -487,7 +483,7 @@ static void test_stringToI64(void **state) {
}
static void test_stringToI16(void **state) {
(void)state;
char_t buffer[64];
int16_t value;
@@ -608,7 +604,7 @@ static void test_stringToI16(void **state) {
}
static void test_stringToU16(void **state) {
(void)state;
char_t buffer[64];
uint16_t value;
@@ -725,7 +721,7 @@ static void test_stringToU16(void **state) {
}
static void test_stringToF32(void **state) {
(void)state;
char_t buffer[64];
float value;
@@ -859,7 +855,7 @@ static void test_stringToF32(void **state) {
}
static void test_stringEndsWith(void **state) {
(void)state;
assert_true(stringEndsWith("hello.c", ".c"));
assert_true(stringEndsWith("Hello World!", "World!"));
@@ -877,7 +873,6 @@ static void test_stringEndsWith(void **state) {
}
static void test_stringEndsWithCaseInsensitive(void **state) {
(void)state;
assert_true(stringEndsWithCaseInsensitive("hello.C", ".c"));
assert_true(stringEndsWithCaseInsensitive("Hello World!", "world!"));