From d270dbe58fdc6c971a9b1d17db47e895ac660259 Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Fri, 7 Jan 2022 15:51:34 -0800 Subject: [PATCH 1/7] add -DNOMINMAX to both WIN32 and WIN64 --- firestore/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firestore/CMakeLists.txt b/firestore/CMakeLists.txt index 4649e4e58b..b3168bee59 100644 --- a/firestore/CMakeLists.txt +++ b/firestore/CMakeLists.txt @@ -347,7 +347,7 @@ add_custom_target( # are guarded by this flag, such as GetUserAgent and function_registry. set(FIREBASE_FIRESTORE_CPP_DEFINES -DINTERNAL_EXPERIMENTAL=1) -if (WIN32 AND NOT ANDROID AND NOT IOS) +if (MSVC AND NOT ANDROID AND NOT IOS) # On Windows, gRPC gives a compiler error in firebase_metadata_provider_desktop.cc # unless _WIN32_WINNT is defined to this value (0x0600, Windows Vista). # Also set -DNOMINMAX for both Firestore and Firestore Core. From e89e0bae05099f65b6376aef1e0a37a546e4dbec Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Mon, 10 Jan 2022 16:23:33 -0800 Subject: [PATCH 2/7] test --- firestore/CMakeLists.txt | 1 + firestore/src/include/firebase/firestore/field_value.h | 1 + 2 files changed, 2 insertions(+) diff --git a/firestore/CMakeLists.txt b/firestore/CMakeLists.txt index b3168bee59..d0332e2561 100644 --- a/firestore/CMakeLists.txt +++ b/firestore/CMakeLists.txt @@ -351,6 +351,7 @@ if (MSVC AND NOT ANDROID AND NOT IOS) # On Windows, gRPC gives a compiler error in firebase_metadata_provider_desktop.cc # unless _WIN32_WINNT is defined to this value (0x0600, Windows Vista). # Also set -DNOMINMAX for both Firestore and Firestore Core. + message("SET -DNOMINMAX for firestore cpp build") set(FIREBASE_FIRESTORE_CPP_DEFINES ${FIREBASE_FIRESTORE_CPP_DEFINES} -D_WIN32_WINNT=0x0600 -DNOMINMAX) # Special handling for the absl time zone library, define _LIBCPP_VERSION on # Windows to avoid the shenanigans they do with Windows mangled symbols to diff --git a/firestore/src/include/firebase/firestore/field_value.h b/firestore/src/include/firebase/firestore/field_value.h index c29757c010..40962b7211 100644 --- a/firestore/src/include/firebase/firestore/field_value.h +++ b/firestore/src/include/firebase/firestore/field_value.h @@ -376,6 +376,7 @@ class FieldValue final { static FieldValue Increment(T by_value) { // Note: Doxygen will run into trouble if this function's definition is // moved outside the class body. + #undef max static_assert( std::numeric_limits::max() <= std::numeric_limits::max(), "The floating point type you provided is larger than can fit in a " From fc56df535f380ab5acefc74d74b7415a7ad5aeea Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Mon, 10 Jan 2022 17:09:42 -0800 Subject: [PATCH 3/7] test --- firestore/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/firestore/CMakeLists.txt b/firestore/CMakeLists.txt index d0332e2561..bbaa394f69 100644 --- a/firestore/CMakeLists.txt +++ b/firestore/CMakeLists.txt @@ -363,6 +363,7 @@ if (MSVC AND NOT ANDROID AND NOT IOS) _LIBCPP_VERSION=99) endif() +message("FIREBASE_FIRESTORE_CPP_DEFINES is ${FIREBASE_FIRESTORE_CPP_DEFINES}") target_compile_definitions(firebase_firestore PRIVATE ${FIREBASE_FIRESTORE_CPP_DEFINES} From 4821b50eed618c1f0777f0cb09a8ca03bedbe205 Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Mon, 10 Jan 2022 22:52:33 -0800 Subject: [PATCH 4/7] test --- firestore/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/firestore/CMakeLists.txt b/firestore/CMakeLists.txt index bbaa394f69..15e093ab95 100644 --- a/firestore/CMakeLists.txt +++ b/firestore/CMakeLists.txt @@ -363,7 +363,6 @@ if (MSVC AND NOT ANDROID AND NOT IOS) _LIBCPP_VERSION=99) endif() -message("FIREBASE_FIRESTORE_CPP_DEFINES is ${FIREBASE_FIRESTORE_CPP_DEFINES}") target_compile_definitions(firebase_firestore PRIVATE ${FIREBASE_FIRESTORE_CPP_DEFINES} @@ -403,5 +402,8 @@ elseif(IOS) endif() endif() +get_target_property(_compile_defs firebase_firestore COMPILE_DEFINITIONS) +message("firebase_firestore compile define is ${_compile_defs}") + cpp_pack_library(firebase_firestore "") cpp_pack_public_headers() From 2952add92f9c5c440df3c9335f0bf99c6348f19f Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Tue, 11 Jan 2022 10:57:25 -0800 Subject: [PATCH 5/7] test --- firestore/src/include/firebase/firestore/field_value.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firestore/src/include/firebase/firestore/field_value.h b/firestore/src/include/firebase/firestore/field_value.h index 40962b7211..e2c2f66a31 100644 --- a/firestore/src/include/firebase/firestore/field_value.h +++ b/firestore/src/include/firebase/firestore/field_value.h @@ -348,7 +348,7 @@ class FieldValue final { // Note: Doxygen will run into trouble if this function's definition is // moved outside the class body. static_assert( - std::numeric_limits::max() <= std::numeric_limits::max(), + (std::numeric_limits::max)() <= (std::numeric_limits::max)(), "The integer type you provided is larger than can fit in an int64_t. " "If you are sure the value will not be truncated, please explicitly " "cast to int64_t before passing it to FieldValue::Increment()."); From 8527cd5f120dfaeedc134100e03cc0d772578967 Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Tue, 11 Jan 2022 12:11:41 -0800 Subject: [PATCH 6/7] remove helper print --- firestore/CMakeLists.txt | 4 ---- firestore/src/include/firebase/firestore/field_value.h | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/firestore/CMakeLists.txt b/firestore/CMakeLists.txt index 15e093ab95..b3168bee59 100644 --- a/firestore/CMakeLists.txt +++ b/firestore/CMakeLists.txt @@ -351,7 +351,6 @@ if (MSVC AND NOT ANDROID AND NOT IOS) # On Windows, gRPC gives a compiler error in firebase_metadata_provider_desktop.cc # unless _WIN32_WINNT is defined to this value (0x0600, Windows Vista). # Also set -DNOMINMAX for both Firestore and Firestore Core. - message("SET -DNOMINMAX for firestore cpp build") set(FIREBASE_FIRESTORE_CPP_DEFINES ${FIREBASE_FIRESTORE_CPP_DEFINES} -D_WIN32_WINNT=0x0600 -DNOMINMAX) # Special handling for the absl time zone library, define _LIBCPP_VERSION on # Windows to avoid the shenanigans they do with Windows mangled symbols to @@ -402,8 +401,5 @@ elseif(IOS) endif() endif() -get_target_property(_compile_defs firebase_firestore COMPILE_DEFINITIONS) -message("firebase_firestore compile define is ${_compile_defs}") - cpp_pack_library(firebase_firestore "") cpp_pack_public_headers() diff --git a/firestore/src/include/firebase/firestore/field_value.h b/firestore/src/include/firebase/firestore/field_value.h index e2c2f66a31..3d0f157bf4 100644 --- a/firestore/src/include/firebase/firestore/field_value.h +++ b/firestore/src/include/firebase/firestore/field_value.h @@ -376,9 +376,8 @@ class FieldValue final { static FieldValue Increment(T by_value) { // Note: Doxygen will run into trouble if this function's definition is // moved outside the class body. - #undef max static_assert( - std::numeric_limits::max() <= std::numeric_limits::max(), + (std::numeric_limits::max)() <= (std::numeric_limits::max)(), "The floating point type you provided is larger than can fit in a " "double. If you are sure the value will not be truncated, please " "explicitly cast to double before passing it to " From 1840c4d64e9f594046fdf08894065b55c6c10574 Mon Sep 17 00:00:00 2001 From: Cynthia Jiang Date: Tue, 11 Jan 2022 15:23:28 -0800 Subject: [PATCH 7/7] format code --- firestore/src/include/firebase/firestore/field_value.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firestore/src/include/firebase/firestore/field_value.h b/firestore/src/include/firebase/firestore/field_value.h index 3d0f157bf4..e66814104e 100644 --- a/firestore/src/include/firebase/firestore/field_value.h +++ b/firestore/src/include/firebase/firestore/field_value.h @@ -348,7 +348,8 @@ class FieldValue final { // Note: Doxygen will run into trouble if this function's definition is // moved outside the class body. static_assert( - (std::numeric_limits::max)() <= (std::numeric_limits::max)(), + (std::numeric_limits::max)() <= + (std::numeric_limits::max)(), "The integer type you provided is larger than can fit in an int64_t. " "If you are sure the value will not be truncated, please explicitly " "cast to int64_t before passing it to FieldValue::Increment().");