xtensor icon indicating copy to clipboard operation
xtensor copied to clipboard

Avoid warnings in compiler version checks

Open mnijhuis-tos opened this issue 10 months ago • 2 comments

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.

mnijhuis-tos avatar Apr 17 '24 13:04 mnijhuis-tos