]> git.cameronkatri.com Git - mandoc.git/blobdiff - man_validate.c
Clean up warnings related to macros and nesting.
[mandoc.git] / man_validate.c
index 15c34e08881782e217f88dc9f8ccc9011f7e9bb4..61f8ef811a4fefd9dde18e72d3e36d31ac419375 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: man_validate.c,v 1.92 2014/06/20 17:24:00 schwarze Exp $ */
+/*     $Id: man_validate.c,v 1.96 2014/07/02 11:43:20 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -198,10 +198,12 @@ check_root(CHKARGS)
        man->flags &= ~MAN_BLINE;
        man->flags &= ~MAN_ELINE;
 
-       if (NULL == man->first->child) {
-               man_nmsg(man, n, MANDOCERR_NODOCBODY);
-               return(0);
-       } else if (NULL == man->meta.title) {
+       if (NULL == man->first->child)
+               man_nmsg(man, n, MANDOCERR_DOC_EMPTY);
+       else
+               man->meta.hasbody = 1;
+
+       if (NULL == man->meta.title) {
                man_nmsg(man, n, MANDOCERR_TH_MISSING);
 
                /*
@@ -355,7 +357,9 @@ check_par(CHKARGS)
                break;
        case MAN_BODY:
                if (0 == n->nchild)
-                       man_nmsg(man, n, MANDOCERR_IGNPAR);
+                       mandoc_vmsg(MANDOCERR_PAR_SKIP,
+                           man->parse, n->line, n->pos,
+                           "%s empty", man_macronames[n->tok]);
                break;
        case MAN_HEAD:
                if (n->nchild)
@@ -379,7 +383,9 @@ post_IP(CHKARGS)
                break;
        case MAN_BODY:
                if (0 == n->parent->head->nchild && 0 == n->nchild)
-                       man_nmsg(man, n, MANDOCERR_IGNPAR);
+                       mandoc_vmsg(MANDOCERR_PAR_SKIP,
+                           man->parse, n->line, n->pos,
+                           "%s empty", man_macronames[n->tok]);
                break;
        default:
                break;
@@ -412,7 +418,10 @@ post_TH(CHKARGS)
                        /* Only warn about this once... */
                        if (isalpha((unsigned char)*p) &&
                            ! isupper((unsigned char)*p)) {
-                               man_nmsg(man, n, MANDOCERR_TITLE_CASE);
+                               mandoc_msg(MANDOCERR_TITLE_CASE,
+                                   man->parse, n->line,
+                                   n->pos + (p - n->string),
+                                   n->string);
                                break;
                        }
                }
@@ -470,7 +479,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);
@@ -481,7 +490,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);
@@ -574,7 +583,9 @@ post_vs(CHKARGS)
        case MAN_SH:
                /* FALLTHROUGH */
        case MAN_SS:
-               man_nmsg(man, n, MANDOCERR_IGNPAR);
+               mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse, n->line, n->pos,
+                   "%s after %s", man_macronames[n->tok],
+                   man_macronames[n->parent->tok]);
                /* FALLTHROUGH */
        case MAN_MAX:
                /*