Branch: refs/heads/main
Revision: 895f1eb9c189b511af9058cc3d5cfc4766677559
Author: bradcray
Link: Update c2chapel to use pycparser 3.0 and pycparserext 2026.1 by bradcray · Pull Request #28915 · chapel-lang/chapel · GitHub
Log Message:
Update c2chapel to use pycparser 3.0 and pycparserext 2026.1 (#28915)
[reviewed by @benharsh]
This updates c2chapel to use pycparser 3.0 and pycparserext 2026.1 now
that the latter has been released.
The simple part of this PR was updating the version numbers in
third-party/chpl-venv/c2chapel-requirements.txt and
tools/c2chapel/Makefile.
The more labor-intensive part was remembering that the fake headers are
parsed and put into a separate category by tools/c2chapel/c2chapel.py,
which needed to be updated because the previous logic was rather
simplistically implemented (by me, I think) to just look for the typedef
patterns that existed in the fake headers at that time, which were
fairly predictable. They've since become a bit more diverse, so here I
generalized the logic for the typical one-liner typedef and then added a
new tailored special case for a single multi-line enum typedef in the
fake headers.
I checked these changes by ensuring that the output generated for
tools/c2chapel/test/sysCTypes.chpl and
tools/c2chapel/test/justC.chpl was the same prior to the fake header
comment and that all other declarations fell into the fake header
section and were strictly additive.
One other unit test needed updating, to reflect the improved error
message produced by pycparser 3.0.
I gave the docs a minor refresh to reflect that pycparser 3.0 claims to
parse all of C99 and some of C11 and to remove the Contributors list,
primarily because it hasn't been maintained, and most of our other tools
don't have such sections.
I considered bumping the version number to 0.2.0 due to these changes,
but doing so requires all of the unit tests, which wasn't that
appealing. Probably the right thing to do is update the little unit
testing script to write out the version number as it runs the tests so
that they're not captured in the git repo, but that was more than I felt
motivated to take on here.
Resolves #28555
Diff:
M doc/rst/tools/c2chapel/c2chapel.rst
M third-party/chpl-venv/c2chapel-requirements.txt
M tools/c2chapel/Makefile
M tools/c2chapel/c2chapel.py
M tools/c2chapel/test/invalidC.chpl
M tools/c2chapel/test/justC.chpl
M tools/c2chapel/test/sysCTypes.chpl
https://github.com/chapel-lang/chapel/pull/28915.diff