mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 12:52:46 +00:00
produce a warning if both @self and self are used in the same progs
This commit is contained in:
parent
5a58c58e7a
commit
b928f94440
1 changed files with 25 additions and 0 deletions
|
@ -161,6 +161,25 @@ def_error (qfo_def_t *def, const char *fmt, ...)
|
|||
error (0, "%s", string->str);
|
||||
}
|
||||
|
||||
static void __attribute__ ((format (printf, 2, 3)))
|
||||
def_warning (qfo_def_t *def, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
static dstring_t *string;
|
||||
|
||||
if (!string)
|
||||
string = dstring_new ();
|
||||
|
||||
va_start (args, fmt);
|
||||
dvsprintf (string, fmt, args);
|
||||
va_end (args);
|
||||
|
||||
pr.source_file = def->file;
|
||||
pr.source_line = def->line;
|
||||
pr.strings = strings;
|
||||
warning (0, "%s", string->str);
|
||||
}
|
||||
|
||||
static defref_t *
|
||||
get_defref (qfo_def_t *def, defgroup_t *defgroup)
|
||||
{
|
||||
|
@ -778,6 +797,12 @@ linker_finish (void)
|
|||
const char *name = STRING (def->name);
|
||||
|
||||
if (strcmp (name, ".self") == 0 && !did_self) {
|
||||
defref_t *_d = Hash_Find (defined_defs, "self");
|
||||
if (_d) {
|
||||
qfo_def_t *d = deref_def (_d, &global_defs);
|
||||
if (d->basic_type == ev_entity)
|
||||
def_warning (d, "@self and self used together");
|
||||
}
|
||||
define_def (".self", ev_entity, "E", 0);
|
||||
did_self = 1;
|
||||
} else if (strcmp (name, ".this") == 0 && !did_this) {
|
||||
|
|
Loading…
Reference in a new issue