|
| From: | Paul Eggert |
| Subject: | Re: gnulib files issue compiling gawk with revived PCC |
| Date: | Mon, 1 May 2023 18:37:15 -0700 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 |
On 2023-04-30 11:28, Aharon Robbins wrote:
This would seem to be due to the expansion of the INT_MULTIPLY_WRAPV macro. I tried following its definition, but got lost in the maze of twisty little ifdefs.
It's gotta be a bug in pcc's preprocessor: it's not expanding that INT_MULTIPLY_WRAPV at all, and is simply erroring out. The attached patches fix this not by tracking the bug down, but by working around it. They change dfa.c to use ckd_mul (i.e., C23 style) instead of INT_MULTIPLY_WRAPV (older Gnulib style). We are gradually changing Gnulib to C23 style anyway, so this change is a win regardless of pcc's bugs.
I found several other problems with pcc and Gnulib as used in Gawk, and made the following changes to Gnulib to port to Ubuntu 23.04 pcc:
* pcc <limits.h> doesn't define MB_LEN_MAX; fixed by <https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=98deb4fad3bdc7986274feebac3f0f8a50fdce0a>.
* pcc -E errors out on INT_MULTIPLY_WRAPV in Gnulib modules that Gawk uses; fixed by <https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=e915c32cc74671a03a4f656bdbbe9b8103a5ff19>, <https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=a1d7a312646ec112140f4a3e112daac2194549df>, and <https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=bdc715b1f7a4eee75214709d4a949bdf65bcc9a2>.
* Even though pcc claims to be GCC 4 and to support C11 extern inline, it doesn't work; fixed by <https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=20022b888d0da7f927fd18cb8f18d78f8ac03107>.
To test the above with Gawk, I propagated recent Gnulib into my copy of Gawk; see attached patches 0001-0010. pcc also mishandled some of Gawk's own code, so I made five changes to Gawk directly; see patches 0010-0015. Patch 0016 simply regenerates all autogenerated files. With all these patches installed Gawk "./configure CC=pcc; make check" works on Ubuntu 23.04 x86-64.
Although these patches may seem large, almost all of them are simply copies from Gnulib, or autogenerated. The parts I wrote by hand are mostly summarized in the attached patch summary.patch, so I suggest looking at that first. summary.patch is meant for human review; the other patches can be slurped into Gawk simply via "git am 0*.patch".
I'll cc this email to bug-gawk as I think Gnulib is now fixed for pcc, and the attached patches are for Gawk not Gnulib.
summary.patch
Description: Text Data
0001-Make-dfa.h-identical-with-Gnulib.patch
Description: Text Data
0002-Sync-extern-inline-attrs-from-Gnulib.patch
Description: Text Data
0003-Sync-xalloc-code-from-Gnulib.patch
Description: Text Data
0004-Sync-limits-h-code-from-Gnulib.patch
Description: Text Data
0005-Sync-mktime.c-from-Gnulib.patch
Description: Text Data
0006-Sync-dynarray-from-Gnulib.patch
Description: Text Data
0007-Sync-regex-from-Gnulib.patch
Description: Text Data
0008-Sync-flexmember-from-Gnulib.patch
Description: Text Data
0009-Sync-assert-h-from-Gnulib.patch
Description: Text Data
0010-Sync-localeinfo.c-from-Gnulib.patch
Description: Text Data
0011-Work-around-pcc-bug.patch
Description: Text Data
0012-Don-t-assume-atexit.patch
Description: Text Data
0013-isinf-and-isnan-are-broken-with-pcc.patch
Description: Text Data
0014-Work-around-pcc-preprocessor-bug.patch
Description: Text Data
0015-Update-update-support.sh-to-match-copies.patch
Description: Text Data
0016-Regenerate-autogenerated-files.patch
Description: Text Data
| [Prev in Thread] | Current Thread | [Next in Thread] |