Series 1: maintenance baseline (README, Python 3 default, GitHub Actions CI) by mmatti-sw · Pull Request #197 · davidmalcolm/gcc-python-plugin · GitHub
Skip to content

Series 1: maintenance baseline (README, Python 3 default, GitHub Actions CI) - #197

Open
mmatti-sw wants to merge 4 commits into
davidmalcolm:masterfrom
mmatti-sw:series1-baseline
Open

mmatti-sw wants to merge 4 commits into
davidmalcolm:masterfrom
mmatti-sw:series1-baseline

Conversation

@mmatti-sw

Copy link
Copy Markdown

Sets up the maintenance baseline before any GCC compatibility work.

  • README: document current maintenance baseline — replaces the "GCC 4.6 or later" and "Python 2.7 or 3.2+" claims in README.rst and docs/basics.rst with the current policy: Python 3 is the target, GCC compatibility is established per release, no GCC release is claimed as supported until built and tested, and x86_64 and ppc64le are the intended test platforms.
  • Makefile: default to Python 3 — PYTHON/PYTHON_CONFIG now default to python3/python3-config; command-line overrides still work.
  • CI: replace obsolete Travis configuration — removes .travis.yml, adds one GitHub Actions job (x86_64, ubuntu:22.04 container, GCC 10, Python 3.10).

Testing

  • Makefile: make -pn confirms the new defaults and that command-line overrides still win.
  • README: documentation only, reviewed by eye (reStructuredText not rendered).
  • CI: not yet run. It only runs once pushed here. GCC 10 isn't available on any test machine, so whether the current sources build with GCC 10 + Python 3.10 is unverified — this PR's own CI run is the first test. Only the YAML was checked locally.

Notes for review

  • Patch 1 also edits docs/basics.rst, which repeats the same claims. Remaining docs work (Fedora 16 prebuilt packages, upstream clone URL) is left for later.
  • Python 2 compatibility code and the six dependency are untouched here.
  • The Makefile isn't safe for make -j yet, which is why CI builds serially. Fixed in the next series.
  • Once the GCC 11–16 compatibility series lands, CI moves from GCC 10 to GCC 14/15/16.

Manjunath Matti and others added 4 commits July 17, 2026 12:32
…vents

GCC 12 removed ggc_force_collect in favor of an enum-based ggc_collect()
API.  Python 3.7 made PyEval_InitThreads() a no-op, Python 3.12
deprecated Py_UnbufferedStdioFlag, and Python 3.13+ provides
PyUnicode_AsUTF8 as the public replacement for _PyUnicode_AsString.
GCC 10 added PLUGIN_START_PARSE_FUNCTION, PLUGIN_FINISH_PARSE_FUNCTION,
and PLUGIN_INCLUDE_FILE events that were not yet wired up.

gcc-python-compat.h:
* Guard extern declaration of ggc_force_collect with
  #if (GCC_VERSION < 12000); the variable was removed in GCC 12
  (gcc/ggc-internal.h ChangeLog-2021).

gcc-python-wrapper.c (force_gcc_gc):
* For GCC >= 12, call ggc_collect(GGC_COLLECT_FORCE) instead of
  setting ggc_force_collect and calling ggc_collect().

gcc-python.c (plugin_init):
* Guard Py_UnbufferedStdioFlag assignment with
  #if PY_VERSION_HEX < 0x030c0000; deprecated in Python 3.12.
* Guard PyEval_InitThreads() call with
  #if PY_VERSION_HEX < 0x03070000; no-op since Python 3.7,
  deprecated since Python 3.9.

gcc-python.h:
* For Python >= 3.13, define PyGccString_AsString as PyUnicode_AsUTF8
  (public API) instead of _PyUnicode_AsString (private alias).

gcc-python-callbacks.c:
* Add PyGcc_CallbackFor_PLUGIN_INCLUDE_FILE to pass the included
  filename as a Python string to registered callbacks.
* Wire up PLUGIN_START_PARSE_FUNCTION and PLUGIN_FINISH_PARSE_FUNCTION
  (gcc_data is a tree function decl) using the existing
  PyGcc_CallbackFor_tree handler.
* Wire up PLUGIN_INCLUDE_FILE using the new handler.
  All three events were added in GCC 10.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The README and the Sphinx requirements page still describe the plugin as
supporting GCC 4.6 or later (tested up to GCC 8) and Python 2.7 or 3.2+.
That support is historical: current GCC releases no longer build the
plugin, and Python 2 is long end-of-life.

Document the maintenance baseline instead: Python 3 is the target, GCC
plugin compatibility is established per GCC release, no current GCC
release is claimed as supported until it has been built and tested, and
x86_64 and ppc64le are the intended test platforms.

README.rst:
* Add a "Maintenance status" section.
* Requirements: replace the GCC 4.6+ and Python 2.7/3.2+ claims.  Note
  that the plugin headers must match the exact GCC version, and that the
  plugin is compiled as C++, so the matching C++ compiler is required.
* Usage: replace the x86_64-only note with the intended test platforms.

docs/basics.rst:
* Requirements: same GCC and Python changes as README.rst.
* Build-time dependencies: drop the Python 2 package list; use dnf and
  add gcc-c++.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The Makefile defaults to "python" and "python-config".  Many current
distributions provide neither command, and where they exist they may
refer to Python 2 or to an unintended interpreter.

Default to python3 and python3-config instead.  PYTHON and PYTHON_CONFIG
can still be overridden on the make command line.

Makefile:
* Default PYTHON to python3 and PYTHON_CONFIG to python3-config.
* Update the comment describing the defaults, and drop the commented-out
  python3 example, which is now the default.

docs/basics.rst:
* Describe the new default and how to select another Python 3.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
.travis.yml targets Travis CI's long-retired Ubuntu Precise/Trusty
images, builds with GCC 4.8 through 9, and installs Python 2 packages.

Replace it with a GitHub Actions workflow.  Following the maintenance
plan, start with one reproducible job rather than a large matrix:
Linux x86_64, Python 3 and a single GCC release, in a pinned
ubuntu:22.04 container.

GCC 11 and later do not build the current sources (checked with GCC 11
through 16), so the job uses GCC 10, the release before those API
changes.  Ubuntu 22.04 provides GCC 10 together with Python 3.10; the
test tooling still relies on distutils and configparser.SafeConfigParser,
which Python 3.12 removed.

The job builds the plugin serially, because the Makefile is not yet safe
for parallel builds, checks that GCC loads the plugin, and runs the
cpybuilder and dejagnu selftests.  The main test suite also runs, but
does not fail the job for now, since some tests are expected to fail
with current Python releases.

Further GCC releases and architectures will be added to the matrix as
their compatibility fixes land.

.travis.yml: Remove.

.github/workflows/ci.yml: New file.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant