source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: operating system dependent message about unknown architecture;
@ 2017-06-24 18:59 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-06-24 18:59 UTC (permalink / raw)
  To: source

Log Message:
-----------
operating system dependent message about unknown architecture;
inspired by mdoclint

Modified Files:
--------------
    mandoc:
        mandoc.h
        mdoc_validate.c
        read.c

Revision Data
-------------
Index: read.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/read.c,v
retrieving revision 1.180
retrieving revision 1.181
diff -Lread.c -Lread.c -u -p -r1.180 -r1.181
--- read.c
+++ read.c
@@ -90,6 +90,7 @@ static	const char * const	mandocerrs[MAN
 
 	"Mdocdate found",
 	"Mdocdate missing",
+	"unknown architecture",
 	"operating system explicitly specified",
 	"RCS id missing",
 
Index: mandoc.h
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc.h,v
retrieving revision 1.234
retrieving revision 1.235
diff -Lmandoc.h -Lmandoc.h -u -p -r1.234 -r1.235
--- mandoc.h
+++ mandoc.h
@@ -48,6 +48,7 @@ enum	mandocerr {
 
 	MANDOCERR_MDOCDATE, /* Mdocdate found: Dd ... */
 	MANDOCERR_MDOCDATE_MISSING, /* Mdocdate missing: Dd ... */
+	MANDOCERR_ARCH_BAD,  /* unknown architecture: Dt ... arch */
 	MANDOCERR_OS_ARG,  /* operating system explicitly specified: Os ... */
 	MANDOCERR_RCS_MISSING, /* RCS id missing */
 
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mdoc_validate.c,v
retrieving revision 1.341
retrieving revision 1.342
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.341 -r1.342
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -1786,7 +1786,29 @@ 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. */
 
@@ -1812,6 +1834,23 @@ post_root(POST_ARGS)
 		mandoc_msg(MANDOCERR_RCS_MISSING, mdoc->parse, 0, 0,
 		    mdoc->meta.os_e == MANDOC_OS_OPENBSD ?
 		    "(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->first->child;
+			while (n->tok != MDOC_Dt)
+				n = n->next;
+			n = n->child->next->next;
+			mandoc_vmsg(MANDOCERR_ARCH_BAD,
+			    mdoc->parse, 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'. */
 
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-24 18:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-24 18:59 mandoc: operating system dependent message about unknown architecture; schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).