Skip to content

ENH: Give the cifti tools' gopt internal linkage - #118

Merged
hjmjohnson merged 1 commit into
masterfrom
pr/fix-missing-variable-declarations
Nov 14, 2026
Merged

hjmjohnson merged 1 commit into
masterfrom
pr/fix-missing-variable-declarations

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

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

Base: master. Independent: nothing has to land before it.

Commits
  • ENH: Give the cifti tools' gopt internal linkage

Ordering for all the re-submitted work is tracked in #84.

@hjmjohnson
hjmjohnson marked this pull request as ready for review September 24, 2026 12:18
afni_xml_tool.c and cifti_tool.c each define a file-scope `opts_t gopt`
with external linkage, so the two share a symbol name and neither
declares it in a header.  Each is used only inside its own translation
unit, always by address.

Both files build executables rather than libraries, so `static` removes
nothing from any shared library's exported symbols.

Clears both -Wmissing-variable-declarations warnings.

(cherry picked from commit a2d3b5c)
@hjmjohnson
hjmjohnson force-pushed the pr/fix-missing-variable-declarations branch from 7c7cb01 to c7267fa Compare October 6, 2026 14:34

@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: Approve

Verified that gopt is strictly file-local to the afni_xml_tool and cifti_tool executables (neither linked into libcifti nor referenced outside each .c file; zero shared-library ABI impact) and remains zero-initialized static storage as before. This brings Clang's -Wmissing-variable-declarations count across the entire tree from 2 down to 0!

Comment thread cifti/afni_xml_tool.c Resolved
Comment thread cifti/cifti_tool.c Resolved
@hjmjohnson
hjmjohnson merged commit 4d7d7cb into master Nov 14, 2026
4 checks passed
@hjmjohnson
hjmjohnson deleted the pr/fix-missing-variable-declarations branch November 14, 2026 14:44
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