solaris doesn't have regexp() macro, nor patpsubst(), nor the rest of macros added so that obsd m4 could be used for autoconf
On Tue, Oct 25, 2011 at 7:23 AM, Raimo Niskanen <[email protected]> wrote: > On Tue, Oct 25, 2011 at 10:35:53AM +0100, Stuart Henderson wrote: >> Thanks for the analysis and diff. >> >> As I'm sure you noticed, OpenBSD m4 has a GNU-compatible mode (-g), >> and the standard POSIX mode; this diff changes behaviour in both. >> >> Does anyone reading have another m4 implementation (esp. solaris) >> handy to test what that does with test.m4? (I'm wondering whether it >> should just be restricted to -g or applied everywhere). > > Is this what you asked for? > > $ cat test.m4 > divert(0)A regexp(` > C', `^C', `B')D > > > > $ uname -a > SunOS anonymous 5.8 Generic_117350-49 sun4u sparc SUNW,Sun-Blade-1500 > > $ /usr/ccs/bin/m4 test.m4 > A regexp( > C, ^C, B)D > > $ /usr/xpg4/bin/m4 test.m4 > A regexp( > C, ^C, B)D > > > > $ uname -a > Sun Microsystems Inc. B SunOS 5.10 B B B Generic January 2005 > > $ /usr/ccs/bin/m4 test.m4 > A regexp( > C, ^C, B)D > > $ /usr/xpg4/bin/m4 test.m4 > A regexp( > C, ^C, B)D > >> >> >> On 2011/10/25 08:25, Robert Young wrote: >> > # uname -ap >> > OpenBSD B 4.9 GENERIC.MP#819 amd64 Intel(R) Xeon(R) CPU E5620 @ 2.40GHz >> > # >> > # #From: http://ftp.openbsd.org/pub/OpenBSD/4.9/packages/amd64/m4-1.4.13.tgz >> > # /usr/bin/gm4 --version >> > m4 (GNU M4) 1.4.13 >> > Copyright (C) 2009 Free Software Foundation, Inc. >> > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. >> > This is free software: you are free to change and redistribute it. >> > There is NO WARRANTY, to the extent permitted by law. >> > >> > Written by Rene' Seindal. >> > # >> > >> > let's inspect a sample: >> > test.m4: >> > divert(0)A regexp(` >> > C', `^C', `B')D >> > >> > The output of GNU-M4: >> > # /usr/bin/gm4 test.m4 > test.gnu.c >> > # cat test.gnu.c >> > A BD >> > # >> > >> > The output of BSD-M4: >> > # /usr/bin/m4 -g test.m4 > test.bsd.c >> > # cat test.bsd.c >> > A D >> > # >> > >> > differ: >> > # diff -u test.gnu.c test.bsd.c >> > --- test.gnu.c B Tue Oct 25 07:48:24 2011 >> > +++ test.bsd.c B Tue Oct 25 07:50:06 2011 >> > @@ -1 +1 @@ >> > -A BD >> > +A D >> > # >> > >> > let's fix it: >> > # git diff old master >> > diff --git a/usr/src/usr.bin/m4/gnum4.c b/usr/src/usr.bin/m4/gnum4.c >> > index 5f6568a..b2d6522 100644 >> > --- a/usr/src/usr.bin/m4/gnum4.c >> > +++ b/usr/src/usr.bin/m4/gnum4.c >> > @@ -497,7 +497,7 @@ doregexp(const char *argv[], int argc) >> > B B B B B B B B B B B B pbstr(argv[4]); >> > B B B B } >> > B B B B error = regcomp(&re, mimic_gnu ? twiddle(argv[3]) : argv[3], >> > - B B B B B REG_EXTENDED); >> > + B B B B B REG_EXTENDED|REG_NEWLINE); >> > B B B B if (error != 0) >> > B B B B B B B B exit_regerror(error, &re); >> > >> > # >> > >> > Now they are compatible: >> > # /usr/src/usr.bin/m4/m4 -g test.m4 > test.bsd.patched.c >> > # diff -s test.gnu.c test.bsd.patched.c >> > Files test.gnu.c and test.bsd.patched.c are identical >> > # >> > >> > Consequence of imcompatibility: >> > An error occurs during compiling PostgreSQL: >> > >> > gmake[4]: Entering directory `/tmp/pgxc/git/src/pl/plpgsql/src' >> > /usr/bin/bison -d B -o pl_gram.c gram.y >> > gcc -DPGXC -Wall -Wmissing-prototypes -Wpointer-arith >> > -Wdeclaration-after-statement -Wendif-labels -Wformat-security >> > -fno-strict-aliasing -fwrapv -fpic -DPIC -I. -I. >> > -I../../../../src/include B -c -o pl_gram.o pl_gram.c >> > gram.y: In function 'plpgsql_yyparse': >> > gram.y:875: warning: passing argument 2 of 'tok_is_keyword' from >> > incompatible pointer type >> > ... >> > gram.y:3379: warning: passing argument 2 of 'tok_is_keyword' from >> > incompatible pointer type >> > gmake[4]: *** [pl_gram.o] Error 1 >> > gmake[4]: Leaving directory `/tmp/pgxc/git/src/pl/plpgsql/src' >> > >> > Further reading: >> > http://archives.postgresql.org/pgsql-bugs/2011-10/msg00161.php >> > >> > Thank You! > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB
