Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix MSVC /clr builds #2179

Merged
merged 1 commit into from
Mar 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,18 @@ FMT_END_NAMESPACE
// __builtin_clz and __builtin_clzll, so only define FMT_BUILTIN_CLZ using the
// MSVC intrinsics if the clz and clzll builtins are not available.
#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && \
!defined(FMT_BUILTIN_CTZLL) && !defined(_MANAGED)
!defined(FMT_BUILTIN_CTZLL)
FMT_BEGIN_NAMESPACE
namespace detail {
// Avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning.
# ifndef __clang__
# if !defined(__clang__)
# pragma managed(push, off)
# pragma intrinsic(_BitScanForward)
# pragma intrinsic(_BitScanReverse)
# endif
# if defined(_WIN64) && !defined(__clang__)
# pragma intrinsic(_BitScanForward64)
# pragma intrinsic(_BitScanReverse64)
# if defined(_WIN64)
# pragma intrinsic(_BitScanForward64)
# pragma intrinsic(_BitScanReverse64)
# endif
# endif

inline int clz(uint32_t x) {
Expand Down Expand Up @@ -270,6 +271,9 @@ inline int ctzll(uint64_t x) {
return static_cast<int>(r);
}
# define FMT_BUILTIN_CTZLL(n) detail::ctzll(n)
# if !defined(__clang__)
# pragma managed(pop)
# endif
} // namespace detail
FMT_END_NAMESPACE
#endif
Expand Down