Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

charris
Copy link
Member

@charris charris commented Sep 26, 2023

Backport of #24762.

  • BUG: Fix order of Windows OS detection macros.

    • The order should be __MINGW32__/__MINGW64__, then _WIN64, and then _WIN32.

      64 bit MinGW compilers define _MINGW32__, __MINGW64__, _WIN32, and _WIN64. 32 bit MinGW compilers define __MINGW32__, and _WIN32. 64 bit MSVC compilation defines _WIN32 and _WIN64. 32 bit MSVC compilation defines _WIN32.

    • Fixes BUG: Order of OS detection macros (for Windows) seems faulty #24761.

  • Adjust the structure slightly and add comments.

    • This is better than just relying on the order of evaluation in the whole chain. Once Windows is detected (_WIN32), handle the possible known Windows environments separately.
  • Remove check for non-standard macros.

    • WIN32, __WIN32__, WIN64, __WIN64__ are not standard macros defined by Window compilers.

      It should be enough to check for _WIN32 and _WIN64 alone.

* BUG: Fix order of Windows OS detection macros.

  - The order should be `__MINGW32__/__MINGW64__`, then `_WIN64`,
    and then `_WIN32`.

    64 bit MinGW compilers define `_MINGW32__`, `__MINGW64__`, `_WIN32`, and `_WIN64`.
    32 bit MinGW compilers define `__MINGW32__`, and `_WIN32`.
    64 bit MSVC compilation defines `_WIN32` and  `_WIN64`.
    32 bit MSVC compilation defines `_WIN32`.

  - Fixes numpy#24761.

* Adjust the structure slightly and add comments.

  - This is better than just relying on the order of evaluation in the whole
    chain. Once Windows is detected (`_WIN32`), handle the possible known
    Windows environments separately.

* Remove check for non-standard macros.

  - `WIN32`, `__WIN32__`, `WIN64`, `__WIN64__` are not standard macros defined
    by Window compilers.

    It should be enough to check for `_WIN32` and `_WIN64` alone.
@charris charris added 00 - Bug 08 - Backport Used to tag backport PRs labels Sep 26, 2023
@charris charris added this to the 1.26.1 release milestone Sep 26, 2023
@charris charris merged commit 3dec661 into numpy:maintenance/1.26.x Sep 26, 2023
@charris charris deleted the backport-24762 branch September 26, 2023 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug 08 - Backport Used to tag backport PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants