Skip to content

Commit b8ba09b

Browse files
authored
Fix bits.h when compiled by MSVC after including <ciso646> (#4836) (#4837)
1 parent c703626 commit b8ba09b

File tree

1 file changed

+18
-0
lines changed
  • Firestore/core/src/firebase/firestore/util

1 file changed

+18
-0
lines changed

Firestore/core/src/firebase/firestore/util/bits.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@
2424

2525
#include <cstdint>
2626

27+
#if _MSC_VER
28+
// The Microsoft implementation of iso646.h defines alternative operator names
29+
// as macros and this interferes with the inline assembly, below, which uses the
30+
// `and` and `xor` instructions. Defining these as macros is conforming behavior
31+
// for C but not C++, where these are keywords.
32+
//
33+
// Unfortunately, fixing this by undefining the macros can't be enabled
34+
// everywhere because other compilers (e.g. Clang) specifically prevent the use
35+
// of these keywords as macro names.
36+
#ifdef and
37+
#undef and
38+
#endif
39+
40+
#ifdef xor
41+
#undef xor
42+
#endif
43+
#endif // _MSC_VER
44+
2745
namespace firebase {
2846
namespace firestore {
2947
namespace util {

0 commit comments

Comments
 (0)