From 02b31ab4416ffd629b288b595ccc50ffb1455eaf Mon Sep 17 00:00:00 2001 From: jacob Date: Thu, 11 Apr 2024 12:42:44 -0500 Subject: [PATCH] rename DEBUG_LVAR -> DEBUG_ALIAS --- src/app.c | 2 +- src/asset_cache.c | 2 +- src/common.h | 7 ++----- src/draw.c | 2 +- src/font.c | 4 ++-- src/game.c | 2 +- src/log.c | 2 +- src/mixer.c | 2 +- src/playback_wasapi.c | 2 +- src/renderer_d3d11.c | 2 +- src/resource.c | 2 +- src/sheet.c | 2 +- src/sound.c | 2 +- src/sys_win32.c | 2 +- src/texture.c | 2 +- src/thread_local.c | 2 +- src/ttf_dwrite.cpp | 4 ++-- src/user.c | 2 +- src/work.c | 2 +- 19 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/app.c b/src/app.c index 512cb80e..fe04f52c 100644 --- a/src/app.c +++ b/src/app.c @@ -25,7 +25,7 @@ GLOBAL struct { struct arena arena; struct string write_path; struct sync_flag quit_sf; -} L = { 0 }, DEBUG_LVAR(L_app); +} L = { 0 }, DEBUG_ALIAS(L, L_app); /* ========================== * * Write directory diff --git a/src/asset_cache.c b/src/asset_cache.c index a8907190..106b5983 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_ALIAS(L, L_asset_cache); /* ========================== * * Startup diff --git a/src/common.h b/src/common.h index 1249c62d..83046097 100644 --- a/src/common.h +++ b/src/common.h @@ -116,12 +116,9 @@ extern "C" { #define CT_ASSERT(cond) CT_ASSERT2(cond, __LINE__) #if DEBINFO -/* 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_ALIAS(var, alias) __attribute((used)) *(alias) = &(var); #else -# define DEBUG_LVAR(var) __attribute((unused)) *var = &L; +# define DEBUG_ALIAS(var, alias) __attribute((unused)) *(alias) = &(var); #endif #if RTC diff --git a/src/draw.c b/src/draw.c index 383c5ebc..78a08d5b 100644 --- a/src/draw.c +++ b/src/draw.c @@ -6,7 +6,7 @@ GLOBAL struct { struct renderer_handle solid_white; -} L = { 0 }, DEBUG_LVAR(L_draw); +} L = { 0 }, DEBUG_ALIAS(L, L_draw); /* ========================== * * Startup diff --git a/src/font.c b/src/font.c index a06c9287..eab6ddd6 100644 --- a/src/font.c +++ b/src/font.c @@ -46,7 +46,7 @@ struct font_task_params_store { GLOBAL struct { struct font_task_params_store params; -} L = { 0 }, DEBUG_LVAR(L_font); +} L = { 0 }, DEBUG_ALIAS(L, L_font); /* ========================== * * Startup @@ -306,7 +306,7 @@ struct font_task_params_store { GLOBAL struct { struct font_task_params_store params; -} L = { 0 }, DEBUG_LVAR(L_font); +} L = { 0 }, DEBUG_ALIAS(L, L_font); /* ========================== * * Startup diff --git a/src/game.c b/src/game.c index e0a0b0d6..c0bffd5e 100644 --- a/src/game.c +++ b/src/game.c @@ -23,7 +23,7 @@ GLOBAL struct { struct sys_mutex published_tick_mutex; struct world published_tick; struct atomic_u64 published_tick_id; -} L = { 0 }, DEBUG_LVAR(L_game); +} L = { 0 }, DEBUG_ALIAS(L, L_game); /* ========================== * * Game cmd diff --git a/src/log.c b/src/log.c index 9d60e698..f679d8c2 100644 --- a/src/log.c +++ b/src/log.c @@ -20,7 +20,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_ALIAS(L, L_log); GLOBAL READONLY 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 68d6e6b2..3a1dc1fa 100644 --- a/src/mixer.c +++ b/src/mixer.c @@ -64,7 +64,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_ALIAS(L, L_mixer); /* ========================== * * Startup diff --git a/src/playback_wasapi.c b/src/playback_wasapi.c index 90efb163..25ea0d9a 100644 --- a/src/playback_wasapi.c +++ b/src/playback_wasapi.c @@ -42,7 +42,7 @@ GLOBAL struct { WAVEFORMATEX *buffer_format; u32 buffer_frames; HANDLE mmtc_handle; -} L = { 0 }, DEBUG_LVAR(L_playback_wasapi); +} L = { 0 }, DEBUG_ALIAS(L, L_playback_wasapi); /* ========================== * * Initialize diff --git a/src/renderer_d3d11.c b/src/renderer_d3d11.c index 52de568e..bb8b6731 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_ALIAS(L, L_renderer_d3d11); /* ========================== * * Util diff --git a/src/resource.c b/src/resource.c index b94327cb..17b76039 100644 --- a/src/resource.c +++ b/src/resource.c @@ -12,7 +12,7 @@ GLOBAL struct { struct arena arena; struct tar_archive archive; -} L = { 0 }, DEBUG_LVAR(L_resource); +} L = { 0 }, DEBUG_ALIAS(L, L_resource); #endif struct resource_startup_receipt resource_startup(void) diff --git a/src/sheet.c b/src/sheet.c index 50d2a0b8..35e591ef 100644 --- a/src/sheet.c +++ b/src/sheet.c @@ -29,7 +29,7 @@ struct sheet_task_params_store { GLOBAL struct { struct sheet_task_params_store params; -} L = { 0 }, DEBUG_LVAR(L_sheet); +} L = { 0 }, DEBUG_ALIAS(L, L_sheet); /* ========================== * diff --git a/src/sound.c b/src/sound.c index 80a0eaa8..ac56710d 100644 --- a/src/sound.c +++ b/src/sound.c @@ -29,7 +29,7 @@ struct sound_task_params_store { GLOBAL struct { struct sound_task_params_store params; -} L = { 0 }, DEBUG_LVAR(L_sound); +} L = { 0 }, DEBUG_ALIAS(L, L_sound); /* ========================== * * Startup diff --git a/src/sys_win32.c b/src/sys_win32.c index 05813bf7..9709a025 100644 --- a/src/sys_win32.c +++ b/src/sys_win32.c @@ -116,7 +116,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_ALIAS(L, L_sys_win32); /* ========================== * * Events diff --git a/src/texture.c b/src/texture.c index 63f5ea2c..ce2fac00 100644 --- a/src/texture.c +++ b/src/texture.c @@ -32,7 +32,7 @@ struct texture_task_params_store { GLOBAL struct { struct texture_task_params_store params; -} L = { 0 }, DEBUG_LVAR(L_texture); +} L = { 0 }, DEBUG_ALIAS(L, L_texture); /* ========================== * * Startup diff --git a/src/thread_local.c b/src/thread_local.c index a9815142..ef36e166 100644 --- a/src/thread_local.c +++ b/src/thread_local.c @@ -13,7 +13,7 @@ GLOBAL struct { struct atomic_i64 metas_lock_flag; u64 metas_count; struct thread_local_var_meta metas[MAX_THREAD_LOCAL_VARS]; -} L = { 0 }, DEBUG_LVAR(L_thread_local); +} L = { 0 }, DEBUG_ALIAS(L, L_thread_local); INTERNAL void metas_lock(void) { diff --git a/src/ttf_dwrite.cpp b/src/ttf_dwrite.cpp index 365af505..7df0d2d3 100644 --- a/src/ttf_dwrite.cpp +++ b/src/ttf_dwrite.cpp @@ -31,7 +31,7 @@ extern "C" GLOBAL struct { /* FIXME: Do we need to wrap this in a mutex? */ IDWriteFactory5 *factory; -} L = { 0 }, DEBUG_LVAR(L_ttf_dwrite); +} L = { 0 }, DEBUG_ALIAS(L, L_ttf_dwrite); /* ========================== * * Decode font @@ -335,7 +335,7 @@ extern "C" GLOBAL struct { /* FIXME: Do we need to wrap this in a mutex? */ IDWriteFactory5 *factory; -} L = { 0 }, DEBUG_LVAR(L_ttf_dwrite); +} L = { 0 }, DEBUG_ALIAS(L, L_ttf_dwrite); /* ========================== * * Decode font diff --git a/src/user.c b/src/user.c index 6fec065d..ddaf3600 100644 --- a/src/user.c +++ b/src/user.c @@ -85,7 +85,7 @@ GLOBAL struct { struct v2 viewport_center; struct v2 viewport_cursor; struct v2 world_cursor; -} L = { 0 }, DEBUG_LVAR(L_user); +} L = { 0 }, DEBUG_ALIAS(L, L_user); /* ========================== * * Bind state diff --git a/src/work.c b/src/work.c index c6aaf5f2..33ff45df 100644 --- a/src/work.c +++ b/src/work.c @@ -86,7 +86,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_ALIAS(L, L_work); /* ========================== * * Thread local state