Skip to content

Commit 647052a

Browse files
authored
Merge pull request #12997 from fowles/23.x
Cherry-pick portability fixes to 23.x line
2 parents 727ece5 + adf8922 commit 647052a

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

Protobuf-C++.podspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Pod::Spec.new do |s|
2525

2626
s.header_mappings_dir = 'src'
2727

28-
s.ios.deployment_target = '7.0'
29-
s.osx.deployment_target = '10.9'
30-
s.tvos.deployment_target = '9.0'
31-
s.watchos.deployment_target = '2.0'
28+
s.ios.deployment_target = '12.0'
29+
s.osx.deployment_target = '10.13'
30+
s.tvos.deployment_target = '12.0'
31+
s.watchos.deployment_target = '6.0'
3232

3333
s.pod_target_xcconfig = {
3434
# Do not let src/google/protobuf/stubs/time.h override system API

src/google/protobuf/arena.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ ThreadSafeArena::ThreadCache& ThreadSafeArena::thread_cache() {
519519
new internal::ThreadLocalStorage<ThreadCache>();
520520
return *thread_cache_->Get();
521521
}
522-
#elif defined(PROTOBUF_USE_DLLS)
522+
#elif defined(PROTOBUF_USE_DLLS) && defined(_MSC_VER)
523523
ThreadSafeArena::ThreadCache& ThreadSafeArena::thread_cache() {
524524
static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache;
525525
return thread_cache;

src/google/protobuf/reflection_mode.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace internal {
3939

4040
#if !defined(PROTOBUF_NO_THREADLOCAL)
4141

42-
#if defined(PROTOBUF_USE_DLLS)
42+
#if defined(PROTOBUF_USE_DLLS) && defined(_MSC_VER)
4343
ReflectionMode& ScopedReflectionMode::reflection_mode() {
4444
static PROTOBUF_THREAD_LOCAL ReflectionMode reflection_mode =
4545
ReflectionMode::kDefault;

src/google/protobuf/reflection_mode.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,20 @@ class PROTOBUF_EXPORT ScopedReflectionMode final {
9595
private:
9696
#if !defined(PROTOBUF_NO_THREADLOCAL)
9797
const ReflectionMode previous_mode_;
98-
#if defined(PROTOBUF_USE_DLLS)
98+
#if defined(PROTOBUF_USE_DLLS) && defined(_MSC_VER)
99+
// Thread local variables cannot be exposed through MSVC DLL interface but we
100+
// can wrap them in static functions.
99101
static ReflectionMode& reflection_mode();
100102
#else
101103
PROTOBUF_CONSTINIT static PROTOBUF_THREAD_LOCAL ReflectionMode
102104
reflection_mode_;
103-
#endif // PROTOBUF_USE_DLLS
105+
#endif // PROTOBUF_USE_DLLS && _MSC_VER
104106
#endif // !PROTOBUF_NO_THREADLOCAL
105107
};
106108

107109
#if !defined(PROTOBUF_NO_THREADLOCAL)
108110

109-
#if defined(PROTOBUF_USE_DLLS)
111+
#if defined(PROTOBUF_USE_DLLS) && defined(_MSC_VER)
110112

111113
inline ScopedReflectionMode::ScopedReflectionMode(ReflectionMode mode)
112114
: previous_mode_(reflection_mode()) {
@@ -140,7 +142,7 @@ inline ReflectionMode ScopedReflectionMode::current_reflection_mode() {
140142
return reflection_mode_;
141143
}
142144

143-
#endif // PROTOBUF_USE_DLLS
145+
#endif // PROTOBUF_USE_DLLS && _MSC_VER
144146

145147
#else
146148

src/google/protobuf/thread_safe_arena.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ class PROTOBUF_EXPORT ThreadSafeArena {
261261
// iOS does not support __thread keyword so we use a custom thread local
262262
// storage class we implemented.
263263
static ThreadCache& thread_cache();
264-
#elif defined(PROTOBUF_USE_DLLS)
265-
// Thread local variables cannot be exposed through DLL interface but we can
266-
// wrap them in static functions.
264+
#elif defined(PROTOBUF_USE_DLLS) && defined(_MSC_VER)
265+
// Thread local variables cannot be exposed through MSVC DLL interface but we
266+
// can wrap them in static functions.
267267
static ThreadCache& thread_cache();
268268
#else
269269
PROTOBUF_CONSTINIT static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_;

0 commit comments

Comments
 (0)