X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/4b4bc64da0af7b5d69a65dab06bff6483e67e385..d04c0e00da3a27693bbf9cc4f2d5c88e56d80f20:/test/tvec-core.c diff --git a/test/tvec-core.c b/test/tvec-core.c index 4c2ac5d..6b54f0a 100644 --- a/test/tvec-core.c +++ b/test/tvec-core.c @@ -390,15 +390,17 @@ int tvec_syntax_v(struct tvec_state *tv, int ch, dstr_destroy(&d); return (-1); } -/* --- @tvec_unkregerr@ --- * +/* --- @tvec_unkregerr@, @tvec_dupregerr@, @tvec_synthregerr@ --- * * * Arguments: @struct tvec_state *tv@ = test-vector state * @const char *name@ = register or pseudoregister name * * Returns: %$-1$%. * - * Use: Reports an error that the register or pseudoregister is - * unrecognized. + * Use: Reports an error about a misused register: @tvec_unkregerr@ + * reports that the register is unknown, @tvec_dupregerr@ that + * it is already assigned, and @tvec_synthregerr@ that it is + * synthetic. */ int tvec_unkregerr(struct tvec_state *tv, const char *name) @@ -407,19 +409,18 @@ int tvec_unkregerr(struct tvec_state *tv, const char *name) name, tv->test->name)); } -/* --- @tvec_dupregerr@ --- * - * - * Arguments: @struct tvec_state *tv@ = test-vector state - * @const char *name@ = register or pseudoregister name - * - * Returns: %$-1$%. - * - * Use: Reports an error that the register or pseudoregister has been - * assigned already in the current test. - */ - int tvec_dupregerr(struct tvec_state *tv, const char *name) - { return (tvec_error(tv, "register `%s' is already set", name)); } +{ + return (tvec_error(tv, "register `%s' is already set in test `%s'", + name, tv->test->name)); +} + +int tvec_synthregerr(struct tvec_state *tv, const char *name) +{ + return (tvec_error(tv, "register `%s' is synthetic in test `%s' " + "and cannot be assigned", + name, tv->test->name)); +} /* --- @tvec_skipspc@ --- * * @@ -960,7 +961,7 @@ static void check(struct tvec_state *tv, struct groupstate *g) if (r->f&TVRF_LIVE) { if (rd->i < tv->cfg.nrout) TVEC_REG(tv, out, rd->i)->f |= TVRF_LIVE; - } else if (!(r->f&TVRF_SEEN) && !(rd->f&TVRF_OPT)) { + } else if (!(r->f&TVRF_SEEN) && !(rd->f&(TVRF_OPT | TVRF_SYNTH))) { tvec_error(tv, "required register `%s' not set in test `%s'", rd->name, t->name); f |= f_err; @@ -1297,6 +1298,8 @@ int tvec_read(struct tvec_state *tv, const char *infile, FILE *fp) r = TVEC_REG(tv, in, rd->i); if (r->f&TVRF_SEEN) { tvec_dupregerr(tv, rd->name); goto flush_line; } + else if (r->f&TVRF_SYNTH) + { tvec_synthregerr(tv, rd->name); goto flush_line; } } /* Now there should be a separator. */