Skip to content

Commit

Permalink
fix(?) msvc, update documentation generator
Browse files Browse the repository at this point in the history
  • Loading branch information
randomdude999 committed Jan 27, 2024
1 parent 6d10943 commit cb65b37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/newbook/parse_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import string

warning_pattern = re.compile(r'WRN\((.*?)\),\s*"(.*)"\s*,?\s*(true|false)?\s*}')
error_pattern = re.compile(r'ERR\((.*?)\),\s*"(.*)"\s*}')
error_pattern = re.compile(r'ERR\((.*?),\s*"(.*)"\)\s*\\')
escaping = str.maketrans({x: '\\'+x for x in string.punctuation})

def escape(s):
Expand All @@ -14,7 +14,7 @@ def escape(s):
def get_errors():
yield "| Error name | Message |"
yield "| ---------- | ------- |"
with open("../../src/asar/errors.cpp") as f:
with open("../../src/asar/errors.h") as f:
for line in f:
if 'ERR(' in line and not line.startswith('#define'):
name, description = re.findall(error_pattern, line)[0]
Expand Down
6 changes: 4 additions & 2 deletions src/asar/errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,12 @@ struct errblock : public errline {};
struct errnull : public errblock {};

#ifdef __clang__
// let's see if this causes msvc to explode...
// okay so this ## thing isn't very nice of me, but it works on all compilers
// for now. i'll refactor all use sites of asar_throw_error at some point so i
// can do a different hack to always pass at least 1 variadic argument
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
[[gnu::format(printf, 4, 5)]]
void asar_throw_error_impl(int whichpass, asar_error_type type, asar_error_id errid, const char* fmt, ...);
#define asar_throw_error(whichpass, type, errid, ...) asar_throw_error_impl(whichpass, type, errid, get_error_fmt(errid) __VA_OPT__(,) __VA_ARGS__)
#define asar_throw_error(whichpass, type, errid, ...) asar_throw_error_impl(whichpass, type, errid, get_error_fmt(errid), ## __VA_ARGS__)
const char* get_error_name(asar_error_id errid);

0 comments on commit cb65b37

Please sign in to comment.