summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary V. Vaughan <gary@gnu.org>2013-09-17 21:26:23 +0700
committerGary V. Vaughan <gary@gnu.org>2013-09-17 22:08:36 +0700
commit2fb0cd6641e3223474ac2487605938cfafc7f540 (patch)
tree4e95311a6b7f293da0e5adae732ad9daa1c795b5
parent95d7405a7540f91f67a505fa6458bde3d8e31f79 (diff)
downloadm4-2fb0cd6641e3223474ac2487605938cfafc7f540.tar.gz
m4: avoid spurious output with unrecognized format specifiers.
* modules/format.c (format): Advance the loop invariants past an unrecognized format specifier to avoid printing the specifier character on the next pass. * doc/m4.texi (Format): Don't expect unrecognized specifiers to be output by format macro. * tests/null.out: Don't expect unrecognized null specifier to be output. * tests/generate.awk (new_test): Treat `ignore' in expected error output the same as Autotest. * doc/m4.texi (Format): Use special `ignore' string rather than unsupported @comment xerr magic. Signed-off-by: Gary V. Vaughan <gary@gnu.org>
-rw-r--r--doc/m4.texi4
-rw-r--r--modules/format.c5
-rwxr-xr-xtests/generate.awk3
-rw-r--r--tests/null.outbin632 -> 631 bytes
4 files changed, 10 insertions, 2 deletions
diff --git a/doc/m4.texi b/doc/m4.texi
index bc2fccaf..06d871db 100644
--- a/doc/m4.texi
+++ b/doc/m4.texi
@@ -7512,7 +7512,7 @@ Likewise, escape sequences are not yet recognized.
@example
format(`%p', `0')
@error{}m4:stdin:1: warning: format: unrecognized specifier in '%p'
-@result{}p
+@result{}
format(`%*d', `')
@error{}m4:stdin:2: warning: format: empty string treated as 0
@error{}m4:stdin:2: warning: format: too few arguments: 2 < 3
@@ -7527,10 +7527,10 @@ format(`%.1f', `2a')
@comment Unfortunately, 8-bit bytes are hard to check for; but the
@comment exit status is enough to sniff the crash in broken versions.
-@comment xerr: ignore
@example
format(`%'format(`%c', `128'))
@result{}
+@error{}ignore
@end example
@end ignore
diff --git a/modules/format.c b/modules/format.c
index b13b2630..92e2d474 100644
--- a/modules/format.c
+++ b/modules/format.c
@@ -338,6 +338,11 @@ format (m4 *context, m4_obstack *obs, int argc, m4_macro_args *argv)
m4_warn (context, 0, me, _("unrecognized specifier in %s"),
quotearg_style_mem (locale_quoting_style, f, M4ARGLEN (1)));
valid_format = false;
+ if (f_len > 0)
+ {
+ fmt++;
+ f_len--;
+ }
continue;
}
fmt++;
diff --git a/tests/generate.awk b/tests/generate.awk
index 6dcddf4e..ab25661f 100755
--- a/tests/generate.awk
+++ b/tests/generate.awk
@@ -170,6 +170,9 @@ function new_test(input, status, output, error, options, xfail, examples) {
output = normalize(output);
error = normalize(error);
+ if (error == "ignore\n")
+ error = "ignore";
+
if (options ~ / (import|load|modtest|mpeval|perl|shadow|stdlib|time)/)
printf ("AT_CHECK_DYNAMIC_MODULE\n");
if (options ~ / mpeval/)
diff --git a/tests/null.out b/tests/null.out
index 993d9fe0..784ab7ab 100644
--- a/tests/null.out
+++ b/tests/null.out
Binary files differ