COMP: Fix spFactor.c K&R prototypes for C23 compilers (GCC 15+/16)#6437
Conversation
|
| Filename | Overview |
|---|---|
| Modules/ThirdParty/VNL/src/vxl/v3p/netlib/sparse/spFactor.c | Four stale K&R empty-paren block-scope re-declarations replaced with full parameter-typed prototypes matching the existing file-scope static declarations at lines 81-82; no logic change. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[C23 compiler GCC 15 or later] -->|empty parens means void| B[Block-scope re-declaration RealNumber FindBiggestInColExclude]
B -->|conflicting types error| C[Build failure]
D[File-scope static prototype with full parameter list] -->|already correct| E[Block-scope re-declaration updated to match]
E -->|consistent types| F[Builds cleanly under C23]
Reviews (1): Last reviewed commit: "COMP: Give spFactor.c K&R prototypes ful..." | Re-trigger Greptile
|
@hjmjohnson Is there some chance you could fix CI in |
@dzenanz I can work with "claude" and monitor it's efforts :). Almost certainly a low human effort at this point! |
|
The red checks here are infrastructure, not this PR: the release-4.14 Azure pipelines request hosted agent images retired years ago. CI restoration is underway in #6440; once that merges, a re-run/rebase here should go green. |
GCC 15+ (Fedora 42/43/44, GCC 16 locally) defaults to C23, where an empty
() function prototype means (void) instead of K&R unspecified-args. VXL's
bundled netlib v3p/netlib/sparse/spFactor.c carries four block-scope
re-declarations of FindBiggestInColExclude / FindLargestInCol with empty
(), then calls them with arguments, which C23 rejects:
error: too many arguments to function 'FindBiggestInColExclude';
expected 0, have 3
error: conflicting types for 'FindBiggestInColExclude';
have 'RealNumber(void)'
The file already has correct file-scope static prototypes (lines 81-82).
Replace the four stale empty-paren block-scope declarations with the full
signatures so () no longer collapses to (void) under C23. C-only; pure
prototype tightening with no codegen change under pre-C23 compilers.
Verified with gcc 16.1.1: pre-edit reproduces the errors above under
-std=c23, post-edit compiles cleanly with no -std override.
Change-Id: Ia375f3875b239ddf5c292e6772503c96f8b50866
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
de7f0c4 to
d1336ff
Compare
cae3eb9
into
InsightSoftwareConsortium:release-4.14
Problem
GCC 15+ (Fedora 42/43/44, GCC 16 locally) defaults to C23, where an empty
()function prototype means(void)instead of K&R unspecified-args. VXL's bundled netlibv3p/netlib/sparse/spFactor.chas four block-scope re-declarations ofFindBiggestInColExclude/FindLargestInColwith empty(), then calls them with arguments. C23 rejects this:This breaks the ITK build on every C23-default toolchain. Reported downstream in BIC-MNI/minc-toolkit-v2#197, which works around it by forcing
-std=gnu17on ITK's C flags — a build-flag workaround rather than a source fix.Fix
The file already carries correct file-scope
staticprototypes (lines 81-82). Replace the four stale empty-paren block-scope re-declarations with the full signatures so()no longer collapses to(void)under C23. C-only; pure prototype tightening with no codegen change under pre-C23 compilers, and no global-stdoverride required.Validation
With GCC 16.1.1:
gcc -std=c23 -fsyntax-onlyreproduces thetoo many arguments/conflicting typeserrors above-stdoverrideNote: gcc-16 detection in
vcl/vcl_compiler.his already present (VCL_GCC_16, cascade extended through gcc-20 in 4f97f72), so no compiler-detection change is needed.🤖 Generated with Claude Code