ref: fb221ac39dede45cc993cf4568e6e26ac1f7e14f
parent: 6c49e45d28d7615e701bd6525db7acdfbf32bd08
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Apr 27 18:00:02 EDT 2016
[cc2] Give a better message in line without newline In this case cc2 was printing the message of line too long, which was wrong, but both cases shared the same test, line without newline.
--- a/cc2/cc2.h
+++ b/cc2/cc2.h
@@ -113,6 +113,7 @@
ESTACKO, /* stack overflow */
ESTACKU, /* stack underflow */
ELNLINE, /* line too long */
+ ELNBLNE, /* line without new line */
EFERROR, /* error reading from file:%s*/
EBADID, /* incorrect symbol id */
ENUMERR
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -313,7 +313,7 @@
if ((len = strlen(line)) == 0 || line[0] == '\n')
goto repeat;
if (line[len-1] != '\n')
- error(ELNLINE);
+ error(len < sizeof(line)-1 ? ELNBLNE : ELNLINE);
line[len-1] = '\0';
c = *line;