source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: STYLE message about useless macros we don't want (Bt Tn Ud);
@ 2017-05-30 19:31 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-05-30 19:31 UTC (permalink / raw)
  To: source

Log Message:
-----------
STYLE message about useless macros we don't want (Bt Tn Ud); 
not a WARNING because they don't endanger portability

Modified Files:
--------------
    mdocml:
        mandoc.1
        mandoc.h
        mdoc_validate.c
        read.c
    mdocml/regress:
        regress.pl
    mdocml/regress/mdoc/Tn:
        noarg.out_lint
    mdocml/regress/mdoc/Ud:
        arg.out_lint

Revision Data
-------------
Index: regress.pl
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/regress.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -Lregress/regress.pl -Lregress/regress.pl -u -p -r1.5 -r1.6
--- regress/regress.pl
+++ regress/regress.pl
@@ -341,8 +341,8 @@ for my $testname (@lint_testnames) {
 	if ($targets{lint}) {
 		$count_lint++;
 		$count_total++;
-		print "@mandoc -T lint $i\n" if $targets{verbose};
-		syslint $o, @mandoc, qw(-T lint), $i
+		print "@mandoc -T lint -W all $i\n" if $targets{verbose};
+		syslint $o, @mandoc, qw(-T lint -W all), $i
 		    and fail $subdir, $testname, 'lint:mandoc';
 		system @diff, $w, $o
 		    and fail $subdir, $testname, 'lint:diff';
Index: mandoc.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.h,v
retrieving revision 1.216
retrieving revision 1.217
diff -Lmandoc.h -Lmandoc.h -u -p -r1.216 -r1.217
--- mandoc.h
+++ mandoc.h
@@ -46,6 +46,8 @@ enum	mandocerr {
 
 	MANDOCERR_STYLE, /* ===== start of style suggestions ===== */
 
+	MANDOCERR_MACRO_USELESS, /* useless macro: macro */
+
 	MANDOCERR_WARNING, /* ===== start of warnings ===== */
 
 	/* related to the prologue */
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v
retrieving revision 1.327
retrieving revision 1.328
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.327 -r1.328
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -105,6 +105,7 @@ static	void	 post_sh_authors(POST_ARGS);
 static	void	 post_sm(POST_ARGS);
 static	void	 post_st(POST_ARGS);
 static	void	 post_std(POST_ARGS);
+static	void	 post_useless(POST_ARGS);
 static	void	 post_xr(POST_ARGS);
 static	void	 post_xx(POST_ARGS);
 
@@ -201,7 +202,7 @@ static	const v_post __mdoc_valids[MDOC_M
 	post_sm,	/* Sm */
 	post_hyph,	/* Sx */
 	NULL,		/* Sy */
-	NULL,		/* Tn */
+	post_useless,	/* Tn */
 	post_xx,	/* Ux */
 	NULL,		/* Xc */
 	NULL,		/* Xo */
@@ -671,6 +672,7 @@ post_eoln(POST_ARGS)
 {
 	struct roff_node	*n;
 
+	post_useless(mdoc);
 	n = mdoc->last;
 	if (n->child != NULL)
 		mandoc_vmsg(MANDOCERR_ARG_SKIP, mdoc->parse, n->line,
@@ -864,6 +866,16 @@ post_obsolete(POST_ARGS)
 	if (n->type == ROFFT_ELEM || n->type == ROFFT_BLOCK)
 		mandoc_msg(MANDOCERR_MACRO_OBS, mdoc->parse,
 		    n->line, n->pos, roff_name[n->tok]);
+}
+
+static void
+post_useless(POST_ARGS)
+{
+	struct roff_node *n;
+
+	n = mdoc->last;
+	mandoc_msg(MANDOCERR_MACRO_USELESS, mdoc->parse,
+	    n->line, n->pos, roff_name[n->tok]);
 }
 
 /*
Index: mandoc.1
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.1,v
retrieving revision 1.188
retrieving revision 1.189
diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.188 -r1.189
--- mandoc.1
+++ mandoc.1
@@ -742,6 +742,18 @@ are hidden unless their level, or a lowe
 option or
 .Fl T Cm lint
 output mode.
+.Ss Style messages
+.Bl -ohang
+.It Sy "useless macro"
+.Pq mdoc
+A
+.Ic \&Bt ,
+.Ic \&Tn ,
+or
+.Ic \Ud
+macro was found.
+Simply delete it, it serves no useful purpose.
+.El
 .Ss Warnings related to the document prologue
 .Bl -ohang
 .It Sy "missing manual title, using UNTITLED"
Index: read.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/read.c,v
retrieving revision 1.165
retrieving revision 1.166
diff -Lread.c -Lread.c -u -p -r1.165 -r1.166
--- read.c
+++ read.c
@@ -87,6 +87,9 @@ static	const char * const	mandocerrs[MAN
 	"ok",
 
 	"generic style suggestion",
+
+	"useless macro",
+
 	"generic warning",
 
 	/* related to the prologue */
Index: noarg.out_lint
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/mdoc/Tn/noarg.out_lint,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Tn/noarg.out_lint -Lregress/mdoc/Tn/noarg.out_lint -u -p -r1.1 -r1.2
--- regress/mdoc/Tn/noarg.out_lint
+++ regress/mdoc/Tn/noarg.out_lint
@@ -1 +1,2 @@
 mandoc: noarg.in:11:2: WARNING: skipping empty macro: Tn
+mandoc: noarg.in:9:2: STYLE: useless macro: Tn
Index: arg.out_lint
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/mdoc/Ud/arg.out_lint,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Ud/arg.out_lint -Lregress/mdoc/Ud/arg.out_lint -u -p -r1.1 -r1.2
--- regress/mdoc/Ud/arg.out_lint
+++ regress/mdoc/Ud/arg.out_lint
@@ -1,4 +1,10 @@
+mandoc: arg.in:9:2: STYLE: useless macro: Ud
+mandoc: arg.in:11:2: STYLE: useless macro: Bt
+mandoc: arg.in:15:2: STYLE: useless macro: Ud
 mandoc: arg.in:15:2: ERROR: skipping all arguments: Ud bar
+mandoc: arg.in:16:2: STYLE: useless macro: Bt
 mandoc: arg.in:16:2: ERROR: skipping all arguments: Bt foo
+mandoc: arg.in:17:2: STYLE: useless macro: Ud
 mandoc: arg.in:17:2: ERROR: skipping all arguments: Ud one
+mandoc: arg.in:18:2: STYLE: useless macro: Bt
 mandoc: arg.in:18:2: ERROR: skipping all arguments: Bt one
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

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

only message in thread, other threads:[~2017-05-30 19:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-30 19:31 mdocml: STYLE message about useless macros we don't want (Bt Tn Ud); 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).