more m4p bugs
Eric Blake <[email protected]> Fri, 16 May 2025 08:16:24 -0500
| Newsgroups | gmane.comp.gnu.m4.general |
|---|---|
| Message-ID | <7netizftygwdlc7ejxfbn27vltjez4k6ksnf2da3yrsryh2w6k@ydt5o2juak5i> |
Since you continue to patch things as fast as I report them (now testing with commit a4cc0f3c): * m4p is not draining diversions at zero-arg undivert, but saving them till EOF (and m4exit is correctly skipping the implicit undivert that otherwise happens at EOF): $ m4 divert(1)a divert(2)b divert undivert. b a . m4exit $ m4p divert(1)a divert(2)b divert undivert. . m4exit * m4p is not allowing undivert to take multiple arguments: $ m4 divert(1)1divert(2)2divert undivert(2,1) 21 $ m4p divert(1)1divert(2)2divert undivert(2,1) m4:stdin:2: Warning: excess arguments to builtin `undivert' ignored 2 * While modulo math works for +, -, *, and you've already fixed some bugs for / and %, there are other cases where doing math wide and truncating only later still shows observable differences: $ m4 eval(0x80000000%3) eval(1<<31>>1) -2 -1073741824 $ m4p eval(0x80000000%3) eval(1<<31>>1) 2 1073741824 But you're in good company: bsd-m4 from https://github.com/chimera-linux/bsdm4.git claims to try and be GNU compatible, but has its own quirks in this area: $ m4-bsd eval(0x80000000%3) m4: numeric overflow in expr: -2 eval(1<<31) -"" and in general, since C17 says that many aspects of shifting a signed integer when the sign bit is involved are undefined, your implementation may still manage to comply with current POSIX. * Your latest tweaks to builtins being aliased is still not right: $ m4 dumpdef(`defn') defn: <defn> define(`a', defn(`defn'))dnl dumpdef(`a') a: <defn> dumpdef(a) a: <defn> $ m4p dumpdef(`defn') defn: <defn> define(`a', defn(`defn'))dnl dumpdef(`a') m4:stdin:4: undefined macro `' dumpdef(a) a: <a> -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org