Skip to content
This repository was archived by the owner on Aug 20, 2026. It is now read-only.

fix: add the missing #pragma once to every unguarded header - #48

Merged
balbasty merged 1 commit into
mainfrom
claude/cuda-impl-include-guards
Aug 18, 2026
Merged

fix: add the missing #pragma once to every unguarded header#48
balbasty merged 1 commit into
mainfrom
claude/cuda-impl-include-guards

Conversation

@balbasty

Copy link
Copy Markdown
Contributor

What

Eight of this repo's twelve headers had neither an include guard nor a #pragma once. This adds #pragma once to each, matching the four that already have it.

The audit

Checked every header rather than assuming:

headerbefore
distance_euclidean.hguarded
distance_l1.hguarded
distance_mesh.hguarded
utils.hguarded
distance_spline.hunguarded
posdef.hunguarded
pushpull.hunguarded
reg_field.hunguarded
reg_flow.hunguarded
resize.hunguarded
restrict.hunguarded
splinc.hunguarded

Unlike the umbrella headers over in kernels, none of these eight is a thin re-export — every one carries real code (88 to 2519 non-comment lines), so a second inclusion is a hard redefinition error, not a harmless no-op.

The defect is latent today only because each header happens to be included exactly once, from its matching cuda-lib translation unit. Any future header pulling in two of them, or one TU including a header both directly and transitively, breaks the build for no reason worth debugging.

Convention

The four already-guarded headers all open with a bare #pragma once on line 1 — no #ifndef macro-name convention exists in this repo — so that is what the other eight now use.

Verification

  • No functional change: each file gains exactly one line, nothing else. git diff --summary shows no mode changes and no content edits beyond the eight added lines.
  • Re-audited after the change: all 12 headers now open with #pragma once.
  • Compile+link gate: make -C . -j2 CXX=clang++ CXXFLAGS="-std=c++14 -O1" on fastfields-cuda-lib against this branch (the repo's CI invocation — there is no GPU in CI, so compile+link is the accepted bar for this layer).

🤖 Generated with Claude Code

https://claude.ai/code/session_016AjQcY78NgbagPSbPJRr6Z


Generated by Claude Code

Eight of this repo's twelve headers had neither an include guard nor a
`#pragma once`: distance_spline.h, posdef.h, pushpull.h, reg_field.h,
reg_flow.h, resize.h, restrict.h and splinc.h. Unlike the umbrella headers
in `kernels`, all eight contain real code (88-2519 non-comment lines each),
so a second inclusion would be a hard redefinition error rather than a
harmless no-op.
The defect is currently masked only because each of these is included
exactly once, from its matching cuda-lib translation unit. Any future header
that pulls in two of them -- or a single TU that includes one both directly
and transitively -- would break the build for no good reason.
distance_euclidean.h, distance_l1.h, distance_mesh.h and utils.h already
open with `#pragma once`; this just makes the other eight match.
No functional change: each file gains one line and nothing else.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AjQcY78NgbagPSbPJRr6Z
@github-actions

Copy link
Copy Markdown

Submodule staleness (non-blocking -- fastfields-lib#15)

submodulepinned committracksstatusbehind by
kernels3e38c85fastfields/fastfields-kernels@mainbehind2

@balbasty
balbasty merged commit 5c68cf9 into mainAug 18, 2026
5 checks passed
@balbasty
balbasty deleted the claude/cuda-impl-include-guards branch August 18, 2026 15:10
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@balbasty@claude