mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 06:48:47 +02:00
Track filename and line number where variables are defined.
This commit is contained in:
@@ -107,6 +107,8 @@ typedef struct var {
|
||||
char preserve;
|
||||
char is_constant;
|
||||
char used_since_set;
|
||||
char const *filename;
|
||||
int lineno;
|
||||
Value v;
|
||||
} Var;
|
||||
|
||||
|
||||
@@ -601,6 +601,8 @@ int SetVar(char const *str, Value const *val, int nonconst_expr)
|
||||
v->v = *val;
|
||||
v->is_constant = ! nonconst_expr;
|
||||
v->used_since_set = 0;
|
||||
v->filename = GetCurrentFilename();
|
||||
v->lineno = LineNo;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -843,7 +845,7 @@ void DumpUnusedVars(void)
|
||||
fprintf(ErrFp, "%s\n", tr("The following variables were set, but not subsequently used:"));
|
||||
done_header = 1;
|
||||
}
|
||||
fprintf(ErrFp, "\t%s\n", v->name);
|
||||
fprintf(ErrFp, "\t%s - defined at %s:%d\n", v->name, v->filename, v->lineno);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38716,6 +38716,6 @@ utctolocal(2050-11-06@04:00) => 2050-11-06@00:00
|
||||
utctolocal(2050-11-06@07:00) => 2050-11-06@02:00
|
||||
No reminders.
|
||||
The following variables were set, but not subsequently used:
|
||||
b
|
||||
d
|
||||
b - defined at -stdin-:2
|
||||
d - defined at -stdin-:5
|
||||
No reminders.
|
||||
|
||||
Reference in New Issue
Block a user