Skip to content

Commit 984f698

Browse files
authored
Merge pull request #561 from firebase/bugfix/app-cmake-exceptions-private
Bugfix/app cmake exceptions private
2 parents 205ae26 + c95c5cf commit 984f698

File tree

3 files changed

+35
-20
lines changed

3 files changed

+35
-20
lines changed

app/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,9 @@ set_property(TARGET firebase_app PROPERTY FOLDER "Firebase Cpp")
328328

329329
# Disable exceptions in std
330330
if (MSVC)
331-
target_compile_options(firebase_app PUBLIC /EHs-c-)
331+
target_compile_options(firebase_app PRIVATE /EHs-c-)
332332
else()
333-
target_compile_options(firebase_app PUBLIC -fno-exceptions)
333+
target_compile_options(firebase_app PRIVATE -fno-exceptions)
334334
endif()
335335

336336
target_include_directories(firebase_app

app/tests/thread_test.cc

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@
2020
#include "gmock/gmock.h"
2121
#include "gtest/gtest.h"
2222

23+
#define EXPECT_THROW_ERROR_CODE(statement, error_code) \
24+
EXPECT_THROW( \
25+
{ \
26+
try { \
27+
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
28+
} catch (const std::system_error& exception) { \
29+
EXPECT_EQ(error_code, exception.code()); \
30+
throw; \
31+
} \
32+
}, \
33+
std::system_error)
34+
2335
namespace {
2436

2537
using ::testing::Eq;
@@ -107,66 +119,66 @@ TEST(ThreadDeathTest, MovingIntoRunningThreadShouldAbort) {
107119
}
108120

109121
TEST(ThreadDeathTest, JoinEmptyThreadShouldAbort) {
110-
ASSERT_DEATH(
122+
EXPECT_THROW_ERROR_CODE(
111123
{
112124
firebase::Thread thread;
113125
thread.Join();
114126
},
115-
"");
127+
std::errc::invalid_argument);
116128
}
117129

118130
TEST(ThreadDeathTest, JoinThreadMultipleTimesShouldAbort) {
119-
ASSERT_DEATH(
131+
EXPECT_THROW_ERROR_CODE(
120132
{
121133
firebase::Thread thread([] {});
122134

123135
thread.Join();
124136
thread.Join();
125137
},
126-
"");
138+
std::errc::invalid_argument);
127139
}
128140

129141
TEST(ThreadDeathTest, JoinDetachedThreadShouldAbort) {
130-
ASSERT_DEATH(
142+
EXPECT_THROW_ERROR_CODE(
131143
{
132144
firebase::Thread thread([] {});
133145

134146
thread.Detach();
135147
thread.Join();
136148
},
137-
"");
149+
std::errc::invalid_argument);
138150
}
139151

140152
TEST(ThreadDeathTest, DetachJoinedThreadShouldAbort) {
141-
ASSERT_DEATH(
153+
EXPECT_THROW_ERROR_CODE(
142154
{
143155
firebase::Thread thread([] {});
144156

145157
thread.Join();
146158
thread.Detach();
147159
},
148-
"");
160+
std::errc::invalid_argument);
149161
}
150162

151163
TEST(ThreadDeathTest, DetachEmptyThreadShouldAbort) {
152-
ASSERT_DEATH(
164+
EXPECT_THROW_ERROR_CODE(
153165
{
154166
firebase::Thread thread;
155167

156168
thread.Detach();
157169
},
158-
"");
170+
std::errc::invalid_argument);
159171
}
160172

161173
TEST(ThreadDeathTest, DetachThreadMultipleTimesShouldAbort) {
162-
ASSERT_DEATH(
174+
EXPECT_THROW_ERROR_CODE(
163175
{
164176
firebase::Thread thread([] {});
165177

166178
thread.Detach();
167179
thread.Detach();
168180
},
169-
"");
181+
std::errc::invalid_argument);
170182
}
171183

172184
TEST(ThreadDeathTest, WhenJoinableThreadIsDestructedShouldAbort) {

release_build_files/readme.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,12 +569,15 @@ code.
569569

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

0 commit comments

Comments
 (0)