mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Get __PRETTY_FUNCTION__ working for overloaded functions.
This commit is contained in:
parent
0c9522b1ca
commit
c4d19e6ebc
2 changed files with 37 additions and 1 deletions
|
@ -430,8 +430,17 @@ new_function (def_t *func, const char *nice_name)
|
|||
f->s_name = ReuseString (func->name);
|
||||
f->s_file = pr.source_file;
|
||||
f->def = func;
|
||||
if (!(f->name = nice_name))
|
||||
if (!(f->name = nice_name)) {
|
||||
const char *s;
|
||||
f->name = f->def->name;
|
||||
if ((s = strchr (f->name, '|'))) {
|
||||
int l = (intptr_t) (s - f->name);
|
||||
dstring_t *str = dstring_newstr ();
|
||||
print_type_str (str, f->def->type);
|
||||
f->name = save_string (va ("%s %.*s", str->str, l, f->name));
|
||||
dstring_delete (str);
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
|
|
27
tools/qfcc/test/file-line.r
Normal file
27
tools/qfcc/test/file-line.r
Normal file
|
@ -0,0 +1,27 @@
|
|||
void printf (string fmt, ...) = #0;
|
||||
|
||||
@overload void test (integer x)
|
||||
{
|
||||
printf ("\"%s\" %s %d %s\n",
|
||||
__PRETTY_FUNCTION__, __FUNCTION__, __LINE__, __FILE__);
|
||||
}
|
||||
|
||||
@overload void test (void)
|
||||
{
|
||||
printf ("\"%s\" %s %d %s\n",
|
||||
__PRETTY_FUNCTION__, __FUNCTION__, __LINE__, __FILE__);
|
||||
}
|
||||
|
||||
void foo (void)
|
||||
{
|
||||
printf ("\"%s\" %s %d %s\n",
|
||||
__PRETTY_FUNCTION__, __FUNCTION__, __LINE__, __FILE__);
|
||||
}
|
||||
|
||||
integer main ()
|
||||
{
|
||||
test (1);
|
||||
test ();
|
||||
foo ();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue