Skip to content

Bugfix/app cmake exceptions private #561

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

Merged
merged 12 commits into from
Jul 27, 2021
Merged
4 changes: 2 additions & 2 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@ set_property(TARGET firebase_app PROPERTY FOLDER "Firebase Cpp")

# Disable exceptions in std
if (MSVC)
target_compile_options(firebase_app PUBLIC /EHs-c-)
target_compile_options(firebase_app PRIVATE /EHs-c-)
else()
target_compile_options(firebase_app PUBLIC -fno-exceptions)
target_compile_options(firebase_app PRIVATE -fno-exceptions)
endif()

target_include_directories(firebase_app
Expand Down
36 changes: 24 additions & 12 deletions app/tests/thread_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"

#define EXPECT_THROW_ERROR_CODE(statement, error_code) \
EXPECT_THROW( \
{ \
try { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} catch (const std::system_error& exception) { \
EXPECT_EQ(error_code, exception.code()); \
throw; \
} \
}, \
std::system_error)

namespace {

using ::testing::Eq;
Expand Down Expand Up @@ -107,66 +119,66 @@ TEST(ThreadDeathTest, MovingIntoRunningThreadShouldAbort) {
}

TEST(ThreadDeathTest, JoinEmptyThreadShouldAbort) {
ASSERT_DEATH(
EXPECT_THROW_ERROR_CODE(
{
firebase::Thread thread;
thread.Join();
},
"");
std::errc::invalid_argument);
}

TEST(ThreadDeathTest, JoinThreadMultipleTimesShouldAbort) {
ASSERT_DEATH(
EXPECT_THROW_ERROR_CODE(
{
firebase::Thread thread([] {});

thread.Join();
thread.Join();
},
"");
std::errc::invalid_argument);
}

TEST(ThreadDeathTest, JoinDetachedThreadShouldAbort) {
ASSERT_DEATH(
EXPECT_THROW_ERROR_CODE(
{
firebase::Thread thread([] {});

thread.Detach();
thread.Join();
},
"");
std::errc::invalid_argument);
}

TEST(ThreadDeathTest, DetachJoinedThreadShouldAbort) {
ASSERT_DEATH(
EXPECT_THROW_ERROR_CODE(
{
firebase::Thread thread([] {});

thread.Join();
thread.Detach();
},
"");
std::errc::invalid_argument);
}

TEST(ThreadDeathTest, DetachEmptyThreadShouldAbort) {
ASSERT_DEATH(
EXPECT_THROW_ERROR_CODE(
{
firebase::Thread thread;

thread.Detach();
},
"");
std::errc::invalid_argument);
}

TEST(ThreadDeathTest, DetachThreadMultipleTimesShouldAbort) {
ASSERT_DEATH(
EXPECT_THROW_ERROR_CODE(
{
firebase::Thread thread([] {});

thread.Detach();
thread.Detach();
},
"");
std::errc::invalid_argument);
}

TEST(ThreadDeathTest, WhenJoinableThreadIsDestructedShouldAbort) {
Expand Down
15 changes: 9 additions & 6 deletions release_build_files/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,15 @@ code.

### 8.3.0
- Changes
- General: This release adds tvOS C++ libraries that wrap the community
supported Firebase tvOS SDK. `libs/tvos` contains tvOS specific
libraries and the `xcframeworks` directory now includes support for both
iOS and tvOS. The following products are currently included for tvOS:
Auth, Database, Firestore, Functions, Installations, Messaging,
Remote Config, Storage.
- General: This release adds tvOS C++ libraries that wrap the
community-supported Firebase tvOS SDK. `libs/tvos` contains
tvOS-specific libraries, and the `xcframeworks` directory now
includes support for both iOS and tvOS. The following products are
currently included for tvOS: Auth, Database, Firestore, Functions,
Installations, Messaging, Remote Config, Storage.
- General: When building from source, the compiler setting of
"no exceptions" on app is PRIVATE now and will not affect any other
targets in the build.
- Firestore: Removed the deprecated
`Firestore::RunTransaction(TransactionFunction*)` function. Please use
the overload that takes a `std::function` argument instead.
Expand Down