mirror of
https://github.com/Ed94/metadesk.git
synced 2026-07-30 11:20:06 +00:00
fix build errors; remove dumb non-working printf annotations; move C++ user-defined-literal thing into the header
This commit is contained in:
+26
-38
@@ -3,23 +3,20 @@
|
||||
|
||||
// TODO List
|
||||
//
|
||||
// [ ] Freeing calls, allow hooking the allocator with an arena or
|
||||
// something so that someone can use this for work at an application/game's
|
||||
// runtime
|
||||
// [ ] Outputting anything to MD or C code ideally would do something
|
||||
// smart with auto-indentation, since some people have wanted readable
|
||||
// layout (if they aren't using 4coder with virtual whitespace basically)
|
||||
// [ ] Split out C-related stuff into helper language layers
|
||||
// [ ] Helpers for parsing NodeFlags, figuring out which nodes in a set are
|
||||
// separated by a semicolon, something like MD_SeekNodeWithFlags(node) -> node ?
|
||||
// [ ] Escaping characters from strings
|
||||
// [ ] Fill in more String -> Integer helpers
|
||||
// [ ] Memory Management Strategy
|
||||
// [ ] Gather map of current memory management situation
|
||||
// [ ] Reset all memory operation?
|
||||
// [ ] Thread context?
|
||||
// [ ] Scratch memory?
|
||||
// [ ] Reference Manual
|
||||
// [ ] unify string literal token kinds
|
||||
// [ ] simplify string literal flags (triple as a single flag)
|
||||
// [ ] lexer detects broken comments
|
||||
// [ ] lexer detects broken strings
|
||||
// [ ] tests for legal tag syntaxes
|
||||
// [ ] tests that ensure we don't accept labels when expecting symbols e.g. foo ":" b; foo: "(" )
|
||||
// [ ] pass all tests
|
||||
// [ ] simplify error sorting and catastrophic error handling
|
||||
// [ ] integer -> string helpers
|
||||
// [ ] remove symbol digraphs (maybe a test for this or something) and remove from comments
|
||||
// [ ] stb_snprintf included and modified for %S ~ MD_String8
|
||||
// [ ] naming pass
|
||||
// [ ] get the branches/labels setup on Git for beta 0.1 and dev
|
||||
// [ ] announcement
|
||||
|
||||
// NOTE(allen): "Plugin" functionality
|
||||
//
|
||||
@@ -195,24 +192,6 @@
|
||||
# define MD_C_LINKAGE_END }
|
||||
#endif
|
||||
|
||||
#if MD_COMPILER_CL_YEAR >= 2005
|
||||
# include <sal.h>
|
||||
# if MD_COMPILER_CL_YEAR > 2005
|
||||
# define MD_FORMAT_STRING_ANNOTATION _Printf_format_string_
|
||||
# else
|
||||
# define MD_FORMAT_STRING_ANNOTATION __format_string
|
||||
# endif
|
||||
#else
|
||||
# define MD_FORMAT_STRING_ANNOTATION
|
||||
#endif
|
||||
|
||||
#if MD_COMPILER_CLANG || MD_COMPILER_GCC
|
||||
#define MD_FORMAT_FUNCTION_ANNOTATION(str_idx, check_idx) \
|
||||
__attribute__((format(printf, str_idx, check_idx)))
|
||||
#else
|
||||
#define MD_FORMAT_FUNCTION_ANNOTATION(str_idx, check_idx)
|
||||
#endif
|
||||
|
||||
//~ Common defines
|
||||
|
||||
#define MD_FUNCTION
|
||||
@@ -666,6 +645,15 @@ MD_FUNCTION MD_String8 MD_S8(MD_u8 *str, MD_u64 size);
|
||||
# define MD_S8Lit(s) MD_S8((MD_u8*)(s), sizeof(s) - 1)
|
||||
#endif
|
||||
|
||||
#if MD_LANG_CPP
|
||||
static inline MD_String8
|
||||
operator "" _md(const char *s, size_t size)
|
||||
{
|
||||
MD_String8 str = MD_S8((MD_u8 *)s, (MD_u64)size);
|
||||
return str;
|
||||
}
|
||||
#endif
|
||||
|
||||
MD_FUNCTION MD_String8 MD_S8Range(MD_u8 *str, MD_u8 *opl);
|
||||
|
||||
MD_FUNCTION MD_String8 MD_StringSubstring(MD_String8 str, MD_u64 min, MD_u64 max);
|
||||
@@ -686,7 +674,7 @@ MD_FUNCTION MD_String8 MD_FolderFromPath(MD_String8 string);
|
||||
MD_FUNCTION MD_String8 MD_PushStringCopy(MD_String8 string);
|
||||
MD_FUNCTION MD_String8 MD_PushStringFV(char *fmt, va_list args);
|
||||
|
||||
MD_FUNCTION MD_String8 MD_PushStringF(MD_FORMAT_STRING_ANNOTATION char *fmt, ...) MD_FORMAT_FUNCTION_ANNOTATION(1, 2);
|
||||
MD_FUNCTION MD_String8 MD_PushStringF(char *fmt, ...);
|
||||
|
||||
#define MD_StringExpand(s) (int)(s).size, (s).str
|
||||
|
||||
@@ -796,9 +784,9 @@ it##_r = it##_r->next, it = MD_Deref(it##_r)
|
||||
//~ Error/Warning Helpers
|
||||
|
||||
MD_FUNCTION void MD_Message(FILE *out, MD_CodeLoc loc, MD_MessageKind kind, MD_String8 str);
|
||||
MD_FUNCTION void MD_MessageF(FILE *out, MD_CodeLoc loc, MD_MessageKind kind, MD_FORMAT_STRING_ANNOTATION char *fmt, ...) MD_FORMAT_FUNCTION_ANNOTATION(4, 5);
|
||||
MD_FUNCTION void MD_MessageF(FILE *out, MD_CodeLoc loc, MD_MessageKind kind, char *fmt, ...);
|
||||
MD_FUNCTION void MD_NodeMessage(FILE *out, MD_Node *node, MD_MessageKind kind, MD_String8 str);
|
||||
MD_FUNCTION void MD_NodeMessageF(FILE *out, MD_Node *node, MD_MessageKind kind, MD_FORMAT_STRING_ANNOTATION char *fmt, ...) MD_FORMAT_FUNCTION_ANNOTATION(4, 5);
|
||||
MD_FUNCTION void MD_NodeMessageF(FILE *out, MD_Node *node, MD_MessageKind kind, char *fmt, ...);
|
||||
|
||||
//~ Tree Comparison/Verification
|
||||
|
||||
|
||||
+2
-2
@@ -2295,7 +2295,7 @@ MD_Message(FILE *out, MD_CodeLoc loc, MD_MessageKind kind, MD_String8 str)
|
||||
}
|
||||
|
||||
MD_FUNCTION_IMPL void
|
||||
MD_MessageF(FILE *out, MD_CodeLoc loc, MD_MessageKind kind, MD_FORMAT_STRING_ANNOTATION char *fmt, ...) MD_FORMAT_FUNCTION_ANNOTATION(4, 5)
|
||||
MD_MessageF(FILE *out, MD_CodeLoc loc, MD_MessageKind kind, char *fmt, ...)
|
||||
{
|
||||
// TODO(allen): use scratch
|
||||
va_list args;
|
||||
@@ -2312,7 +2312,7 @@ MD_NodeMessage(FILE *out, MD_Node *node, MD_MessageKind kind, MD_String8 str)
|
||||
}
|
||||
|
||||
MD_FUNCTION_IMPL void
|
||||
MD_NodeMessageF(FILE *out, MD_Node *node, MD_MessageKind kind, MD_FORMAT_STRING_ANNOTATION char *fmt, ...) MD_FORMAT_FUNCTION_ANNOTATION(4, 5)
|
||||
MD_NodeMessageF(FILE *out, MD_Node *node, MD_MessageKind kind, char *fmt, ...)
|
||||
{
|
||||
// TODO(allen): use scratch
|
||||
va_list args;
|
||||
|
||||
Reference in New Issue
Block a user