From 8f3aaba794e7e680ca8219198f203786ae434ec5 Mon Sep 17 00:00:00 2001 From: jacob Date: Fri, 8 Mar 2024 17:19:09 -0600 Subject: [PATCH] alter DEBUG_LVAR semantics --- src/app.c | 2 +- src/asset_cache.c | 2 +- src/common.h | 12 ++---------- src/draw.c | 2 +- src/font.c | 2 +- src/game.c | 2 +- src/log.c | 2 +- src/mixer.c | 2 +- src/playback_wasapi.c | 2 +- src/renderer_d3d11.c | 2 +- src/sheet.c | 2 +- src/sound.c | 2 +- src/sys_win32.c | 2 +- src/texture.c | 2 +- src/ttf_dwrite.cpp | 4 ++-- src/user.c | 2 +- src/work.c | 2 +- 17 files changed, 19 insertions(+), 27 deletions(-) diff --git a/src/app.c b/src/app.c index 2a076884..00d7e9c8 100644 --- a/src/app.c +++ b/src/app.c @@ -27,7 +27,7 @@ GLOBAL struct { struct arena arena; struct string write_path; struct sync_flag quit_sf; -} L = { 0 } DEBUG_LVAR(L_app); +} L = { 0 }, DEBUG_LVAR(L_app); /* ========================== * * Write directory diff --git a/src/asset_cache.c b/src/asset_cache.c index 9eeda81f..44fe093c 100644 --- a/src/asset_cache.c +++ b/src/asset_cache.c @@ -29,7 +29,7 @@ GLOBAL struct { u64 dbg_table_count; struct sys_mutex dbg_table_mutex; #endif -} L = { 0 } DEBUG_LVAR(L_asset_cache); +} L = { 0 }, DEBUG_LVAR(L_asset_cache); /* ========================== * * Startup diff --git a/src/common.h b/src/common.h index ca0f464a..99c22e42 100644 --- a/src/common.h +++ b/src/common.h @@ -114,9 +114,9 @@ extern "C" { /* For use after a static 'L' state variable is declared. This will create a * variable that points to the 'L' variable and is kept alive (so that the * debugger can reference the state with a variable other than 'L') */ -# define DEBUG_LVAR(var) ,__attribute((used)) *var = &L; +# define DEBUG_LVAR(var) __attribute((used)) *var = &L; #else -# define DEBUG_LVAR(var) +# define DEBUG_LVAR(var) __attribute((unused)) *var = &L; #endif #if RTC @@ -203,14 +203,6 @@ extern "C" { #define IS_ARRAY(a) (IS_INDEXABLE(a) && (((void *)&a) == ((void *)a))) /* Pack */ -#if 0 -#if COMPILER_MSVC -# define PACKED(declaration) __pragma(pack(push, 1)) declaration __pragma(pack(pop)) -#else -# define PACKED(declaration) declaration __attribute((__packed__)) -#endif -#endif - #define PACKED __attribute((__packed__)) /* Color */ diff --git a/src/draw.c b/src/draw.c index ccf16eb2..dbf8c17b 100644 --- a/src/draw.c +++ b/src/draw.c @@ -7,7 +7,7 @@ GLOBAL struct { struct renderer_handle solid_white; -} L = { 0 } DEBUG_LVAR(L_draw); +} L = { 0 }, DEBUG_LVAR(L_draw); /* ========================== * * Startup diff --git a/src/font.c b/src/font.c index 10d3fab8..62b9ebf7 100644 --- a/src/font.c +++ b/src/font.c @@ -32,7 +32,7 @@ struct font_task_params_store { GLOBAL struct { struct font_task_params_store params; -} L = { 0 } DEBUG_LVAR(L_font); +} L = { 0 }, DEBUG_LVAR(L_font); /* ========================== * * Startup diff --git a/src/game.c b/src/game.c index 2a45c667..c2333e01 100644 --- a/src/game.c +++ b/src/game.c @@ -27,7 +27,7 @@ GLOBAL struct { /* Game thread output */ struct sys_mutex published_tick_mutex; struct tick published_tick; -} L = { 0 } DEBUG_LVAR(L_game); +} L = { 0 }, DEBUG_LVAR(L_game); /* ========================== * * Entity allocation diff --git a/src/log.c b/src/log.c index e21df06f..212b94d3 100644 --- a/src/log.c +++ b/src/log.c @@ -19,7 +19,7 @@ GLOBAL struct { log_event_callback_func *callbacks_head; struct sys_file file; b32 file_valid; -} L = { 0 } DEBUG_LVAR(L_log); +} L = { 0 }, DEBUG_LVAR(L_log); GLOBAL const struct log_level_settings g_log_level_settings[LOG_LEVEL_COUNT] = { [LOG_LEVEL_CRITICAL] = { diff --git a/src/mixer.c b/src/mixer.c index 59940c92..89195956 100644 --- a/src/mixer.c +++ b/src/mixer.c @@ -66,7 +66,7 @@ GLOBAL struct { struct track *track_last_playing; u64 track_playing_count; struct track *track_first_free; -} L = { 0 } DEBUG_LVAR(L_mixer); +} L = { 0 }, DEBUG_LVAR(L_mixer); /* ========================== * * Startup diff --git a/src/playback_wasapi.c b/src/playback_wasapi.c index fbed5760..8b08e601 100644 --- a/src/playback_wasapi.c +++ b/src/playback_wasapi.c @@ -41,7 +41,7 @@ GLOBAL struct { WAVEFORMATEX *buffer_format; u32 buffer_frames; HANDLE mmtc_handle; -} L = { 0 } DEBUG_LVAR(L_playback_wasapi); +} L = { 0 }, DEBUG_LVAR(L_playback_wasapi); /* ========================== * * Initialize diff --git a/src/renderer_d3d11.c b/src/renderer_d3d11.c index 15f32b8a..b727a85a 100644 --- a/src/renderer_d3d11.c +++ b/src/renderer_d3d11.c @@ -143,7 +143,7 @@ GLOBAL struct { struct dx11_shader_desc shader_info[NUM_SHADERS]; -} L = { 0 } DEBUG_LVAR(L_renderer_d3d11); +} L = { 0 }, DEBUG_LVAR(L_renderer_d3d11); /* ========================== * * Util diff --git a/src/sheet.c b/src/sheet.c index 10824452..6fdfe64a 100644 --- a/src/sheet.c +++ b/src/sheet.c @@ -28,7 +28,7 @@ struct sheet_task_params_store { GLOBAL struct { struct sheet_task_params_store params; -} L = { 0 } DEBUG_LVAR(L_sheet); +} L = { 0 }, DEBUG_LVAR(L_sheet); /* ========================== * diff --git a/src/sound.c b/src/sound.c index 1f2acb37..f37994b0 100644 --- a/src/sound.c +++ b/src/sound.c @@ -28,7 +28,7 @@ struct sound_task_params_store { GLOBAL struct { struct sound_task_params_store params; -} L = { 0 } DEBUG_LVAR(L_sound); +} L = { 0 }, DEBUG_LVAR(L_sound); /* ========================== * * Startup diff --git a/src/sys_win32.c b/src/sys_win32.c index d2ce57a6..ae8d4a0c 100644 --- a/src/sys_win32.c +++ b/src/sys_win32.c @@ -87,7 +87,7 @@ GLOBAL struct { struct sys_mutex windows_mutex; struct arena windows_arena; struct win32_window *first_free_window; -} L = { 0 } DEBUG_LVAR(L_sys_win32); +} L = { 0 }, DEBUG_LVAR(L_sys_win32); /* ========================== * * Events diff --git a/src/texture.c b/src/texture.c index 14a34efc..a588e355 100644 --- a/src/texture.c +++ b/src/texture.c @@ -33,7 +33,7 @@ struct texture_task_params_store { GLOBAL struct { struct texture_task_params_store params; -} L = { 0 } DEBUG_LVAR(L_texture); +} L = { 0 }, DEBUG_LVAR(L_texture); /* ========================== * * Startup diff --git a/src/ttf_dwrite.cpp b/src/ttf_dwrite.cpp index bd3623ff..8d1b4d62 100644 --- a/src/ttf_dwrite.cpp +++ b/src/ttf_dwrite.cpp @@ -36,8 +36,8 @@ extern "C" GLOBAL struct { /* FIXME: Do we need to wrap this in a mutex? */ - IDWriteFactory5 *factory = NULL; -} L = {} DEBUG_LVAR(L_ttf_dwrite); + IDWriteFactory5 *factory; +} L = { 0 }, DEBUG_LVAR(L_ttf_dwrite); /* ========================== * * Decode font diff --git a/src/user.c b/src/user.c index 364d5946..1a6a0c55 100644 --- a/src/user.c +++ b/src/user.c @@ -55,7 +55,7 @@ GLOBAL struct { struct v2 screen_size; struct v2 screen_center; struct v2 screen_mouse; -} L = { 0 } DEBUG_LVAR(L_user); +} L = { 0 }, DEBUG_LVAR(L_user); /* ========================== * diff --git a/src/work.c b/src/work.c index 14cdcce5..c9cb5d4e 100644 --- a/src/work.c +++ b/src/work.c @@ -85,7 +85,7 @@ GLOBAL struct { /* Pointers to the last piece of work of each priority in the scheduled * work list (used for O(1) insertion) */ struct work *scheduled_work_priority_tails[NUM_WORK_PRIORITIES]; -} L = { 0 } DEBUG_LVAR(L_work); +} L = { 0 }, DEBUG_LVAR(L_work); INTERNAL void worker_thread_entry_point(void *thread_data);