]> git.cameronkatri.com Git - mandoc.git/blobdiff - mdoc_validate.c
clarify the difference between .Cm and .Ic;
[mandoc.git] / mdoc_validate.c
index d20b2a0779b8745370693eeee6e1384d5a1347fe..c409f90891cf4ca90d9351f893d6e18511e7efee 100644 (file)
@@ -1,7 +1,7 @@
-/*     $Id: mdoc_validate.c,v 1.368 2018/12/31 07:46:07 schwarze Exp $ */
+/*     $Id: mdoc_validate.c,v 1.373 2019/03/13 18:29:18 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2019 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -64,7 +64,7 @@ static        size_t          macro2len(enum roff_tok);
 static void     rewrite_macro2len(struct roff_man *, char **);
 static int      similar(const char *, const char *);
 
-static void     post_abort(POST_ARGS);
+static void     post_abort(POST_ARGS) __attribute__((__noreturn__));
 static void     post_an(POST_ARGS);
 static void     post_an_norm(POST_ARGS);
 static void     post_at(POST_ARGS);
@@ -336,9 +336,7 @@ mdoc_validate(struct roff_man *mdoc)
                if (n->sec != SEC_SYNOPSIS ||
                    (np->tok != MDOC_Cd && np->tok != MDOC_Fd))
                        check_text(mdoc, n->line, n->pos, n->string);
-               if (np->tok != MDOC_Ql && np->tok != MDOC_Dl &&
-                   (np->tok != MDOC_Bd ||
-                    (mdoc->flags & ROFF_NOFILL) == 0) &&
+               if ((n->flags & NODE_NOFILL) == 0 &&
                    (np->tok != MDOC_It || np->type != ROFFT_HEAD ||
                     np->parent->parent->norm->Bl.type != LIST_diag))
                        check_text_em(mdoc, n->line, n->pos, n->string);
@@ -411,7 +409,7 @@ check_text(struct roff_man *mdoc, int ln, int pos, char *p)
 {
        char            *cp;
 
-       if (mdoc->flags & ROFF_NOFILL)
+       if (mdoc->last->flags & NODE_NOFILL)
                return;
 
        for (cp = p; NULL != (p = strchr(p, '\t')); p++)
@@ -1583,7 +1581,7 @@ post_it(POST_ARGS)
                        mandoc_msg(MANDOCERR_BL_COL, nit->line, nit->pos,
                            "%d columns, %d cells", cols, i);
                else if (nit->head->next->child != NULL &&
-                   nit->head->next->child->line > nit->line)
+                   nit->head->next->child->flags & NODE_LINE)
                        mandoc_msg(MANDOCERR_IT_NOARG,
                            nit->line, nit->pos, "Bl -column It");
                break;
@@ -1900,29 +1898,7 @@ post_sm(POST_ARGS)
 static void
 post_root(POST_ARGS)
 {
-       const char *openbsd_arch[] = {
-               "alpha", "amd64", "arm64", "armv7", "hppa", "i386",
-               "landisk", "loongson", "luna88k", "macppc", "mips64",
-               "octeon", "sgi", "socppc", "sparc64", NULL
-       };
-       const char *netbsd_arch[] = {
-               "acorn26", "acorn32", "algor", "alpha", "amiga",
-               "arc", "atari",
-               "bebox", "cats", "cesfic", "cobalt", "dreamcast",
-               "emips", "evbarm", "evbmips", "evbppc", "evbsh3", "evbsh5",
-               "hp300", "hpcarm", "hpcmips", "hpcsh", "hppa",
-               "i386", "ibmnws", "luna68k",
-               "mac68k", "macppc", "mipsco", "mmeye", "mvme68k", "mvmeppc",
-               "netwinder", "news68k", "newsmips", "next68k",
-               "pc532", "playstation2", "pmax", "pmppc", "prep",
-               "sandpoint", "sbmips", "sgimips", "shark",
-               "sparc", "sparc64", "sun2", "sun3",
-               "vax", "walnut", "x68k", "x86", "x86_64", "xen", NULL
-        };
-       const char **arches[] = { NULL, netbsd_arch, openbsd_arch };
-
        struct roff_node *n;
-       const char **arch;
 
        /* Add missing prologue data. */
 
@@ -1948,22 +1924,18 @@ post_root(POST_ARGS)
                    "(OpenBSD)" : "(NetBSD)");
 
        if (mdoc->meta.arch != NULL &&
-           (arch = arches[mdoc->meta.os_e]) != NULL) {
-               while (*arch != NULL && strcmp(*arch, mdoc->meta.arch))
-                       arch++;
-               if (*arch == NULL) {
-                       n = mdoc->meta.first->child;
-                       while (n->tok != MDOC_Dt ||
-                           n->child == NULL ||
-                           n->child->next == NULL ||
-                           n->child->next->next == NULL)
-                               n = n->next;
-                       n = n->child->next->next;
-                       mandoc_msg(MANDOCERR_ARCH_BAD, n->line, n->pos,
-                           "Dt ... %s %s", mdoc->meta.arch,
-                           mdoc->meta.os_e == MANDOC_OS_OPENBSD ?
-                           "(OpenBSD)" : "(NetBSD)");
-               }
+           arch_valid(mdoc->meta.arch, mdoc->meta.os_e) == 0) {
+               n = mdoc->meta.first->child;
+               while (n->tok != MDOC_Dt ||
+                   n->child == NULL ||
+                   n->child->next == NULL ||
+                   n->child->next->next == NULL)
+                       n = n->next;
+               n = n->child->next->next;
+               mandoc_msg(MANDOCERR_ARCH_BAD, n->line, n->pos,
+                   "Dt ... %s %s", mdoc->meta.arch,
+                   mdoc->meta.os_e == MANDOC_OS_OPENBSD ?
+                   "(OpenBSD)" : "(NetBSD)");
        }
 
        /* Check that we begin with a proper `Sh'. */