mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 02:11:19 +00:00
more gccisms in the error reporting (In function ...)
This commit is contained in:
parent
58d0f188f1
commit
63414ea836
2 changed files with 24 additions and 0 deletions
|
@ -3026,12 +3026,33 @@ sizeof_expr (expr_t *expr, struct type_s *type)
|
|||
return expr;
|
||||
}
|
||||
|
||||
static void
|
||||
report_function (expr_t *e)
|
||||
{
|
||||
static function_t *last_func = (function_t *)-1L;
|
||||
string_t file = pr.source_file;
|
||||
|
||||
if (e)
|
||||
file = e->file;
|
||||
|
||||
if (current_func != last_func) {
|
||||
if (current_func) {
|
||||
fprintf (stderr, "%s: In function `%s':\n", G_GETSTR (file),
|
||||
current_func->def->name);
|
||||
} else {
|
||||
fprintf (stderr, "%s: At top level:\n", G_GETSTR (file));
|
||||
}
|
||||
}
|
||||
last_func = current_func;
|
||||
}
|
||||
|
||||
static void
|
||||
_warning (expr_t *e, const char *fmt, va_list args)
|
||||
{
|
||||
string_t file = pr.source_file;
|
||||
int line = pr.source_line;
|
||||
|
||||
report_function (e);
|
||||
if (options.warnings.promote) {
|
||||
options.warnings.promote = 0; // only want to do this once
|
||||
fprintf (stderr, "%s: warnings treated as errors\n", "qfcc");
|
||||
|
@ -3062,6 +3083,7 @@ notice (expr_t *e, const char *fmt, ...)
|
|||
string_t file = pr.source_file;
|
||||
int line = pr.source_line;
|
||||
|
||||
report_function (e);
|
||||
if (e) {
|
||||
file = e->file;
|
||||
line = e->line;
|
||||
|
@ -3090,6 +3112,7 @@ error (expr_t *e, const char *fmt, ...)
|
|||
string_t file = pr.source_file;
|
||||
int line = pr.source_line;
|
||||
|
||||
report_function (e);
|
||||
va_start (args, fmt);
|
||||
if (e) {
|
||||
file = e->file;
|
||||
|
|
|
@ -561,6 +561,7 @@ end_function
|
|||
: /*empty*/
|
||||
{
|
||||
current_scope = current_scope->parent;
|
||||
current_func = 0;
|
||||
}
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in a new issue