diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-07-02 20:19:11 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-07-02 20:19:11 +0000 |
commit | 02c50c123f386b824e755e7f6334792530c88411 (patch) | |
tree | e1563af95c08fd153266f539d7fa5524f1c6ae36 | |
parent | fdc95e0f088e210664eb7459003c922102fc748e (diff) | |
download | mandoc-02c50c123f386b824e755e7f6334792530c88411.tar.gz |
Improve and test the messages about empty macros,
in particular reporting the macro names involved.
-rw-r--r-- | mandoc.h | 2 | ||||
-rw-r--r-- | mdoc_macro.c | 8 | ||||
-rw-r--r-- | mdoc_validate.c | 4 |
3 files changed, 9 insertions, 5 deletions
@@ -84,7 +84,7 @@ enum mandocerr { MANDOCERR_LINESCOPE, /* line scope broken: macro breaks macro */ /* related to missing macro arguments */ - MANDOCERR_MACROEMPTY, /* skipping empty macro */ + MANDOCERR_MACRO_EMPTY, /* skipping empty macro: macro */ MANDOCERR_ARGCWARN, /* argument count wrong */ MANDOCERR_DISPTYPE, /* missing display type */ MANDOCERR_LISTFIRST, /* list type must come first */ diff --git a/mdoc_macro.c b/mdoc_macro.c index 36aa8b82..21ab591d 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -919,8 +919,9 @@ in_line(MACRO_PROT_ARGS) return(0); } else if ( ! nc && 0 == cnt) { mdoc_argv_free(arg); - mdoc_pmsg(mdoc, line, ppos, - MANDOCERR_MACROEMPTY); + mandoc_msg(MANDOCERR_MACRO_EMPTY, + mdoc->parse, line, ppos, + mdoc_macronames[tok]); } if ( ! mdoc_macro(mdoc, ntok, line, la, pos, buf)) @@ -1005,7 +1006,8 @@ in_line(MACRO_PROT_ARGS) return(0); } else if ( ! nc && 0 == cnt) { mdoc_argv_free(arg); - mdoc_pmsg(mdoc, line, ppos, MANDOCERR_MACROEMPTY); + mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse, + line, ppos, mdoc_macronames[tok]); } if ( ! nl) diff --git a/mdoc_validate.c b/mdoc_validate.c index ecd1ee09..945d684b 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1729,7 +1729,9 @@ post_st(POST_ARGS) const char *p; if (NULL == (ch = mdoc->last->child)) { - mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_MACROEMPTY); + mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse, + mdoc->last->line, mdoc->last->pos, + mdoc_macronames[mdoc->last->tok]); mdoc_node_delete(mdoc, mdoc->last); return(1); } |