(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
This commit is contained in:
parent
c451a7a05b
commit
b7150e4597
11
gcc/cccp.c
11
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++) = '/';
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user