forgot about stb_sprintf.h...

This commit is contained in:
ed
2025-02-08 23:53:35 -05:00
parent 50c7853b9f
commit d82af845bc
14 changed files with 67 additions and 49 deletions
+3 -5
View File
@@ -134,11 +134,9 @@ if ($code_sanity)
$linker_args = @() $linker_args = @()
$linker_args += $flag_link_win_subsystem_console $linker_args += $flag_link_win_subsystem_console
$path_base = join-path $path_code base $includes = @( $path_code, $path_root )
$unit = join-path $path_tests 'code_sanity.c'
$includes = @( $path_base ) $executable = join-path $path_build 'code_sanity.exe'
$unit = join-path $path_code 'metadesk.c'
$executable = join-path $path_build 'metadesk.lib'
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable $result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
} }
+10 -2
View File
@@ -9,8 +9,16 @@
# define BUILD_DEBUG 1 # define BUILD_DEBUG 1
#endif #endif
#if ! defined(BUILD_SUPPLEMENTARY_UNIT) #if ! defined(BUILD_STATIC)
# define BUILD_SUPPLEMENTARY_UNIT 0 # define BUILD_STATIC 0
#endif
#if ! defined(BUILD_DYANMIC)
# define BUILD_DYANMIC 0
#endif
#if ! defined(BUILD_API_EXPORT)
# define BUILD_API_EXPORT 0
#endif #endif
#if !defined(BUILD_ENTRY_DEFINING_UNIT) #if !defined(BUILD_ENTRY_DEFINING_UNIT)
+4 -4
View File
@@ -5,8 +5,8 @@
#ifndef MD_API #ifndef MD_API
#if COMPILER_MSVC #if COMPILER_MSVC
# ifdef MD_DYN_LINK # if BUILD_DYANMIC
# ifdef MD_DYN_EXPORT # if BUILD_API_EXPORT
# define MD_API __declspec(dllexport) # define MD_API __declspec(dllexport)
# else # else
# define MD_API __declspec(dllimport) # define MD_API __declspec(dllimport)
@@ -15,7 +15,7 @@
# define MD_API // Empty for static builds # define MD_API // Empty for static builds
# endif # endif
#else #else
# ifdef MD_DYN_LINK # ifdef BUILD_DYANMIC
# define MD_API __attribute__((visibility("default"))) # define MD_API __attribute__((visibility("default")))
# else # else
# define MD_API // Empty for static builds # define MD_API // Empty for static builds
@@ -36,7 +36,7 @@
#endif #endif
#ifndef global // Global variables #ifndef global // Global variables
# if defined(MD_DYN_EXPORT) || defined(MD_STATIC_LINK) # if BUILD_API_EXPORT || BUILD_STATIC
# define global # define global
# else # else
# define global static # define global static
-2
View File
@@ -48,8 +48,6 @@ struct Log
//////////////////////////////// ////////////////////////////////
//~ rjf: Log Creation/Selection //~ rjf: Log Creation/Selection
Log* log_alloc(AllocatorInfo ainfo, U64 arena_block_size); Log* log_alloc(AllocatorInfo ainfo, U64 arena_block_size);
void log_release(Log* log); void log_release(Log* log);
MD_API void log_select (Log* log); MD_API void log_select (Log* log);
+3 -5
View File
@@ -6,13 +6,11 @@
# include "thread_context.h" # include "thread_context.h"
//////////////////////////////// ////////////////////////////////
//~ rjf: Third Party Includes //~ rjf: Third Party Includes
#if !BUILD_SUPPLEMENTARY_UNIT
# define STB_SPRINTF_IMPLEMENTATION # define STB_SPRINTF_IMPLEMENTATION
# define STB_SPRINTF_STATIC # if BUILD_STATIC
# #define STB_SPRINTF_STATIC
# endif
# include "third_party/stb/stb_sprintf.h" # include "third_party/stb/stb_sprintf.h"
// Note(Ed): We should inject when generating the library segmented or singleheader
#endif
#endif #endif
// Copyright (c) 2024 Epic Games Tools // Copyright (c) 2024 Epic Games Tools
-1
View File
@@ -15,7 +15,6 @@
//~ rjf: Third Party Includes //~ rjf: Third Party Includes
# define STB_SPRINTF_DECORATE(name) md_##name # define STB_SPRINTF_DECORATE(name) md_##name
# include "third_party/stb/stb_sprintf.h" # include "third_party/stb/stb_sprintf.h"
// Note(Ed): We should inject when generating the library segmented or singleheader
#endif #endif
// Copyright (c) 2024 Epic Games Tools // Copyright (c) 2024 Epic Games Tools
+3
View File
@@ -227,6 +227,9 @@ struct ParseResult
typedef struct Context Context; typedef struct Context Context;
struct Context struct Context
{ {
// Currently, this is only relevant if the user is utilizing this library via bindings
// or they are not utilizing metadesk's hosted `entry_point` runtime
// Note: Only used so far as the first fallback if the user did not preset the thread_context's arenas // Note: Only used so far as the first fallback if the user did not preset the thread_context's arenas
// Otherwise it will just reserve its own Arena backed by chained virutal address space // Otherwise it will just reserve its own Arena backed by chained virutal address space
AllocatorInfo backing[2]; AllocatorInfo backing[2];
+6
View File
@@ -5,6 +5,12 @@
#include "base/platform.c" #include "base/platform.c"
#define STB_SPRINTF_IMPLEMENTATION
#if BUILD_STATIC
# #define STB_SPRINTF_STATIC
#endif
#include "third_party/stb/stb_sprintf.h"
MD_NS_BEGIN MD_NS_BEGIN
#include "base/debug.c" #include "base/debug.c"
+3
View File
@@ -10,6 +10,9 @@
#include "base/profiling.h" #include "base/profiling.h"
#include "base/namespace.h" #include "base/namespace.h"
#define STB_SPRINTF_DECORATE(name) md_##name
#include "third_party/stb/stb_sprintf.h"
MD_NS_BEGIN MD_NS_BEGIN
#include "base/base_types.h" #include "base/base_types.h"
+4 -4
View File
@@ -1267,19 +1267,19 @@ win32_exception_filter(EXCEPTION_POINTERS* exception_ptrs)
const U32 max_frames = 32; const U32 max_frames = 32;
if(idx == max_frames) if(idx == max_frames)
{ {
buflen += wnsprintfW(buffer + buflen, ArrayCount(buffer) - buflen, L"..."); buflen += wnsprintfW(buffer + buflen, ArrayCount(buffer) - buflen, L"...");
break; break;
} }
if(!dbg_StackWalk64(image_type, process, thread, &frame, context, 0, dbg_SymFunctionTableAccess64, dbg_SymGetModuleBase64, 0)) if(!dbg_StackWalk64(image_type, process, thread, &frame, context, 0, dbg_SymFunctionTableAccess64, dbg_SymGetModuleBase64, 0))
{ {
break; break;
} }
U64 address = frame.AddrPC.Offset; U64 address = frame.AddrPC.Offset;
if(address == 0) if(address == 0)
{ {
break; break;
} }
if(idx==0) if(idx==0)
View File
+5
View File
@@ -4,5 +4,10 @@
int main() int main()
{ {
Context ctx;
init(& ctx);
deinit(& ctx);
} }
+26 -26
View File
@@ -151,25 +151,25 @@ PERFORMANCE vs MSVC 2008 32-/64-bit (GCC is even slower than MSVC):
*/ */
#if defined(__clang__) #if defined(__clang__)
# if defined(__has_feature) && defined(__has_attribute) # if defined(__has_feature) && defined(__has_attribute)
# if __has_feature(address_sanitizer) # if __has_feature(address_sanitizer)
# if __has_attribute(__no_sanitize__) # if __has_attribute(__no_sanitize__)
# define STBSP__ASAN __attribute__((__no_sanitize__("address"))) # define STBSP__ASAN __attribute__((__no_sanitize__("address")))
# elif __has_attribute(__no_sanitize_address__) # elif __has_attribute(__no_sanitize_address__)
# define STBSP__ASAN __attribute__((__no_sanitize_address__)) # define STBSP__ASAN __attribute__((__no_sanitize_address__))
# elif __has_attribute(__no_address_safety_analysis__) # elif __has_attribute(__no_address_safety_analysis__)
# define STBSP__ASAN __attribute__((__no_address_safety_analysis__)) # define STBSP__ASAN __attribute__((__no_address_safety_analysis__))
# endif # endif
# endif # endif
# endif # endif
#elif defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) #elif defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
# if defined(__SANITIZE_ADDRESS__) && __SANITIZE_ADDRESS__ # if defined(__SANITIZE_ADDRESS__) && __SANITIZE_ADDRESS__
# define STBSP__ASAN __attribute__((__no_sanitize_address__)) # define STBSP__ASAN __attribute__((__no_sanitize_address__))
# endif # endif
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
# if defined(__SANITIZE_ADDRESS__) # if defined(__SANITIZE_ADDRESS__)
# define STBSP__ASAN __declspec(no_sanitize_address) # define STBSP__ASAN __declspec(no_sanitize_address)
# endif # endif
#endif #endif
#ifndef STBSP__ASAN #ifndef STBSP__ASAN
@@ -177,16 +177,16 @@ PERFORMANCE vs MSVC 2008 32-/64-bit (GCC is even slower than MSVC):
#endif #endif
#ifdef STB_SPRINTF_STATIC #ifdef STB_SPRINTF_STATIC
#define STBSP__PUBLICDEC static STBSP__ASAN # define STBSP__PUBLICDEC static STBSP__ASAN
#define STBSP__PUBLICDEF static STBSP__ASAN # define STBSP__PUBLICDEF static STBSP__ASAN
#else #else
#ifdef __cplusplus # ifdef __cplusplus
#define STBSP__PUBLICDEC extern "C" STBSP__ASAN # define STBSP__PUBLICDEC extern "C" STBSP__ASAN
#define STBSP__PUBLICDEF extern "C" STBSP__ASAN # define STBSP__PUBLICDEF extern "C" STBSP__ASAN
#else # else
#define STBSP__PUBLICDEC extern STBSP__ASAN # define STBSP__PUBLICDEC extern STBSP__ASAN
#define STBSP__PUBLICDEF STBSP__ASAN # define STBSP__PUBLICDEF STBSP__ASAN
#endif # endif
#endif #endif
#if defined(__has_attribute) #if defined(__has_attribute)