COMP: Fix GCC warnings in ITK proxTV build - #1
Draft
hjmjohnson wants to merge 3 commits into
Draft
Conversation
Wrap the OpenMP work-sharing directives in #ifdef _OPENMP and the MSVC #pragma warning suppressions in #ifdef _MSC_VER so GCC/Clang builds without OpenMP no longer emit -Wunknown-pragmas.
Use size_t loop counters against size_t bounds in the 2D Douglas-Rachford column/row passes, cast the segment/interior bounds in the taut-string solver, and split the NORM macro's trailing statement onto its own line.
Reject n < 2 in more_TV2/morePG_TV2 and npen < 1 in PD_TV/PDR_TV before the dependent memcpy/calloc sizes are computed, so the signed-to-size_t size arguments can no longer be a huge value (-Wstringop-overflow, -Walloc-size-larger-than).
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.
Clears all GCC warnings emitted when ITK builds proxTV (OpenMP intentionally not linked). Targets the
for/itk-proxtv-3.3.0-69062fe5integration branch that ITK consumes. All changes are behavior-preserving for valid inputs; the TotalVariation/ProxTV image-filter tests pass.Warnings fixed
-Wunknown-pragmas#ifdef _OPENMPand MSVC#pragma warningbehind#ifdef _MSC_VER, so builds without OpenMP no longer warn-Wsign-comparesize_tloop counters againstsize_tbounds in the 2D Douglas–Rachford column/row passes (TV2Dopt,TV2DWopt); cast the segment/interior bounds in the taut-string solver (TVL1opt_tautstring)-Wmisleading-indentationNORMmacro's trailing statement onto its own continuation line (TVL2opt)-Wstringop-overflow=/-Walloc-size-larger-than=n >= 2(more_TV2,morePG_TV2) andnpen >= 1(PD_TV,PDR_TV) at entry, so the dependentmemcpy/callocsizes can no longer be a signed-to-size_thuge valueNotes
#ifdef _OPENMPguards keep the OpenMP directives active in OpenMP-enabled builds and inert (no-Wunknown-pragmas) when OpenMP is not linked, which is ITK's configuration.n < 2/npen < 1the solver now setsinfo[INFO_RC] = RC_ERRORand returns instead of computing an underflowed size. Valid problems (n >= 2,npen >= 1) are unaffected.