summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-07-02 11:42:57 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-07-02 11:42:57 +0000
commiteb23be324e2d6141312f694f504b184ccf326d9b (patch)
tree2fbabacafcbfc24cca41fde40aa473069c1312a2 /usr.bin
parentec55a547f2c134a78adccbca63f05be1cc2b66c8 (diff)
Clean up warnings related to macros and nesting.
* Hierarchical naming of enum mandocerr items. * Improve the wording to make it comprehensible. * Mention the offending macro. * Garbage collect one chunk of ancient, long unreachable code.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/man_validate.c6
-rw-r--r--usr.bin/mandoc/mandoc.h14
-rw-r--r--usr.bin/mandoc/mdoc_macro.c19
-rw-r--r--usr.bin/mandoc/mdoc_validate.c8
-rw-r--r--usr.bin/mandoc/read.c6
5 files changed, 23 insertions, 30 deletions
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c
index a8313eedc21..d1c69a4dabb 100644
--- a/usr.bin/mandoc/man_validate.c
+++ b/usr.bin/mandoc/man_validate.c
@@ -1,4 +1,4 @@
-/* $Id: man_validate.c,v 1.67 2014/07/02 05:51:49 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.68 2014/07/02 11:42:56 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -475,7 +475,7 @@ post_nf(CHKARGS)
{
if (MAN_LITERAL & man->flags)
- man_nmsg(man, n, MANDOCERR_SCOPEREP);
+ man_nmsg(man, n, MANDOCERR_NF_SKIP);
man->flags |= MAN_LITERAL;
return(1);
@@ -486,7 +486,7 @@ post_fi(CHKARGS)
{
if ( ! (MAN_LITERAL & man->flags))
- man_nmsg(man, n, MANDOCERR_WNOSCOPE);
+ man_nmsg(man, n, MANDOCERR_FI_SKIP);
man->flags &= ~MAN_LITERAL;
return(1);
diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h
index a585546b23a..48a95f5ef75 100644
--- a/usr.bin/mandoc/mandoc.h
+++ b/usr.bin/mandoc/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.71 2014/07/02 05:51:49 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.72 2014/07/02 11:42:56 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -74,12 +74,13 @@ enum mandocerr {
MANDOCERR_MACRO_OBS, /* obsolete macro: macro */
MANDOCERR_PAR_SKIP, /* skipping paragraph macro: macro ... */
MANDOCERR_PAR_MOVE, /* moving paragraph macro out of list: macro */
- MANDOCERR_IGNNS, /* skipping no-space macro */
- MANDOCERR_SCOPENEST, /* blocks badly nested */
+ MANDOCERR_NS_SKIP, /* skipping no-space macro */
+ MANDOCERR_BLOCK_NEST, /* blocks badly nested: macro ... */
MANDOCERR_CHILD, /* child violates parent syntax */
- MANDOCERR_NESTEDDISP, /* nested displays are not portable */
- MANDOCERR_SCOPEREP, /* already in literal mode */
- MANDOCERR_LINESCOPE, /* line scope broken */
+ MANDOCERR_BD_NEST, /* nested displays are not portable: macro ... */
+ MANDOCERR_FI_SKIP, /* fill mode already enabled, skipping .fi */
+ MANDOCERR_NF_SKIP, /* fill mode already disabled, skipping .nf */
+ MANDOCERR_LINESCOPE, /* line scope broken: macro breaks macro */
/* related to missing macro arguments */
MANDOCERR_MACROEMPTY, /* skipping empty macro */
@@ -88,7 +89,6 @@ enum mandocerr {
MANDOCERR_LISTFIRST, /* list type must come first */
MANDOCERR_NOWIDTHARG, /* tag lists require a width argument */
MANDOCERR_FONTTYPE, /* missing font type */
- MANDOCERR_WNOSCOPE, /* skipping end of block that is not open */
/* related to bad macro arguments */
MANDOCERR_IGNARGV, /* skipping argument */
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index c3e62c2116d..77edabfb633 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.90 2014/07/02 08:21:12 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.91 2014/07/02 11:42:56 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -524,7 +524,7 @@ make_pending(struct mdoc_node *broken, enum mdoct tok,
taker->pending = broken->pending;
}
broken->pending = breaker;
- mandoc_vmsg(MANDOCERR_SCOPENEST, mdoc->parse, line, ppos,
+ mandoc_vmsg(MANDOCERR_BLOCK_NEST, mdoc->parse, line, ppos,
"%s breaks %s", mdoc_macronames[tok],
mdoc_macronames[broken->tok]);
return(1);
@@ -1350,18 +1350,9 @@ blk_part_imp(MACRO_PROT_ARGS)
return(1);
}
}
+ assert(n == body);
- /*
- * If we can't rewind to our body, then our scope has already
- * been closed by another macro (like `Oc' closing `Op'). This
- * is ugly behaviour nodding its head to OpenBSD's overwhelming
- * crufty use of `Op' breakage.
- */
- if (n != body)
- mandoc_vmsg(MANDOCERR_SCOPENEST, mdoc->parse, line,
- ppos, "%s broken", mdoc_macronames[tok]);
-
- if (n && ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos))
+ if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos))
return(0);
/* Standard appending of delimiters. */
@@ -1371,7 +1362,7 @@ blk_part_imp(MACRO_PROT_ARGS)
/* Rewind scope, if applicable. */
- if (n && ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos))
+ if ( ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos))
return(0);
/* Move trailing .Ns out of scope. */
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 48bc9fc86f9..83c45f34cd1 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.137 2014/07/02 05:51:49 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.138 2014/07/02 11:42:56 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -587,7 +587,9 @@ pre_display(PRE_ARGS)
break;
if (node)
- mdoc_nmsg(mdoc, n, MANDOCERR_NESTEDDISP);
+ mandoc_vmsg(MANDOCERR_BD_NEST,
+ mdoc->parse, n->line, n->pos,
+ "%s in Bd", mdoc_macronames[n->tok]);
return(1);
}
@@ -1899,7 +1901,7 @@ post_ns(POST_ARGS)
{
if (MDOC_LINE & mdoc->last->flags)
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_IGNNS);
+ mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NS_SKIP);
return(1);
}
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c
index f5b7db17ad1..dc836512468 100644
--- a/usr.bin/mandoc/read.c
+++ b/usr.bin/mandoc/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.33 2014/07/02 03:47:07 schwarze Exp $ */
+/* $Id: read.c,v 1.34 2014/07/02 11:42:56 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -114,7 +114,8 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"blocks badly nested",
"child violates parent syntax",
"nested displays are not portable",
- "already in literal mode",
+ "fill mode already enabled, skipping .fi",
+ "fill mode already disabled, skipping .nf",
"line scope broken",
/* related to missing macro arguments */
@@ -124,7 +125,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"list type must come first",
"tag lists require a width argument",
"missing font type",
- "skipping end of block that is not open",
/* related to bad macro arguments */
"skipping argument",