summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-07-06 09:21:24 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-07-06 09:21:24 +0000
commit4baed99617de2e5dacb16862a0cecb8885b435f0 (patch)
treed9f9bab848b056d01e919c484bc3c34b6516f2b1
parent0624c9ad95223c7844a47eca56f838193ad71a0b (diff)
downloadmandoc-4baed99617de2e5dacb16862a0cecb8885b435f0.tar.gz
Initial removal of enum mdoc_warn from mdoc warnings (unnecessary complication).
-rw-r--r--libmdoc.h11
-rw-r--r--main.c26
-rw-r--r--mdoc.74
-rw-r--r--mdoc.c21
-rw-r--r--mdoc.h9
-rw-r--r--mdoc_action.c7
-rw-r--r--mdoc_argv.c9
-rw-r--r--mdoc_macro.c4
-rw-r--r--mdoc_validate.c16
9 files changed, 35 insertions, 72 deletions
diff --git a/libmdoc.h b/libmdoc.h
index f402ac13..c8e97efe 100644
--- a/libmdoc.h
+++ b/libmdoc.h
@@ -64,16 +64,13 @@ __BEGIN_DECLS
* When GCC2 is deprecated, most of these can be reverted to #define
* as mdoc_vXXX using __VA_ARGS__. Until then, use real functions.
*/
-int mdoc_vwarn(struct mdoc *, int, int,
- enum mdoc_warn, const char *, ...);
-int mdoc_verr(struct mdoc *, int, int,
- const char *, ...);
+int mdoc_vwarn(struct mdoc *, int, int, const char *, ...);
+int mdoc_verr(struct mdoc *, int, int, const char *, ...);
int mdoc_nerr(struct mdoc *, const struct mdoc_node *,
const char *, ...);
-int mdoc_warn(struct mdoc *, enum mdoc_warn, const char *, ...);
+int mdoc_warn(struct mdoc *, const char *, ...);
int mdoc_err(struct mdoc *, const char *, ...);
-int mdoc_pwarn(struct mdoc *, int, int,
- enum mdoc_warn,const char *, ...);
+int mdoc_pwarn(struct mdoc *, int, int, const char *, ...);
int mdoc_perr(struct mdoc *, int, int, const char *, ...);
int mdoc_macro(MACRO_PROT_ARGS);
int mdoc_word_alloc(struct mdoc *,
diff --git a/main.c b/main.c
index 7dafb720..77bf36fa 100644
--- a/main.c
+++ b/main.c
@@ -99,8 +99,7 @@ static int moptions(enum intt *, char *);
static int woptions(int *, char *);
static int merr(void *, int, int, const char *);
static int manwarn(void *, int, int, const char *);
-static int mdocwarn(void *, int, int,
- enum mdoc_warn, const char *);
+static int mdocwarn(void *, int, int, const char *);
static int ffile(struct buf *, struct buf *,
const char *, struct curparse *);
static int fdesc(struct buf *, struct buf *,
@@ -645,31 +644,14 @@ merr(void *arg, int line, int col, const char *msg)
static int
-mdocwarn(void *arg, int line, int col,
- enum mdoc_warn type, const char *msg)
+mdocwarn(void *arg, int line, int col, const char *msg)
{
struct curparse *curp;
- char *wtype;
curp = (struct curparse *)arg;
- wtype = NULL;
- switch (type) {
- case (WARN_COMPAT):
- wtype = "compat";
- if (curp->wflags & WARN_WCOMPAT)
- break;
- return(1);
- case (WARN_SYNTAX):
- wtype = "syntax";
- if (curp->wflags & WARN_WSYNTAX)
- break;
- return(1);
- }
-
- assert(wtype);
- warnx("%s:%d: %s warning: %s (column %d)",
- curp->file, line, wtype, msg, col);
+ warnx("%s:%d: warning: %s (column %d)",
+ curp->file, line, msg, col);
if ( ! (curp->wflags & WARN_WERR))
return(1);
diff --git a/mdoc.7 b/mdoc.7
index dbe6e09f..f0dccbf8 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -663,4 +663,8 @@ blocks.
The \-split and \-nosplit arguments to
.Sq \&.An
are inane.
+.\" LIST-ITEM
+.It
+The end-of-line whitespace warnings are superfluous holdovers from
+historic groff.
.El
diff --git a/mdoc.c b/mdoc.c
index 6876d068..02fe0d10 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -264,8 +264,7 @@ mdoc_verr(struct mdoc *mdoc, int ln, int pos,
int
-mdoc_vwarn(struct mdoc *mdoc, int ln, int pos,
- enum mdoc_warn type, const char *fmt, ...)
+mdoc_vwarn(struct mdoc *mdoc, int ln, int pos, const char *fmt, ...)
{
char buf[256];
va_list ap;
@@ -276,7 +275,7 @@ mdoc_vwarn(struct mdoc *mdoc, int ln, int pos,
va_start(ap, fmt);
(void)vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
va_end(ap);
- return((*mdoc->cb.mdoc_warn)(mdoc->data, ln, pos, type, buf));
+ return((*mdoc->cb.mdoc_warn)(mdoc->data, ln, pos, buf));
}
@@ -299,8 +298,7 @@ mdoc_nerr(struct mdoc *mdoc, const struct mdoc_node *node,
int
-mdoc_warn(struct mdoc *mdoc, enum mdoc_warn type,
- const char *fmt, ...)
+mdoc_warn(struct mdoc *mdoc, const char *fmt, ...)
{
char buf[256];
va_list ap;
@@ -311,8 +309,8 @@ mdoc_warn(struct mdoc *mdoc, enum mdoc_warn type,
va_start(ap, fmt);
(void)vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
va_end(ap);
- return((*mdoc->cb.mdoc_warn)(mdoc->data, mdoc->last->line,
- mdoc->last->pos, type, buf));
+ return((*mdoc->cb.mdoc_warn)(mdoc->data, mdoc->last->line,
+ mdoc->last->pos, buf));
}
@@ -334,8 +332,7 @@ mdoc_err(struct mdoc *mdoc, const char *fmt, ...)
int
-mdoc_pwarn(struct mdoc *mdoc, int line, int pos, enum mdoc_warn type,
- const char *fmt, ...)
+mdoc_pwarn(struct mdoc *mdoc, int line, int pos, const char *fmt, ...)
{
char buf[256];
va_list ap;
@@ -346,8 +343,7 @@ mdoc_pwarn(struct mdoc *mdoc, int line, int pos, enum mdoc_warn type,
va_start(ap, fmt);
(void)vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
va_end(ap);
- return((*mdoc->cb.mdoc_warn)(mdoc->data,
- line, pos, type, buf));
+ return((*mdoc->cb.mdoc_warn)(mdoc->data, line, pos, buf));
}
int
@@ -652,8 +648,7 @@ macrowarn(struct mdoc *m, int ln, const char *buf)
return(mdoc_perr(m, ln, 1,
"unknown macro: %s%s",
buf, strlen(buf) > 3 ? "..." : ""));
- return(mdoc_pwarn(m, ln, 1, WARN_SYNTAX,
- "unknown macro: %s%s",
+ return(mdoc_pwarn(m, ln, 1, "unknown macro: %s%s",
buf, strlen(buf) > 3 ? "..." : ""));
}
diff --git a/mdoc.h b/mdoc.h
index bcd941a4..6050cd36 100644
--- a/mdoc.h
+++ b/mdoc.h
@@ -179,12 +179,6 @@
#define MDOC_Nested 25
#define MDOC_ARG_MAX 26
-/* Warnings are either syntax or groff-compatibility. */
-enum mdoc_warn {
- WARN_SYNTAX,
- WARN_COMPAT
-};
-
/* Type of a syntax node. */
enum mdoc_type {
MDOC_TEXT,
@@ -279,8 +273,7 @@ struct mdoc_node {
/* FIXME: unify somehow with man_cb. */
struct mdoc_cb {
int (*mdoc_err)(void *, int, int, const char *);
- int (*mdoc_warn)(void *, int, int,
- enum mdoc_warn, const char *);
+ int (*mdoc_warn)(void *, int, int, const char *);
};
/* See mdoc.3 for documentation. */
diff --git a/mdoc_action.c b/mdoc_action.c
index 23df587f..f6ad9a4d 100644
--- a/mdoc_action.c
+++ b/mdoc_action.c
@@ -289,14 +289,12 @@ static int
pwarn(struct mdoc *m, int line, int pos, enum mwarn type)
{
char *p;
- int c;
p = NULL;
- c = WARN_SYNTAX;
+
switch (type) {
case (WBADSEC):
p = "inappropriate document section in manual section";
- c = WARN_COMPAT;
break;
case (WNOWIDTH):
p = "cannot determine default width";
@@ -305,8 +303,9 @@ pwarn(struct mdoc *m, int line, int pos, enum mwarn type)
p = "malformed date syntax";
break;
}
+
assert(p);
- return(mdoc_pwarn(m, line, pos, c, p));
+ return(mdoc_pwarn(m, line, pos, p));
}
diff --git a/mdoc_argv.c b/mdoc_argv.c
index 1d8cbcd3..40a1e38c 100644
--- a/mdoc_argv.c
+++ b/mdoc_argv.c
@@ -369,6 +369,7 @@ perr(struct mdoc *mdoc, int line, int pos, enum merr code)
p = "argument requires a value";
break;
}
+
assert(p);
return(mdoc_perr(mdoc, line, pos, p));
}
@@ -378,10 +379,9 @@ static int
pwarn(struct mdoc *mdoc, int line, int pos, enum mwarn code)
{
char *p;
- int c;
p = NULL;
- c = WARN_SYNTAX;
+
switch (code) {
case (WQUOTPARM):
p = "unexpected quoted parameter";
@@ -391,15 +391,14 @@ pwarn(struct mdoc *mdoc, int line, int pos, enum mwarn code)
break;
case (WCOLEMPTY):
p = "last list column is empty";
- c = WARN_COMPAT;
break;
case (WTAILWS):
p = "trailing whitespace";
- c = WARN_COMPAT;
break;
}
+
assert(p);
- return(mdoc_pwarn(mdoc, line, pos, c, p));
+ return(mdoc_pwarn(mdoc, line, pos, p));
}
diff --git a/mdoc_macro.c b/mdoc_macro.c
index d7c3e35c..857c4bce 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -241,7 +241,7 @@ pwarn(struct mdoc *mdoc, int line, int pos, enum mwarn type)
break;
}
assert(p);
- return(mdoc_pwarn(mdoc, line, pos, WARN_SYNTAX, p));
+ return(mdoc_pwarn(mdoc, line, pos, p));
}
@@ -286,7 +286,7 @@ swarn(struct mdoc *mdoc, enum mdoc_type type,
return(mdoc_perr(mdoc, line, pos,
"%s scope breaks %s scope of %s",
tt, t, n));
- return(mdoc_pwarn(mdoc, line, pos, WARN_SYNTAX,
+ return(mdoc_pwarn(mdoc, line, pos,
"%s scope breaks %s scope of %s",
tt, t, n));
}
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 9fd8a302..b1ea9f00 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -444,30 +444,24 @@ static int
pwarn(struct mdoc *m, int line, int pos, enum mwarn type)
{
char *p;
- enum mdoc_warn c;
- c = WARN_SYNTAX;
p = NULL;
+
switch (type) {
case (WBADMSEC):
p = "inappropriate manual section";
- c = WARN_COMPAT;
break;
case (WBADSEC):
p = "inappropriate document section";
- c = WARN_COMPAT;
break;
case (WARGVAL):
p = "argument value suggested";
- c = WARN_COMPAT;
break;
case (WPROLREP):
p = "prologue macros repeated";
- c = WARN_COMPAT;
break;
case (WPROLOOO):
p = "prologue macros out-of-order";
- c = WARN_COMPAT;
break;
case (WNOWIDTH):
p = "superfluous width argument";
@@ -495,7 +489,6 @@ pwarn(struct mdoc *m, int line, int pos, enum mwarn type)
break;
case (WWRONGMSEC):
p = "document section in wrong manual section";
- c = WARN_COMPAT;
break;
case (WSECOOO):
p = "document section out of conventional order";
@@ -510,8 +503,9 @@ pwarn(struct mdoc *m, int line, int pos, enum mwarn type)
p = "NAME section contents incomplete/badly-ordered";
break;
}
+
assert(p);
- return(mdoc_pwarn(m, line, pos, c, p));
+ return(mdoc_pwarn(m, line, pos, p));
}
@@ -529,8 +523,8 @@ warn_count(struct mdoc *m, const char *k,
int want, const char *v, int has)
{
- return(mdoc_warn(m, WARN_SYNTAX,
- "suggests %s %s %d (has %d)", v, k, want, has));
+ return(mdoc_warn(m, "suggests %s %s %d (has %d)",
+ v, k, want, has));
}