tests: Fix function pointer initialization C89 error in ellswift tests #1837

pull mllwchrry wants to merge 1 commits into bitcoin-core:master from mllwchrry:ellswift-c89-compliance changing 1 files +6 −2
  1. mllwchrry commented at 5:32 pm on March 20, 2026: contributor

    Fixes a C89 pedantic compliance error in src/modules/ellswift/tests_impl.h where function pointer array initialization is not allowed at declaration time.

    This error was exposed while I was testing the improved test coverage in CI. The initial plan was to simplify the configuration of modules in CI by enabling all modules by default and testing the disabling of each module independently.

    Error: src/modules/ellswift/tests_impl.h:442:110: error: initializer element is not computable at load time [-Wpedantic].

    The error occurred when running the x86_64_debian GitHub Actions CI job, which uses GCC 16 (snapshot) with strict flags (-std=c89 -pedantic -pedantic-errors -Werror). See this action run for reference: https://github.com/mllwchrry/secp256k1/actions/runs/23301905657/job/67769464566.

    The fix uses if/else to assign function pointers after declaration, matching the pattern already used in the same file.

    While this is a minor C89 compliance issue, it blocks the potential CI simplification.

  2. tests: Fix C89 function pointer initialization in ellswift tests b84635ed3b
  3. real-or-random added the label tweak/refactor on Mar 23, 2026
  4. real-or-random commented at 12:35 pm on March 23, 2026: contributor

    I was wondering why we hadn’t noticed this earlier. Apparently this happens only with -O0. (Try here)

    “Constant expressions” is a weird corner of C, and this here indeed may depend on how you interpret the C89 standard. Anyway, this issue would go away if we switched to C99 because non-constant expressions would just be allowed there in array initializers.

  5. real-or-random approved
  6. real-or-random commented at 12:35 pm on March 23, 2026: contributor
    utACK b84635ed3b426899c739ef2f58f98dd90bf0179e
  7. theStack approved
  8. theStack commented at 10:43 am on March 25, 2026: contributor
    ACK b84635ed3b426899c739ef2f58f98dd90bf0179e
  9. real-or-random merged this on Mar 25, 2026
  10. real-or-random closed this on Mar 25, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-03-29 14:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me