From 02c9cc101636db804342fba6a74b079abe7dd482 Mon Sep 17 00:00:00 2001 From: schwarze Date: Sat, 16 Aug 2014 19:47:17 +0000 Subject: [PATCH] If a stray .It follows .El, we are no longer in the list, even though the list is still the last processed macro. This fixes a regression introduced in mdoc_macro.c rev. 1.95: Ulrich Spoerlein reports that various of their kernel manuals trigger assertions. --- regress/usr.bin/mandoc/mdoc/Bl/bareIt.in | 7 ++++++- regress/usr.bin/mandoc/mdoc/Bl/bareIt.out_ascii | 4 +++- regress/usr.bin/mandoc/mdoc/Bl/bareIt.out_lint | 2 ++ usr.bin/mandoc/mdoc_macro.c | 5 +++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/regress/usr.bin/mandoc/mdoc/Bl/bareIt.in b/regress/usr.bin/mandoc/mdoc/Bl/bareIt.in index e844b270bad..ad43c4bf7ec 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/bareIt.in +++ b/regress/usr.bin/mandoc/mdoc/Bl/bareIt.in @@ -1,4 +1,4 @@ -.Dd July 30, 2014 +.Dd August 16, 2014 .Dt BL-BAREIT 1 .Os OpenBSD .Sh NAME @@ -7,4 +7,9 @@ .Sh DESCRIPTION initial text .It argument +.Bl -dash +.It +item +.El +.It argument final text diff --git a/regress/usr.bin/mandoc/mdoc/Bl/bareIt.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/bareIt.out_ascii index 9ded54f765d..aa1401a0b55 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/bareIt.out_ascii +++ b/regress/usr.bin/mandoc/mdoc/Bl/bareIt.out_ascii @@ -5,6 +5,8 @@ NNAAMMEE DDEESSCCRRIIPPTTIIOONN initial text + + -- item final text -OpenBSD July 30, 2014 OpenBSD +OpenBSD August 16, 2014 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Bl/bareIt.out_lint b/regress/usr.bin/mandoc/mdoc/Bl/bareIt.out_lint index 45109ee2eb3..9badbf23afe 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/bareIt.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Bl/bareIt.out_lint @@ -1 +1,3 @@ mandoc: bareIt.in:9:2: ERROR: skipping item outside list: It argument +mandoc: bareIt.in:9:2: WARNING: skipping paragraph macro: br before Bl +mandoc: bareIt.in:14:2: ERROR: skipping item outside list: It argument diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index 91448ad820f..8f051811eab 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.96 2014/08/08 15:54:10 schwarze Exp $ */ +/* $Id: mdoc_macro.c,v 1.97 2014/08/16 19:47:17 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010, 2012, 2013 Ingo Schwarze @@ -1037,7 +1037,8 @@ blk_full(MACRO_PROT_ARGS) if (tok == MDOC_It) { for (n = mdoc->last; n; n = n->parent) - if (n->tok == MDOC_Bl) + if (n->tok == MDOC_Bl && + ! (n->flags & MDOC_VALID)) break; if (n == NULL) { mandoc_vmsg(MANDOCERR_IT_STRAY, mdoc->parse, -- 2.20.1