mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-20 18:52:28 +00:00
[qfcc] Add a function to print the source line
It's not used anywhere, but it saves me a lot of grief when debugging.
This commit is contained in:
parent
35f4f2e692
commit
02432311c5
2 changed files with 17 additions and 0 deletions
|
@ -71,6 +71,8 @@ void _bug (struct expr_s *e, const char *file, int line, const char *fmt, ...)
|
|||
__attribute__ ((format (PRINTF, 4, 5)));
|
||||
#define bug(e, fmt...) _bug(e, __FILE__, __LINE__, fmt)
|
||||
|
||||
void print_srcline (int rep, const struct expr_s *e);
|
||||
|
||||
///@}
|
||||
|
||||
#endif//__diagnostic_h
|
||||
|
|
|
@ -77,6 +77,21 @@ report_function (const expr_t *e)
|
|||
last_func = current_func;
|
||||
}
|
||||
|
||||
void
|
||||
print_srcline (int rep, const expr_t *e)
|
||||
{
|
||||
pr_string_t file = pr.source_file;
|
||||
int line = pr.source_line;
|
||||
if (e) {
|
||||
file = e->file;
|
||||
line = e->line;
|
||||
}
|
||||
if (rep) {
|
||||
report_function (e);
|
||||
}
|
||||
printf ("%s:%d\n", GETSTR (file), line);
|
||||
}
|
||||
|
||||
static __attribute__((format(PRINTF, 4, 0))) void
|
||||
format_message (dstring_t *message, const char *msg_type, const expr_t *e,
|
||||
const char *fmt, va_list args)
|
||||
|
|
Loading…
Reference in a new issue