COMP: Supress warning in MSVC for non-float complex#3897
Conversation
|
Thanks @blowekamp Can you please add this |
|
@N-Dekker I was just addressed warning I saw on the SimpleITK dashboard. I was unsure if the definition needed to occur at before the point of template instantiation/usage or before the header include. Are you able to verify if this approach takes care of the warnings in MSVC? |
|
I changed my |
|
I'm not sure, maybe we should add |
|
I just kicked of a build manually. Hopefully I got the settings right, so this will be tested. |
If a project is using these deprecated std::complex types, IHMO they should get the warning as an indication they may get undefined behavior from their compiler. However, when compiling ITK we want to suppress the warning. IMHO that is the goal here, so that could be a "private" define for the project. |
|
The build is finished. It doesn't have any warnings. Aaaand I just figured out why. This build is done using VS2017, and VS2022 has introduced the warning. |
|
I have changed my dashboard build configuration to use multiple versions of Visual Studio. It should be exercised overnight. |
|
Here are the warnings. A sample: |
|
This PR will silence many of the warnings. But definitely not the ones coming from |
|
OK, so the define before template instantiation was successful to suppress the warning. It is preferred to add the define in the code or as private properties for compiler flags? |
|
I don't have a preference for this. |
8cdeffe to
bf52233
Compare
bf52233 to
3a9c762
Compare
Moved each `_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING` macro definition upward, placing it before the very first `#include` statement. Fixes Visual C++ 2022/C++17 warnings like: > warning C4996: 'std::complex<char>::complex': warning STL4037: The effect of instantiating the template std::complex for any type other than float, double, or long double is unspecified. You can define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING to suppress this warning. Follow-up to pull request InsightSoftwareConsortium#3897 commit 3a9c762 "COMP: Supress warning in MSVC for non-float complex"
Moved each `_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING` macro definition upward, placing it before the very first `#include` statement. Fixes Visual C++ 2022/C++17 warnings like: > warning C4996: 'std::complex<char>::complex': warning STL4037: The effect of instantiating the template std::complex for any type other than float, double, or long double is unspecified. You can define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING to suppress this warning. Follow-up to pull request InsightSoftwareConsortium#3897 commit 3a9c762 "COMP: Supress warning in MSVC for non-float complex"
Moved each `_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING` macro definition upward, placing it before the very first `#include` statement. Fixes Visual C++ 2022/C++17 warnings like: > warning C4996: 'std::complex<char>::complex': warning STL4037: The effect of instantiating the template std::complex for any type other than float, double, or long double is unspecified. You can define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING to suppress this warning. Follow-up to pull request InsightSoftwareConsortium#3897 commit 3a9c762 "COMP: Supress warning in MSVC for non-float complex"
Moved each `_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING` macro definition upward, placing it before the very first `#include` statement. Fixes Visual C++ 2022 warnings like: > warning C4996: 'std::complex<char>::complex': warning STL4037: The effect of instantiating the template std::complex for any type other than float, double, or long double is unspecified. You can define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING to suppress this warning. Follow-up to pull request InsightSoftwareConsortium#3897 commit 3a9c762 "COMP: Supress warning in MSVC for non-float complex"
Moved each `_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING` macro definition upward, placing it before the very first `#include` statement. Fixes Visual C++ 2022 warnings like: > warning C4996: 'std::complex<char>::complex': warning STL4037: The effect of instantiating the template std::complex for any type other than float, double, or long double is unspecified. You can define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING to suppress this warning. Follow-up to pull request #3897 commit 3a9c762 "COMP: Supress warning in MSVC for non-float complex"
PR Checklist
Refer to the ITK Software Guide for
further development details if necessary.