ref: e3605a59a69b622c8a3a0e416d9eade7887e1718
parent: 35572b0d6f214a181ae63671c909935e1b0914a4
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Jan 12 03:51:17 EST 2017
[cc1] Fix readline() After the modification of macro expansions to use push up buffers readline was broken, because after expanding a macro we have to return always from readline, otherwise we can remove some newline from the input. This new version also makes better use of 'goto' than the previous version.
--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -202,27 +202,21 @@
char *bp, *lim;
char c, peekc = 0;
-repeat_from_file:
- *input->line = '\0';
- input->p = input->line;
+repeat:
-repeat_from_expand:
- input->begin = input->p;
-
- if (*input->begin)
- return 1;
-
if (eof)
return 0;
-
if (!input->fp) {
delinput();
- goto repeat_from_expand;
+ return 1;
}
if (feof(input->fp)) {
delinput();
- goto repeat_from_file;
+ goto repeat;
}
+
+ *input->line = '\0';
+ input->begin = input->p = input->line;
lim = &input->line[INPUTSIZ-1];
for (bp = input->line; bp < lim; *bp++ = c) {
c = (peekc) ? peekc : readchar();