Skip to content

Test matrix of C-spec versions in CI#16564

Open
jakelishman wants to merge 2 commits into
Qiskit:mainfrom
jakelishman:c/ci-version-matrix
Open

Test matrix of C-spec versions in CI#16564
jakelishman wants to merge 2 commits into
Qiskit:mainfrom
jakelishman:c/ci-version-matrix

Conversation

@jakelishman

Copy link
Copy Markdown
Member

We run most C tests with the defaults set in CMake (which should reflect our minimum version required), but we still want coverage of other common versions people might build against, especially since our header files have conditional defines based on version.

Built on #16562.

AI/LLM disclosure

  • I didn't use LLM tooling, or only used it privately.
  • I used the following tool to help write this PR description:
  • I used the following tool to generate or modify code:

@jakelishman
jakelishman requested a review from a team as a code owner July 10, 2026 14:34
@jakelishman
jakelishman requested a review from mtreinish July 10, 2026 14:34
@jakelishman jakelishman added type: qa Issues and PRs that relate to testing and code quality stable backport potential Make Mergify open a backport PR to the most recent stable branch on merge. Changelog: None Do not include in the GitHub Release changelog. C API Related to the C API labels Jul 10, 2026
@qiskit-bot

Copy link
Copy Markdown
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@jakelishman jakelishman added the on hold Can not fix yet label Jul 10, 2026
@jakelishman
jakelishman force-pushed the c/ci-version-matrix branch 2 times, most recently from 7345a65 to 5cbd452 Compare July 10, 2026 14:52
Our `CMakeLists.txt` file was previously leaving this undefined, and so
using the defaults of whatever build tool came along.  This could mean
that newer toolchains would build in different modes, and thus see
different behaviours.  Here, we set the test defaults to match exactly
Qiskit's minimum C compiler requirements without extensions.

This recently occurred for Qiskit v2.5, where the bump to
`cbindgen==0.29.3`[^1] changed the behaviour of fixed-width `enum`
exports to use the new C23 / C++-like `enum X : <ty>` syntax, gated on
the reported language-spec[^2].  Recent `gcc` (15+) default to
`-std=gnu23`, so packagers for recent Linux distros saw new build
failures in the C test suite that were uncaught by CI[^3].

A follow-up commit can modify our CI to explicitly test a range of C
language versions.

[^1]: 3e8d124: Bump cbindgen from 0.29.2 to 0.29.3 (Qiskit#16300)
[^2]: mozilla/cbindgen@b16c1d2025: Use C++ fixed-type enumeration syntax under C23 (or higher) as well
[^3]: Qiskit#16555
We run most C tests with the defaults set in CMake (which should reflect
our minimum version required), but we still want coverage of other
common versions people might build against, especially since our header
files have conditional defines based on version.
@jakelishman
jakelishman force-pushed the c/ci-version-matrix branch from 5cbd452 to e30ab94 Compare July 10, 2026 15:54
@jakelishman

Copy link
Copy Markdown
Member Author

cc @iyanmv: between this PR and its logical parents #16562 and #16561, hopefully this should address the packaging concerns, and do our best to avoid later regressions in them. I was able to reproduce several similar failures to what you were seeing on an Arch box without these PRs, and checked that it's now fixed. The default for make ctest is now to build with the minimum required C spec version, but the test matrix expands coverage to -std flags (c, gnu) * (11, 23) with whatever gcc we're getting on the ubuntu-latest image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C API Related to the C API Changelog: None Do not include in the GitHub Release changelog. on hold Can not fix yet stable backport potential Make Mergify open a backport PR to the most recent stable branch on merge. type: qa Issues and PRs that relate to testing and code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants