[PATCH] D40285: [MS] AARCH64 cleanup default WIN macros

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 21 00:31:28 PST 2017


mstorsjo added a comment.

> WIN32 and WIN64 are not real definitions they are typically defined by the system headers, _WIN32 and _WIN64 are the compiler definitions.

Almost.

In MSVC, WIN32 and WIN64 are never defined by the compiler, neither by system headers. Project files created by the IDE often contains them set manually though.

GCC on the other hand predefines both `_WIN32` and `WIN32` (and similarly for -64), but only when using the GNU standards additions (which are enabled by default) `x86_64-w64-mingw32-gcc -E -dM - < /dev/null | grep WIN32` does include both, while the unprefixed one vanishes if you add e.g. `-std=c99` (but are still included if you set `-std=gnu99`).

clang on the other hand doesn't check the standards version, but provides both `WIN32` and `_WIN32`. And for the really inconsistent case, with `clang -target x86_64-w64-mingw32 -E -dM - < /dev/null`, you will have `WIN64`, `_WIN64` and `_WIN32`, but no unprefixed `WIN32`.


Repository:
  rL LLVM

https://reviews.llvm.org/D40285





More information about the cfe-commits mailing list