Skip to content

Commit 25e724d

Browse files
authored
firestore_exceptions.h: remove dependency on absl to set FIRESTORE_HAVE_EXCEPTIONS (#14442)
1 parent fcfe7b7 commit 25e724d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Firestore/core/src/util/firestore_exceptions.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,24 @@
2727

2828
#include "Firestore/core/include/firebase/firestore/firestore_errors.h"
2929

30+
#if defined(__ANDROID__)
31+
// The firebase-cpp-sdk has issues compiling Abseil on Android in some cases;
32+
// therefore, use `__EXCEPTIONS`, which is known to be set by clang in Android
33+
// NDK r21e, instead of using `ABSL_HAVE_EXCEPTIONS`. In the future, consider
34+
// using `__cpp_exceptions` instead, as the internet seems to suggest that it
35+
// is more reliable with modern c++ compilers, such as those in NDK r21e.
36+
#if __EXCEPTIONS
37+
#define FIRESTORE_HAVE_EXCEPTIONS 1
38+
#endif
39+
40+
#else // !defined(__ANDROID__)
41+
// On any other supported platform, just take Abseil's word for it.
3042
#include "absl/base/config.h"
3143

3244
#if ABSL_HAVE_EXCEPTIONS
3345
#define FIRESTORE_HAVE_EXCEPTIONS 1
3446
#endif
47+
#endif // defined(__ANDROID__)
3548

3649
namespace firebase {
3750
namespace firestore {

0 commit comments

Comments
 (0)