Commit 12a27dfc by Theodore Papadopoulo Committed by Jason Merrill

errfn.c (cp_thing): Print buf as a string not as a printf format to avoid…

errfn.c (cp_thing): Print buf as a string not as a printf format to avoid problems with the operator%.

	* errfn.c (cp_thing): Print buf as a string not as a printf format
	to avoid problems with the operator%. Consequently, `%%' sequences
	in format are copied as `%' in buf.

From-SVN: r22825
parent 5f2c99c4
1998-10-04 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
* errfn.c (cp_thing): Print buf as a string not as a printf format
to avoid problems with the operator%. Consequently, `%%' sequences
in format are copied as `%' in buf.
1998-10-04 Jason Merrill <jason@yorick.cygnus.com> 1998-10-04 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (pop_tinst_level): Call extract_interface_info. * pt.c (pop_tinst_level): Call extract_interface_info.
......
...@@ -149,18 +149,15 @@ cp_thing (errfn, atarg1, format, ap) ...@@ -149,18 +149,15 @@ cp_thing (errfn, atarg1, format, ap)
} }
else if (*f == '%') else if (*f == '%')
{ {
/* A `%%' has occurred in the input string. Since the /* A `%%' has occurred in the input string. Replace it with
string we produce here will be passed to vprintf we must a `%' in the formatted message buf. */
preserve both `%' characters. */
len += 2; if (++len > buflen)
if (len > buflen)
{ {
buflen = len; buflen = len;
buf = xrealloc (buf, len); buf = xrealloc (buf, len);
} }
strcpy (buf + offset, "%%"); buf[offset++] = '%';
offset += 2;
} }
else else
{ {
...@@ -190,10 +187,10 @@ cp_thing (errfn, atarg1, format, ap) ...@@ -190,10 +187,10 @@ cp_thing (errfn, atarg1, format, ap)
{ {
char *file = cp_file_of (atarg); char *file = cp_file_of (atarg);
int line = cp_line_of (atarg); int line = cp_line_of (atarg);
(*errfn) (file, line, buf); (*errfn) (file, line, "%s", buf);
} }
else else
(*errfn) (buf); (*errfn) ("%s", buf);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment