comparison macro.c @ 175:ffdb0b73856f

Suppress blank lines later. Fixes the rest of the bizarre spacing behavior described in changeset 82cc6fa54b01. Expand t39 to cover more cases, too.
author David A. Holland
date Fri, 12 Jun 2015 02:38:04 -0400
parents 09cfad6772de
children 6119608a9817
comparison
equal deleted inserted replaced
174:09cfad6772de 175:ffdb0b73856f
1244 macro_sendline(struct place *p, char *buf, size_t len) 1244 macro_sendline(struct place *p, char *buf, size_t len)
1245 { 1245 {
1246 doexpand(&mainstate, p, buf, len); 1246 doexpand(&mainstate, p, buf, len);
1247 switch (mainstate.state) { 1247 switch (mainstate.state) {
1248 case ES_NORMAL: 1248 case ES_NORMAL:
1249 output(p, "\n", 1); 1249 /*
1250 * If we were sent a blank line, don't emit a newline
1251 * for it. This matches the prior behavior of tradcpp.
1252 */
1253 if (len > 0) {
1254 output(p, "\n", 1);
1255 }
1250 break; 1256 break;
1251 case ES_WANTLPAREN: 1257 case ES_WANTLPAREN:
1252 case ES_NOARG: 1258 case ES_NOARG:
1253 case ES_HAVEARG: 1259 case ES_HAVEARG:
1260 /*
1261 * Apparently to match gcc's -traditional behavior we
1262 * need to emit a space for each newline that appears
1263 * while processing macro args.
1264 */
1254 expand_got_ws(&mainstate, p, " ", 1); 1265 expand_got_ws(&mainstate, p, " ", 1);
1255 break; 1266 break;
1256 } 1267 }
1257 } 1268 }
1258 1269