Skip to content

Avoid warnings in compiler version checks #2781

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

mnijhuis-tos
Copy link
Contributor

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.

@aroffringa aroffringa mentioned this pull request Aug 1, 2024
4 tasks
@aroffringa
Copy link

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.

@aroffringa
Copy link

@JohanMabille can you maybe merge this PR?

@JohanMabille
Copy link
Member

I'll rebase to have the CI run and merge after.

@JohanMabille JohanMabille merged commit ae52796 into xtensor-stack:master Nov 20, 2024
16 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants