aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-08-11 16:41:33 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-08-11 16:41:33 -0400
commitb7150e45977639889fad84cc279a8ae2dff5d28e (patch)
tree9539fef33e4487d1bbb524d9f291663b7bab8aaf /gcc
parentc451a7a05b5fd1d72b66f1762f34e76bd39bf755 (diff)
downloadgcc-b7150e45977639889fad84cc279a8ae2dff5d28e.zip
gcc-b7150e45977639889fad84cc279a8ae2dff5d28e.tar.gz
gcc-b7150e45977639889fad84cc279a8ae2dff5d28e.tar.bz2
(rescan): Fix botches with `-lint': the output buffer pointer was not recached properly, leading to lost output.
(rescan): Fix botches with `-lint': the output buffer pointer was not recached properly, leading to lost output. Also, buffer overrun was possible. From-SVN: r7896
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cccp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index 1a9f660..65e2d8f 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -2797,6 +2797,9 @@ do { ip = &instack[indepth]; \
char *lintcmd = get_lintcmd (ibp, limit, &argbp, &arglen, &cmdlen);
if (lintcmd != NULL) {
+ op->bufp = obp;
+ check_expand (op, 13 + cmdlen);
+ obp = op->bufp;
/* I believe it is always safe to emit this newline: */
obp[-1] = '\n';
bcopy ("#pragma lint ", (char *) obp, 13);
@@ -2811,10 +2814,12 @@ do { ip = &instack[indepth]; \
}
/* OK, now bring us back to the state we were in before we entered
- this branch. We need #line b/c the newline for the pragma
- could fuck things up. */
+ this branch. We need #line because the #pragma's newline always
+ messes up the line count. */
+ op->bufp = obp;
output_line_command (ip, op, 0, same_file);
- *(obp++) = ' '; /* just in case, if comments are copied thru */
+ check_expand (op, ip->length - (ip->bufp - ip->buf));
+ obp = op->bufp;
*(obp++) = '/';
}
}