16 compilation error using clang on mac - #17
Open
mmodat wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
Forgot to mention, the downloading of Eigen is also broken as it pulled from cmicdev at the time. I left it has it is and pointed cmake to the version in niftyreg/third-party. |
Contributor
Author
|
@mjorgecardoso Up! |
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 Clang/C++17 compilation on macOS, plus static-analysis fixes and warning cleanup.
I ended up running cppcheck :)
@mjorgecardoso some these changes change output, please have a glance
Compilation fixes
registerstorage-class specifier throughout seg-lib/seg-apps (rejected by recent Clang on macOS).sprintfwith boundedsnprintf(22 call sites).cmake_minimum_required(VERSION 3.10)beforePROJECT(), drop conflicting 2.8/3.0.2 declarations, set CMP0135 when available.Bug fixes found by static analysis (cppcheck 2.13, g++ -Wall -Wextra)
PatchMatchResult*pointers (i.e. heap addresses) instead of dereferencing to the overloaded ANN-distance comparisons, so KNN results were effectively unsorted (_seg_PatchMatch.cpp::sortResults). 😱vector::reserve()as if it wereresize(), writing into size-0 vectors (undefined behavior).buffer(), which pulled from never-copied fields; they now copy all members directly.x > p && x < p) disabled second-best-class tracking in the partial-volume fractional-content step; corrected to compare against the best-class probability.iter>0guard.Hardening
seg_PatchMatch,seg_fill_lesions,seg_fill_lesions_other,seg_EMconstructors and copy operations; value-initialize thePriors_temppointer array in seg_EM.seg_EMandseg_LabFusion(they own raw allocations; shallow copies would double-free).std::string/std::vector<std::string>parameters by const reference.