chiark / gitweb /
@@@ more mess
[mLib] / test / tvec-core.c
index 4c2ac5d3dcacaaf5d3655c0ce6cff667e43be725..6b54f0a9dd1e38eaac83dde0c0bb2ba529090fda 100644 (file)
@@ -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. */