Repository navigation
BUG: Fix two configure probes that never worked and remove obsolete ones - #7123
Merged
hjmjohnson merged 6 commits intoNov 6, 2026
Conversation
The probe for a fenv_t member named __cw defines ITK_HAS_STRUCT_FENV_T_CW, but the fegetenv-based floating-point exception code tested ITK_HAS_STRUCT_FENV_T_CONTROL_CW. On an x86 C library that names the member __cw, the build stopped at "Unknown name for 'fenv_t' struct control member".
check_cxx_source_compiles was given "/Od" or "-O0" as the program text, so it always failed, and nothing read its result. Two test directories use ITK_CXX_DISABLE_OPTIMIZATION_FLAG itself, which is unchanged.
<cfenv>, fegetenv, and fesetenv are part of C++11, so every toolchain that can build ITK has them. The fegetenv-based floating-point exception code is reached only on PowerPC and x86 without feenableexcept and is now used there unconditionally. ITK_HAVE_FENV_H was always defined and read by nothing in ITK.
The probe tested only C++11 through C++17 against __cplusplus. On every supported compiler except MSVC it found 201703L; on MSVC __cplusplus stays 199711L, so it found nothing and the older-standard warning in itkConfigure.h could never fire. The value is now ITK's minimum, and the warning reads _MSVC_LANG and uses #pragma message on MSVC.
itkMacro.h has rejected AppleClang older than Xcode 12.4 since 6771697, while the CMake check and the supported-compilers page still said 10.0.0. An older AppleClang now fails at configure time with a clear message instead of at the first ITK header.
The macro was public, so a project that tests it needs to know what to do instead.
hjmjohnson
force-pushed
the
bug-fenv-and-optimization-probes
branch
from
November 6, 2026 01:29
20c079b to
e82c2a0
Compare
hjmjohnson
marked this pull request as ready for review
November 6, 2026 03:21
Contributor
[Medium impact] The PR appears safe to merge; no actionable defects were found.
|
dzenanz
approved these changes
Nov 6, 2026
hjmjohnson
added a commit
to hjmjohnson/ITK
that referenced
this pull request
Nov 6, 2026
MSVC keeps __cplusplus at 199711L unless /Zc:__cplusplus is given, so vendored libraries that test __cplusplus take their C++98 paths under MSVC. Add the flag to ITK_REQUIRED_CXX_FLAGS beside /bigobj, which applies it to ITK's build and to UseITK.cmake clients. clang-cl already reports the right value. Clients built without the flag see the same ITK headers: itkConfigure.h compares _MSVC_LANG on MSVC, which follows /std: either way. Suggested by dzenanz in the review of InsightSoftwareConsortium#7123.
hjmjohnson
added a commit
to hjmjohnson/ITK
that referenced
this pull request
Nov 8, 2026
MSVC keeps __cplusplus at 199711L unless /Zc:__cplusplus is given, so vendored libraries that test __cplusplus take their C++98 paths under MSVC. Add the flag to ITK_REQUIRED_CXX_FLAGS beside /bigobj, which applies it to ITK's build and to UseITK.cmake clients. clang-cl already reports the right value. Clients built without the flag see the same ITK headers: itkConfigure.h compares _MSVC_LANG on MSVC, which follows /std: either way. Suggested by dzenanz in the review of InsightSoftwareConsortium#7123.
hjmjohnson
added a commit
to hjmjohnson/ITK
that referenced
this pull request
Nov 8, 2026
MSVC keeps __cplusplus at 199711L unless /Zc:__cplusplus is given, so vendored libraries that test __cplusplus take their C++98 paths under MSVC. Append the flag to CMAKE_CXX_FLAGS with ITK's warning and optimization flags, so it applies to ITK's own build and is not exported through ITK_REQUIRED_CXX_FLAGS. Clients do not need it: itkConfigure.h compares _MSVC_LANG on MSVC, which follows /std: either way. clang-cl already reports the right value. Suggested by dzenanz in the review of InsightSoftwareConsortium#7123. Co-Authored-By: Bradley Lowekamp <blowekamp@mail.nih.gov>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix two configure probes that never worked, and remove the probes that C++17 or the minimum compilers already guarantee, from the survey in #7120. Folds in #7124, which touched the same floating-point exception code.
Changes, one commit each
BUG:itkFloatingPointExceptions_unix_feenableexcept_using_fegetenv.cxxtestedITK_HAS_STRUCT_FENV_T_CONTROL_CW, but the probe definesITK_HAS_STRUCT_FENV_T_CW. On a C library that names thefenv_tmember__cw, the build reached#error "Unknown name for 'fenv_t' struct control member".COMP:CMake/ITKSetStandardCompilerFlags.cmakepassed/Odor-O0tocheck_cxx_source_compilesas the program text, so it always failed, and nothing readCXX_HAS_DISABLE_OPTIMIZATION_FLAG.ITK_CXX_DISABLE_OPTIMIZATION_FLAGis unchanged.STYLE:Remove thefenv.h,fegetenv, andfesetenvprobes; all three are standard C++11. Thefegetenv-based code, reached only on PowerPC and x86 withoutfeenableexcept, is now used there unconditionally. The publicITK_HAVE_FENV_H, always defined and read by nothing in ITK, is removed.COMP:ITK_COMPILED_CXX_STANDARD_VERSIONis set to201703L. The probe it replaces found201703Leverywhere except MSVC, where__cplusplusstays199711L, so the older-standard warning could never fire there. The warning now reads_MSVC_LANGand uses#pragma messageon MSVC.COMP:CMake andsupported_compilers.mdrequire AppleClang 12.0.0 (Xcode 12.4), matching the guard initkMacro.h.DOC:Migration guide note forITK_HAVE_FENV_H.Behavior changes to review
ITK_HAVE_FENV_His no longer defined. No use was found in 309 downstream repositories.Verification
ITK_HAS_STRUCT_FENV_T_CONTROL_WORD; 742/742ITKCommontests pass, including the floating-point exception, numeric-traits, and math tests.ITKCommonand its test drivers build; 91/91 floating-point, numeric-traits, and math tests pass; an x86_64 macOS target compiles thefegetenvpath.pre-commit run --all-filespasses.__cwmember (glibc uses__control_word, macOS__control).AI assistance
Claude Code (Opus 5.5) surveyed the probes, made the changes, searched the downstream build forest, and ran the local checks. The author reviewed and is responsible for the change.
🤖 Generated with Claude Code