remove unused-variable relaxation hints

This commit is contained in:
jacob 2025-12-02 16:22:22 -06:00
parent 98d849c3de
commit 0c796768e5
12 changed files with 11 additions and 33 deletions

View File

@ -238,8 +238,6 @@ void ASE_Inflate(u8 *dst, u8 *encoded)
u8 cmf = (u8)(cm | (cinfo << 4)); u8 cmf = (u8)(cm | (cinfo << 4));
u8 flg = fcheck | (fdict << 5) | (flevl << 6); u8 flg = fcheck | (fdict << 5) | (flevl << 6);
LAX cmf;
LAX flg;
Assert(((cmf * 256) + flg) % 31 == 0); Assert(((cmf * 256) + flg) % 31 == 0);
u8 bfinal = 0; u8 bfinal = 0;
@ -255,7 +253,6 @@ void ASE_Inflate(u8 *dst, u8 *encoded)
i16 len = ASE_ConsumeBits(&bb, 16); i16 len = ASE_ConsumeBits(&bb, 16);
i16 nlen = ASE_ConsumeBits(&bb, 16); i16 nlen = ASE_ConsumeBits(&bb, 16);
Assert(len == ~nlen); /* Validation */ Assert(len == ~nlen); /* Validation */
LAX nlen;
while (len-- > 0) while (len-- > 0)
{ {
*dst++ = ASE_ConsumeBits(&bb, 8); *dst++ = ASE_ConsumeBits(&bb, 8);

View File

@ -49,7 +49,6 @@ AC_Asset *AC_GetAssetCacheSlotLocked(Lock *lock, String key, u64 hash)
{ {
AC_SharedState *g = &AC_shared_state; AC_SharedState *g = &AC_shared_state;
AssertLockedES(lock, &g->lookup_mutex); AssertLockedES(lock, &g->lookup_mutex);
LAX lock;
u64 index = hash % countof(g->lookup); u64 index = hash % countof(g->lookup);
for (;;) for (;;)

View File

@ -152,7 +152,7 @@
#define Assert(cond) ((cond) ? 1 : (__builtin_trap(), 0)) #define Assert(cond) ((cond) ? 1 : (__builtin_trap(), 0))
#define DEBUGBREAK __builtin_debugtrap() #define DEBUGBREAK __builtin_debugtrap()
#endif #endif
#define DEBUGBREAKABLE { volatile i32 __DEBUGBREAKABLE_VAR = 0; LAX __DEBUGBREAKABLE_VAR; } (void)0 #define DEBUGBREAKABLE { volatile i32 __DEBUGBREAKABLE_VAR = 0; __DEBUGBREAKABLE_VAR; } (void)0
#else #else
#define Assert(cond) (void)(0) #define Assert(cond) (void)(0)
#endif #endif
@ -225,17 +225,6 @@
#error Memory barriers not implemented #error Memory barriers not implemented
#endif #endif
//- Unused markup
/* Strict unused markup */
#if IsCompilerClang
#define UNUSED __attribute((unused))
#else
#define UNUSED
#endif
/* Relaxed unused markup */
#define LAX (void)
//- Fallthrough //- Fallthrough
#if IsCompilerClang #if IsCompilerClang
#define FALLTHROUGH __attribute((fallthrough)) #define FALLTHROUGH __attribute((fallthrough))

View File

@ -75,7 +75,6 @@ void ShrinkArena(Arena *arena)
{ {
/* Not implemented */ /* Not implemented */
Assert(0); Assert(0);
LAX arena;
} }
void SetArenaReadonly(Arena *arena) void SetArenaReadonly(Arena *arena)

View File

@ -56,8 +56,8 @@ void Unlock(Lock *lock);
# define AssertLockedE(l, m) Assert((l)->mutex == (m) && (l)->exclusive == 1) # define AssertLockedE(l, m) Assert((l)->mutex == (m) && (l)->exclusive == 1)
# define AssertLockedES(l, m) Assert((l)->mutex == (m)) # define AssertLockedES(l, m) Assert((l)->mutex == (m))
#else #else
# define AssertLockedE(l, m) LAX l # define AssertLockedE(l, m)
# define AssertLockedES(l, m) LAX l # define AssertLockedES(l, m)
#endif #endif
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -199,7 +199,7 @@ void ExitNow(i32 code)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Startup / shutdown jobs //~ Startup / shutdown jobs
JobImpl(W32_StartupLayers, UNUSED sig, UNUSED id) JobImpl(W32_StartupLayers, sig, id)
{ {
W32_SharedState *g = &W32_shared_state; W32_SharedState *g = &W32_shared_state;
TempArena scratch = BeginScratchNoConflict(); TempArena scratch = BeginScratchNoConflict();
@ -210,7 +210,7 @@ JobImpl(W32_StartupLayers, UNUSED sig, UNUSED id)
EndScratch(scratch); EndScratch(scratch);
} }
JobImpl(W32_ShutdownLayers, UNUSED sig, UNUSED id) JobImpl(W32_ShutdownLayers, sig, id)
{ {
__prof; __prof;
W32_SharedState *g = &W32_shared_state; W32_SharedState *g = &W32_shared_state;
@ -291,7 +291,6 @@ i32 W32_Main(void)
} }
} }
Assert(ok); Assert(ok);
LAX ok;
} }
} }
CloseHandle(thread); CloseHandle(thread);
@ -438,12 +437,12 @@ i32 W32_Main(void)
#if IsCrtlibEnabled #if IsCrtlibEnabled
# if IsConsoleApp # if IsConsoleApp
int main(UNUSED char **argc, UNUSED int argv) int main(char **argc, int argv)
{ {
return W32_Main(); return W32_Main();
} }
# else # else
int CALLBACK wWinMain(UNUSED _In_ HINSTANCE instance, UNUSED _In_opt_ HINSTANCE prev_instance, UNUSED _In_ LPWSTR cmdline_wstr, UNUSED _In_ int show_code) int CALLBACK wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev_instance, _In_ LPWSTR cmdline_wstr, _In_ int show_code)
{ {
return W32_Main(); return W32_Main();
} }

View File

@ -114,7 +114,6 @@ void D_DrawLineGradient(GPU_RenderSig *sig, Vec2 start, Vec2 end, f32 thickness,
D_DrawMaterial(sig, D_MATERIALPARAMS(.texture = g->solid_white_texture, .tint0 = start_color, .tint1 = end_color, .quad = quad)); D_DrawMaterial(sig, D_MATERIALPARAMS(.texture = g->solid_white_texture, .tint0 = start_color, .tint1 = end_color, .quad = quad));
#else #else
/* Placeholder */ /* Placeholder */
LAX end_color;
Quad quad = QuadFromLine(start, end, thickness); Quad quad = QuadFromLine(start, end, thickness);
D_DrawQuad(sig, quad, start_color); D_DrawQuad(sig, quad, start_color);
#endif #endif

View File

@ -56,7 +56,6 @@ MIX_Track *MIX_AcquireTrackLocked(Lock *lock, SND_Sound *sound)
{ {
MIX_SharedState *g = &M_shared_state; MIX_SharedState *g = &M_shared_state;
AssertLockedE(lock, &g->mutex); AssertLockedE(lock, &g->mutex);
LAX lock;
MIX_Track *track = 0; MIX_Track *track = 0;
if (g->track_first_free) if (g->track_first_free)
@ -103,7 +102,6 @@ void MIX_ReleaseTrackLocked(Lock *lock, MIX_Track *track)
{ {
MIX_SharedState *g = &M_shared_state; MIX_SharedState *g = &M_shared_state;
AssertLockedE(lock, &g->mutex); AssertLockedE(lock, &g->mutex);
LAX lock;
/* Remove from playing list */ /* Remove from playing list */
MIX_Track *prev = track->prev; MIX_Track *prev = track->prev;

View File

@ -432,7 +432,7 @@ String P_ReadFile(Arena *arena, P_File file)
/* TODO: error checking */ /* TODO: error checking */
PushAlign(arena, CachelineSize); PushAlign(arena, CachelineSize);
s.text = PushStructsNoZero(arena, u8, size); s.text = PushStructsNoZero(arena, u8, size);
LAX ReadFile( ReadFile(
(HANDLE)file.handle, (HANDLE)file.handle,
s.text, s.text,
(DWORD)s.len, (DWORD)s.len,
@ -459,7 +459,7 @@ void P_WriteFile(P_File file, String data)
} }
/* WriteFile returns TRUE on success */ /* WriteFile returns TRUE on success */
LAX WriteFile( WriteFile(
(HANDLE)file.handle, (HANDLE)file.handle,
data.text, data.text,
(DWORD)data.len, (DWORD)data.len,
@ -889,7 +889,6 @@ void P_WriteSock(P_Sock *sock, P_Address address, String data)
if (size != (i32)data.len) if (size != (i32)data.len)
{ {
i32 err = WSAGetLastError(); i32 err = WSAGetLastError();
LAX err;
Assert(0); Assert(0);
} }
#endif #endif

View File

@ -182,7 +182,7 @@ void PB_WSP_EndUpdate(PB_WSP_Buff *wspbuf, MIX_PcmF32 src)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Playback job //~ Playback job
JobImpl(PB_WSP_Playback, UNUSED sig, UNUSED id) JobImpl(PB_WSP_Playback, sig, id)
{ {
__prof; __prof;
PB_WSP_SharedState *g = &PB_WSP_shared_state; PB_WSP_SharedState *g = &PB_WSP_shared_state;

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Load job //~ Load job
JobImpl(SND_Load, sig, UNUSED id) JobImpl(SND_Load, sig, id)
{ {
__prof; __prof;
TempArena scratch = BeginScratchNoConflict(); TempArena scratch = BeginScratchNoConflict();

View File

@ -49,7 +49,6 @@ TTF_Decoded TTF_Decode(Arena *arena, String encoded, f32 em_size, u32 *cache_cod
/* TODO: handle errors */ /* TODO: handle errors */
HRESULT error = 0; HRESULT error = 0;
LAX error;
/* File */ /* File */
IDWriteFontFile *font_file = 0; IDWriteFontFile *font_file = 0;