Avoid warnings in compiler version checks by mnijhuis-tos · Pull Request #2781 · xtensor-stack/xtensor
Conversation
GCC 13 may give warnings like:
/home/maik/scratch/schaap/everybeam/include/xtensor/xutils.hpp:33:6: error: "_MSC_VER" is not defined, evaluates to 0 [-Werror=undef]
33 | #if (_MSC_VER >= 1910)
| ^~~~~~~~
In file included from /home/maik/scratch/schaap/everybeam/include/xtensor/xcontainer.hpp:25,
from /home/maik/scratch/schaap/everybeam/include/xtensor/xtensor.hpp:20:
/home/maik/scratch/schaap/everybeam/include/xtensor/xmath.hpp:1077:69: error: "GCC_VERSION" is not defined, evaluates to 0 [-Werror=undef]
1077 | #if (defined(_MSC_VER) && _MSC_VER < 1910) || (defined(__GNUC__) && GCC_VERSION < 49999)
| ^~~~~~~~~~~
This PR avoids these warnings by
- Adding a check if _MSC_VER is defined.
- Avoiding using GCC_VERSION, since checking against GNUC should suffice.
This looks like a nice small PR that would solve already a lot of warnings that I get. Could this PR be merged?
I addressed the same warnings in #2801, as well as a few more, so this PR has a lower threshold to merge. If this gets merged I'll rebase my branch so that it only addresses the warnings not yet covered here.
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