starting to offload MD namespace for repo to gen_c11 .refactor script and gen_cpp17 to namespace macros

This commit is contained in:
ed
2025-02-01 17:47:14 -05:00
parent e30f65a86b
commit 94b8427b96
6 changed files with 329 additions and 152 deletions
+29
View File
@@ -30,6 +30,24 @@
#define local_persist static
#endif
#if MD_COMPILER_MSVC
# define thread_static __declspec(thread)
#elif MD_COMPILER_CLANG || MD_COMPILER_GCC
# define thread_static __thread
#endif
////////////////////////////////
//~ rjf: Branch Predictor Hints
#if defined(__clang__)
# define expect(expr, val) __builtin_expect((expr), (val))
#else
# define expect(expr, val) (expr)
#endif
#define likely(expr) expect(expr,1)
#define unlikely(expr) expect(expr,0)
#if MD_COMPILER_CPP
# ifndef ccast
# define ccast( type, value ) ( const_cast< type >( (value) ) )
@@ -106,6 +124,17 @@
# define MD_PARAM_DEFAULT
#endif
#if MD_COMPILER_C
#ifndef static_assert
#undef static_assert
#if MD_COMPILER_C && __STDC_VERSION__ >= 201112L
#define static_assert(condition, message) _Static_assert(condition, message)
#else
#define static_assert(condition, message) typedef char static_assertion_##__LINE__[(condition)?1:-1]
#endif
#endif
#endif
#if MD_DONT_USE_NAMESPACE || MD_COMPILER_C
# if MD_COMPILER_C
# define MD_NS