groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 01/01: src/roff/troff/input.cpp: Emit diagnostic less.


From: G. Branden Robinson
Subject: [groff] 01/01: src/roff/troff/input.cpp: Emit diagnostic less.
Date: Mon, 6 Apr 2020 09:29:20 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 3208cf22c9ce7267da282919bff55247af3d04d3
Author: G. Branden Robinson <address@hidden>
AuthorDate: Mon Apr 6 23:19:50 2020 +1000

    src/roff/troff/input.cpp: Emit diagnostic less.
    
    In compatibility mode, constructs like '\s1A' would get two diagnostics,
    one regarding the bad digit and another about the ambiguous form.
    
    src/roff/troff/input.cpp (read_size): Correctly brace 'else' block.
    
    And GCC didn't even catch the misleading indentation.  Shame.
    
    "I warned you!  I warned you, but did you listen to me?  Oh no, you
    knew, didn't you?"
    -- Tim the 21b07d7b641d4572c4916d04069e18c8feba91cc Enchanter
    
    src/roff/groff/tests/use_point_size_escape_with_single_digit_arg.sh:
    Check that we get a diagnostic when relying on ambiguous form.
---
 ChangeLog                                                        | 9 +++++++++
 .../groff/tests/use_point_size_escape_with_single_digit_arg.sh   | 5 +++++
 src/roff/troff/input.cpp                                         | 3 ++-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 029882e..dc7f9ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-04-06  G. Branden Robinson <address@hidden>
+
+       * src/roff/troff/input.cpp (read_size): Correctly brace 'else'
+       block.
+
+       * src/roff/groff/tests/\
+       use_point_size_escape_with_single_digit_arg.sh:
+       Check that we get a diagnostic when relying on ambiguous form.
+
 2020-04-04  G. Branden Robinson <address@hidden>
 
        * src/roff/troff/input.cpp (read_size): Move special-case
diff --git 
a/src/roff/groff/tests/use_point_size_escape_with_single_digit_arg.sh 
b/src/roff/groff/tests/use_point_size_escape_with_single_digit_arg.sh
index 4dc9073..b80a102 100755
--- a/src/roff/groff/tests/use_point_size_escape_with_single_digit_arg.sh
+++ b/src/roff/groff/tests/use_point_size_escape_with_single_digit_arg.sh
@@ -34,3 +34,8 @@ echo "$DOC" | "$groff" -C -Z | grep -qx 's36000'
 # ...and not in regular mode.
 echo "testing \s36A in non-compatiblity mode (3-point '6A')" >&2
 echo "$DOC" | "$groff" -Z | grep -qx 's3000'
+
+# Check that we get a diagnostic when relying on the ambiguous form.
+echo "testing for diagnostic on \s36 in compatiblity mode" >&2
+echo "$DOC" | "$groff" -C -Z 2>&1 >/dev/null \
+    | grep -q 'ambiguous point-size escape'
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 87080ff..08e28bb 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -5082,10 +5082,11 @@ static int read_size(int *x)
       c = tok.ch();
       if (!csdigit(c))
        bad_digit = 1;
-      else
+      else {
        val = val*10 + (c - '0');
        error("ambiguous point-size escape; rewrite to use '\\s(%1'"
              " or similar", val);
+      }
     }
     val *= sizescale;
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]