bug in PD m4 macro processor +fix
Bernard Sieloff
bs at sbsvax.UUCP
Fri Jul 8 04:07:03 AEST 1988
I'm posting this for W.Ruelling's Research Group in our house.
They detected and fixed the following bug in the PD M4 macro processor
(originally posted to comp.sources.unix Vol.13 Issue 38/39 12.Feb.88).
Description:
There is a bug in PD-m4's management of parameters of macros.
The separating comma will only be recognized in macro declarations
of the *first level*.
Repeat-by:
construction of 2nd level macros, e.g.
changequote(@,%)
dnl -----------------------
define(@a%,$1+$2=$3)dnl()
define(@b%,$3=$1+$2)dnl()
define(@c%,$1($2,$3,$4))
dnl -----------------------
c(@a%, at alpha%, at beta%, at gamma%)
c(@b%, at alpha%, at beta%, at gamma%)
You will get as m4's output:
alphabetagamma+=
=alphabetagamma+
instead of the (correct) output:
alpha+beta=gamma
gamma=alpha+beta
Fix: (modification of main.c)
cd to your PD-m4 source directory. Feed this posting to
Larry Wall's patch program.
Index: main.c
*** main.c.old Thu Jun 30 19:38:00 1988
--- main.c Wed Jul 6 15:58:12 1988
***************
*** 374,377 ****
--- 374,378 ----
pushs(ep);
}
+ else {chrsave(',');}
break;
default:
--
Bernard Sieloff | UUCP: ...!uunet!unido!sbsvax!bs
Universitaet des Saarlandes | or bs at sbsvax.UUCP
FB 10 - Informatik (Dept. of CS) | CSNET: bs%sbsvax.uucp at Germany.CSnet
Bau 36, Im Stadtwald 15 | ARPA: bs%sbsvax.uucp at uunet.UU.NET
D-6600 Saarbruecken 11, W. Germany | Phone: +49 681 302 2434
More information about the Comp.sources.bugs
mailing list