shithub: riscv

Download patch

ref: 0cc26776cece29a23d1ddbad750a534df8d29f1b
parent: 540a67e96f5874963880c4cbdbee65eacfb58857
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Nov 3 21:07:11 EDT 2022

cpp: stringified macros shouldn't split words separate by a dot

>	#define A(s) #s
>	#define B(s) A(s)
>
>	#define x0 blah blah blah
>	B(x0)
>
>	#define x1 blah.blah
>	B(x1)

Before the fix, B(x1) would become "blah . blah".
After the fix it's "blah.blah", as expected.

In fact, the fix has always been there, but commented out
on the initial import of The Artwork.

--- a/sys/src/cmd/cpp/macro.c
+++ b/sys/src/cmd/cpp/macro.c
@@ -499,7 +499,7 @@
 			error(ERROR, "Stringified macro arg is too long");
 			break;
 		}
-		if (tp->wslen /* && (tp->flag&XPWS)==0 */)
+		if (tp->wslen && (tp->flag&XPWS)==0)
 			*sp++ = ' ';
 		for (i=0, cp=tp->t; i<tp->len; i++) {	
 			if (instring && (*cp=='"' || *cp=='\\'))