Skip to content

BUG: Parenthesize macro arguments and replacement lists - #122

Open
hjmjohnson wants to merge 1 commit into
pr/fix-extra-semi-stmtfrom
pr/fix-macro-parentheses
Open

hjmjohnson wants to merge 1 commit into
pr/fix-extra-semi-stmtfrom
pr/fix-macro-parentheses

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

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

Base: pr/fix-extra-semi-stmt, not master. It edits the same lines as that
change, so merge that one first.

Commits
  • BUG: Parenthesize macro arguments and replacement lists

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

Clears all 155 bugprone-macro-parentheses findings: 152 in
nifti2/nifti_tool.c, 2 in niftilib/nifti1_tool.c, 1 in fsliolib/fslio.c.

An unparenthesized argument takes the precedence of whatever the caller
passed. NT_FILL(..., rv) expands to `rv = ...` and NT_MAT33_TO_MAT44 to
`m44.m[0][0] = ...`, which break for an argument that is not already a
postfix expression. Every current caller passes a plain identifier, a
literal or `nim->sto_xyz`, so nothing observable moves.

The NT_DCONVERT dtype and stype parameters stay bare behind a NOLINT
fence: they name types, so `(dtype) * pd = dptr;` would be a cast
expression rather than a declaration. FSL_RADIOLOGICAL is in an installed
header, so its replacement list changes from -1 to (-1); its value does not.

(cherry picked from commit dbfb59d)
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