Skip to content

Commit 3c0ee89

Browse files
Fix compiler detection with clang-cl (#5816)
* Fix compiler detection with clang-cl * Follow review suggestion
1 parent 6e0d1c2 commit 3c0ee89

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

include/pybind11/detail/pybind11_namespace_macros.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@
1616
// possible using these macros. Please also be sure to push/pop with the pybind11 macros. Please
1717
// only use compiler specifics if you need to check specific versions, e.g. Apple Clang vs. vanilla
1818
// Clang.
19-
#if defined(_MSC_VER)
20-
# define PYBIND11_COMPILER_MSVC
21-
# define PYBIND11_PRAGMA(...) __pragma(__VA_ARGS__)
22-
# define PYBIND11_WARNING_PUSH PYBIND11_PRAGMA(warning(push))
23-
# define PYBIND11_WARNING_POP PYBIND11_PRAGMA(warning(pop))
24-
#elif defined(__INTEL_COMPILER)
19+
#if defined(__INTEL_COMPILER)
2520
# define PYBIND11_COMPILER_INTEL
2621
# define PYBIND11_PRAGMA(...) _Pragma(#__VA_ARGS__)
2722
# define PYBIND11_WARNING_PUSH PYBIND11_PRAGMA(warning push)
@@ -36,6 +31,11 @@
3631
# define PYBIND11_PRAGMA(...) _Pragma(#__VA_ARGS__)
3732
# define PYBIND11_WARNING_PUSH PYBIND11_PRAGMA(GCC diagnostic push)
3833
# define PYBIND11_WARNING_POP PYBIND11_PRAGMA(GCC diagnostic pop)
34+
#elif defined(_MSC_VER) // Must be after the clang branch because clang-cl also defines _MSC_VER
35+
# define PYBIND11_COMPILER_MSVC
36+
# define PYBIND11_PRAGMA(...) __pragma(__VA_ARGS__)
37+
# define PYBIND11_WARNING_PUSH PYBIND11_PRAGMA(warning(push))
38+
# define PYBIND11_WARNING_POP PYBIND11_PRAGMA(warning(pop))
3939
#endif
4040

4141
#ifdef PYBIND11_COMPILER_MSVC

0 commit comments

Comments
 (0)