From e1ace703fbf4458d9e887ebf30050b1a0482a2d2 Mon Sep 17 00:00:00 2001 From: Gil Date: Wed, 11 Jul 2018 15:27:50 -0700 Subject: Fix Firestore source errors under VS2017 (#1515) * Project file updates from sync_project.rb * Fix misc compile errors under VS2017 * Fix util/hashing under VS2017 std::hash is not just a pass through in Microsoft's STL. * Disable unsafe code warnings in VS2017 ... where comparing against a reference implementation that has no easy safe equivalent. * Handle drive letters in paths on Windows --- .../core/src/firebase/firestore/util/hard_assert.h | 34 +++++++++++++--------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'Firestore/core/src/firebase/firestore/util/hard_assert.h') diff --git a/Firestore/core/src/firebase/firestore/util/hard_assert.h b/Firestore/core/src/firebase/firestore/util/hard_assert.h index e60d71a..7b66f33 100644 --- a/Firestore/core/src/firebase/firestore/util/hard_assert.h +++ b/Firestore/core/src/firebase/firestore/util/hard_assert.h @@ -21,6 +21,12 @@ #include "Firestore/core/src/firebase/firestore/util/string_format.h" +#if defined(_MSC_VER) +#define FIRESTORE_FUNCTION_NAME __FUNCSIG__ +#else +#define FIRESTORE_FUNCTION_NAME __PRETTY_FUNCTION__ +#endif + /** * Fails the current function if the given condition is false. * @@ -30,14 +36,14 @@ * @param format (optional) A format string suitable for util::StringFormat. * @param ... format arguments to pass to util::StringFormat. */ -#define HARD_ASSERT(condition, ...) \ - do { \ - if (!(condition)) { \ - std::string _message = \ - firebase::firestore::util::StringFormat(__VA_ARGS__); \ - firebase::firestore::util::internal::Fail( \ - __FILE__, __PRETTY_FUNCTION__, __LINE__, _message, #condition); \ - } \ +#define HARD_ASSERT(condition, ...) \ + do { \ + if (!(condition)) { \ + std::string _message = \ + firebase::firestore::util::StringFormat(__VA_ARGS__); \ + firebase::firestore::util::internal::Fail( \ + __FILE__, FIRESTORE_FUNCTION_NAME, __LINE__, _message, #condition); \ + } \ } while (0) /** @@ -48,12 +54,12 @@ * @param format A format string suitable for util::StringFormat. * @param ... format arguments to pass to util::StringFormat. */ -#define HARD_FAIL(...) \ - do { \ - std::string _failure = \ - firebase::firestore::util::StringFormat(__VA_ARGS__); \ - firebase::firestore::util::internal::Fail(__FILE__, __PRETTY_FUNCTION__, \ - __LINE__, _failure); \ +#define HARD_FAIL(...) \ + do { \ + std::string _failure = \ + firebase::firestore::util::StringFormat(__VA_ARGS__); \ + firebase::firestore::util::internal::Fail( \ + __FILE__, FIRESTORE_FUNCTION_NAME, __LINE__, _failure); \ } while (0) /** -- cgit v1.2.3