Skip to content

COMP: Fail the build on an undeclared external function - #92

Draft
hjmjohnson wants to merge 2 commits into
masterfrom
ci/missing-declarations
Draft

hjmjohnson wants to merge 2 commits into
masterfrom
ci/missing-declarations

Conversation

@hjmjohnson

@hjmjohnson hjmjohnson commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Re-submission of #81, reverted from master on 2026-09-24 so it can be
reviewed before merging. Content is unchanged from the original.

Base: master. This PR adds two checks (-Werror=missing-declarations and an exported-symbol baseline) that are expected to be red on master until #88, #89 and #90 merge. Run with GCC 16 against this branch, the strict build flags axml_recur_find_xml in afni_xml.c and many functions in fslio.c; on the tip of the full chain (#93) the same build is clean and all 344 tests pass. The exported-symbol job needs cmake/collect_exported_symbols.sh, which comes from #88 and #89. Merge those first, then rebase this onto master.

In git, this branch's two commits are the first two commits of the chain that ends at ci/windows (#93).

Ordering for this stack (as of 2026-11-03)

# PR branch base state
1 #85 ci/install-linking-srcdir master open
2 #86 ci/test-output-on-failure master open
3 #87 ci/guard-cmp0169 ci/test-output-on-failure merged
4 #88 ci/build-all-codepaths master open
5 #89 ci/widen-coverage ci/build-all-codepaths open
6 #90 pr/fix-missing-prototypes master open
7 #91 fix/buildyml-jobs master merged
8 #92 <- this PR ci/missing-declarations master open
9 #93 ci/windows ci/missing-declarations open
10 #94 ci/workflow-trigger-lint ci/windows open

The order is the order these changes sat on master before the revert, so
it is known to build and test at every step. Verified again after
rebuilding the stack: the tip configures, compiles with no errors, and
passes 344/344 tests.

Why this one is stacked rather than independent

Each PR in this chain edits the same few files as its predecessors, chiefly
.github/workflows/cmake-multi-platform.yml, cmake/exported_symbols_linux.txt
and cifti/afni_xml.h. Cherry-picked onto master alone, the later ones
conflict. Two members also carry a build-order dependency rather than a
textual one: without #30 the project does not configure at all on CMake
versions that do not know policy CMP0169, and #29 is needed for
install_linking to find its source directory.

Commits
  • COMP: Give the pigz writers internal linkage
  • COMP: Make an undeclared external function fail the build

See #84 for the ordering of all 49 re-submitted pull requests.

@hjmjohnson
hjmjohnson marked this pull request as ready for review September 24, 2026 12:03
@hjmjohnson
hjmjohnson force-pushed the ci/missing-declarations branch from 5f432d3 to d68c3ff Compare October 6, 2026 14:39
@hjmjohnson
hjmjohnson changed the base branch from fix/buildyml-jobs to master October 6, 2026 14:39
@hjmjohnson
hjmjohnson marked this pull request as draft October 6, 2026 15:02
@hjmjohnson
hjmjohnson force-pushed the ci/missing-declarations branch from d68c3ff to f1c76aa Compare November 3, 2026 22:51
@hjmjohnson

Copy link
Copy Markdown
Member Author

Plain rebase onto master (10 commits behind); both commits are unchanged (git range-diff shows =). Local check: the default build passes 344/344; the strict -Werror=missing-declarations build with GCC 16 still fails here, as described in the body, and passes on the tip of the chain.

Comment thread niftilib/nifti1_io.c Resolved
Comment on lines +74 to +76
# The configuration a downstream project vendoring only the core
# reader selects. Nothing else in the matrix proves the tree still
# configures with the optional subdirectories switched off.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I need more coffee but I just don't grok these words...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hunk is a copy of #89's minimal job, where the comment now reads "The core-reader-only configuration a vendoring project selects." The copy leaves this PR when it is rebased after #89 merges.

# Guards cmake_minimum_required. Every other runner carries a
# recent CMake, so a policy or command that needs a newer release
# than the project claims to support is invisible to them.
# PR #30 was exactly that: CMP0169 does not exist before 3.30 and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't refer to PRs in the code comments, could be confusing vs upsteam vs the ITK fork.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. This is a copy of #89's oldest-cmake job, whose comment no longer names a PR; the copy leaves this PR when it is rebased after #89 merges.

@gdevenyi gdevenyi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Google Carbon

Verdict: Request Changes (Draft; blocked on #90 + #89)

Investigated all 3 failing CI checks and compiler behavior across GCC and Clang:

  1. Root causes of the 3 CI failures:
    • exported symbol baseline fails (cmake/collect_exported_symbols.sh: No such file or directory) because commit f1c76aa bundled the minimal, oldest-cmake (still using Ubuntu's CMake 3.28 instead of #89's 3.10.2), and exported-symbols YAML jobs without cmake/collect_exported_symbols.sh or cmake/exported_symbols_linux.txt (which live in #89).
    • no undeclared external functions (FSLSTYLE=OFF/ON) fails on the 14 undeclared external functions fixed in #90.
  2. Drop commit 9db2f11 (doPigz) on rebase: #90 (026c6cb) already incorporates the doPigz/doPigz2 fix and addresses @seanm's comment by deleting dead doPigz2 in nifti1_io.c instead of #if 0-ing it. Once #90 and #89 merge, rebasing #92 should drop 9db2f11 and the duplicate minimal/oldest-cmake/exported-symbols hunks.
  3. -Werror=missing-declarations is a no-op for C functions on Clang: In C11 mode, Clang ignores -Wmissing-declarations on functions (0 warnings on master!) and requires -Wmissing-prototypes (which works identically on both GCC and Clang). Rather than adding 2 dedicated Ubuntu build jobs, consider promoting -Wmissing-prototypes into cmake/nifti_warnings.cmake's clean set once #90 lands and passing -DCMAKE_C_FLAGS="-Werror=missing-prototypes -Werror=missing-declarations".
  4. Please also address @seanm's open wording comment on the missing-declarations job header.

run: cmake --build ${{ github.workspace }}/build
- name: Collect exported symbols
run: |
bash cmake/collect_exported_symbols.sh \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Google Carbon] minimal (line 73), oldest-cmake (line 101), and exported-symbols (line 128) belong to PR #89 — and exported-symbols fails here because cmake/collect_exported_symbols.sh and cmake/exported_symbols_linux.txt are not on this branch. Please drop lines 73–166 when rebasing onto master after #89 lands.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed; these three jobs are #89's and will be dropped when this PR is rebased onto master after #89 merges.

Comment thread niftilib/nifti1_io.c Resolved
doPigz and doPigz2 are called only from the file that defines them and
appear in no header, so they are internal. Declaring them so is what
lets -Wmissing-declarations be promoted to an error on the FSLSTYLE
path, where they were the only offenders.

The NIFTI-1 library also carried a doPigz2, taking a nifti_1_header
despite its name, byte-identical to doPigz beside it and called from
nowhere. It is removed.

The exported symbol set of the default build is unchanged: this code
compiles only under PIGZ, which FSLSTYLE enables.
-Wmissing-declarations is in the project's warning set but does not
fail the build, so external functions with no declaration in a header
have reached master. This job makes it fatal on both FSLSTYLE
settings, each of which compiles functions the other does not.

-Werror=missing-prototypes is passed too: for C, Clang checks
undeclared functions only under that flag, while GCC checks both.
The full NIFTI_WARNINGS_AS_ERRORS set is still blocked by
-Wmaybe-uninitialized in fslio.c, so this one flag is promoted alone.
@hjmjohnson
hjmjohnson force-pushed the ci/missing-declarations branch from f1c76aa to a1e97ca Compare November 17, 2026 22:38
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.

3 participants