diff options
author | Mark Mitchell <mark@markmitchell.com> | 1998-06-17 10:40:49 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1998-06-17 10:40:49 +0000 |
commit | a5b8127eb13cce7fa4ddf8e4337f6e9fe67d1dc4 (patch) | |
tree | 6699b6b695fe7c6b6966556e841b505e059b2af7 /gcc | |
parent | d460fb3cdd284fb444d228af2f2f0b2c885b33b1 (diff) | |
download | gcc-a5b8127eb13cce7fa4ddf8e4337f6e9fe67d1dc4.zip gcc-a5b8127eb13cce7fa4ddf8e4337f6e9fe67d1dc4.tar.gz gcc-a5b8127eb13cce7fa4ddf8e4337f6e9fe67d1dc4.tar.bz2 |
* errfn.c (cp_thing): Handle the `%%' formatting sequence.
From-SVN: r20537
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/errfn.c | 18 |
2 files changed, 21 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d89f0c1..318b733 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +1998-06-17 Mark Mitchell <mark@markmitchell.com> + + * errfn.c (cp_thing): Handle the `%%' formatting sequence. + 1998-06-17 Jason Merrill <jason@yorick.cygnus.com> * method.c (hack_identifier): Complain about getting a namespace diff --git a/gcc/cp/errfn.c b/gcc/cp/errfn.c index e5bfdf4..8d20682 100644 --- a/gcc/cp/errfn.c +++ b/gcc/cp/errfn.c @@ -50,7 +50,8 @@ extern int cp_line_of PROTO((tree)); #define STRDUP(f) (ap = (char *) alloca (strlen (f) +1), strcpy (ap, (f)), ap) -/* This function supports only `%s', `%d', and the C++ print codes. */ +/* This function supports only `%s', `%d', `%%', and the C++ print + codes. */ #ifdef __STDC__ static void @@ -152,6 +153,21 @@ cp_thing (errfn, atarg1, format, ap) strcpy (buf + offset, p); offset += plen; } + else if (*f == '%') + { + /* A `%%' has occurred in the input string. Since the + string we produce here will be passed to vprintf we must + preserve both `%' characters. */ + + len += 2; + if (len > buflen) + { + buflen = len; + buf = xrealloc (buf, len); + } + strcpy (buf + offset, "%%"); + offset += 2; + } else { if (*f != 'd') |