Skip to content

Commit 68dcc19

Browse files
committed
Merge branch 'master' into bthomee/build
2 parents 8b0ba09 + 01ebd89 commit 68dcc19

File tree

5 files changed

+127
-0
lines changed

5 files changed

+127
-0
lines changed

recipes/protobuf/all/conandata.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ sources:
2121
url: "https://github.com/protocolbuffers/protobuf/archive/v3.20.3.tar.gz"
2222
sha256: "9c0fd39c7a08dff543c643f0f4baf081988129a411b977a07c46221793605638"
2323
patches:
24+
"6.30.1":
25+
- patch_file: "patches/protobuf-6.30.1-change-empty-string.patch"
26+
patch_description: "Change how we decide which empty string implementation to use"
27+
patch_type: "backport"
28+
patch_source: "https://github.com/protocolbuffers/protobuf/issues/20645"
29+
- patch_file: "patches/protobuf-6.30.1-disable-fixed-string-MSVC.patch"
30+
patch_description: "Disable the optimization for fixed_address_empty_string for MSVC"
31+
patch_type: "backport"
32+
patch_source: "https://github.com/protocolbuffers/protobuf/issues/21957"
2433
"3.21.12":
2534
- patch_file: "patches/protobuf-3.21.12-upstream-macos-macros.patch"
2635
patch_description: "Handle case where macOS SDK macros may conflict with protobuf message types"
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
diff --git a/src/google/protobuf/port.cc b/src/google/protobuf/port.cc
2+
index af668e9e2..d60c2b89f 100644
3+
--- a/src/google/protobuf/port.cc
4+
+++ b/src/google/protobuf/port.cc
5+
@@ -97,14 +97,9 @@ void RealDebugCounter::Register(absl::string_view name) {
6+
}
7+
}
8+
9+
-#if defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L
10+
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT const GlobalEmptyString
11+
- fixed_address_empty_string{};
12+
-#else
13+
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
14+
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GlobalEmptyString
15+
fixed_address_empty_string{};
16+
-#endif
17+
18+
} // namespace internal
19+
} // namespace protobuf
20+
diff --git a/src/google/protobuf/port.h b/src/google/protobuf/port.h
21+
index 5f9e909a0..386ecc02a 100644
22+
--- a/src/google/protobuf/port.h
23+
+++ b/src/google/protobuf/port.h
24+
@@ -494,20 +494,27 @@ class NoopDebugCounter {
25+
// Default empty string object. Don't use this directly. Instead, call
26+
// GetEmptyString() to get the reference. This empty string is aligned with a
27+
// minimum alignment of 8 bytes to match the requirement of ArenaStringPtr.
28+
-#if defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L
29+
+
30+
// Take advantage of C++20 constexpr support in std::string.
31+
-class alignas(8) GlobalEmptyString {
32+
+class alignas(8) GlobalEmptyStringConstexpr {
33+
public:
34+
const std::string& get() const { return value_; }
35+
// Nothing to init, or destroy.
36+
std::string* Init() const { return nullptr; }
37+
38+
+ template <typename T = std::string, bool = (T(), true)>
39+
+ static constexpr std::true_type HasConstexprDefaultConstructor(int) {
40+
+ return {};
41+
+ }
42+
+ static constexpr std::false_type HasConstexprDefaultConstructor(char) {
43+
+ return {};
44+
+ }
45+
+
46+
private:
47+
std::string value_;
48+
};
49+
-PROTOBUF_EXPORT extern const GlobalEmptyString fixed_address_empty_string;
50+
-#else
51+
-class alignas(8) GlobalEmptyString {
52+
+
53+
+class alignas(8) GlobalEmptyStringDynamicInit {
54+
public:
55+
const std::string& get() const {
56+
return *reinterpret_cast<const std::string*>(internal::Launder(buffer_));
57+
@@ -519,8 +526,12 @@ class alignas(8) GlobalEmptyString {
58+
private:
59+
alignas(std::string) char buffer_[sizeof(std::string)];
60+
};
61+
+
62+
+using GlobalEmptyString = std::conditional_t<
63+
+ GlobalEmptyStringConstexpr::HasConstexprDefaultConstructor(0),
64+
+ const GlobalEmptyStringConstexpr, GlobalEmptyStringDynamicInit>;
65+
+
66+
PROTOBUF_EXPORT extern GlobalEmptyString fixed_address_empty_string;
67+
-#endif
68+
69+
} // namespace internal
70+
} // namespace protobuf
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/src/google/protobuf/port.h b/src/google/protobuf/port.h
2+
index 386ecc02a..32d260c42 100644
3+
--- a/src/google/protobuf/port.h
4+
+++ b/src/google/protobuf/port.h
5+
@@ -502,10 +502,16 @@ class alignas(8) GlobalEmptyStringConstexpr {
6+
// Nothing to init, or destroy.
7+
std::string* Init() const { return nullptr; }
8+
9+
+ // Disable the optimization for MSVC.
10+
+ // There are some builds where the default constructed string can't be used as
11+
+ // `constinit` even though the constructor is `constexpr` and can be used
12+
+ // during constant evaluation.
13+
+#if !defined(_MSC_VER)
14+
template <typename T = std::string, bool = (T(), true)>
15+
static constexpr std::true_type HasConstexprDefaultConstructor(int) {
16+
return {};
17+
}
18+
+#endif
19+
static constexpr std::false_type HasConstexprDefaultConstructor(char) {
20+
return {};
21+
}

recipes/soci/all/conandata.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ patches:
1010
- patch_file: "patches/0001-Remove-hardcoded-INSTALL_NAME_DIR-for-relocatable-li.patch"
1111
patch_description: "Generate relocatable libraries on MacOS"
1212
patch_type: "portability"
13+
- patch_file: "patches/0002-Fix-soci_backend.patch"
14+
patch_description: "Fix variable names for dependencies"
15+
patch_type: "conan"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/cmake/SociBackend.cmake b/cmake/SociBackend.cmake
2+
index 0a664667..3fa2ed95 100644
3+
--- a/cmake/SociBackend.cmake
4+
+++ b/cmake/SociBackend.cmake
5+
@@ -31,14 +31,13 @@ macro(soci_backend_deps_found NAME DEPS SUCCESS)
6+
if(NOT DEPEND_FOUND)
7+
list(APPEND DEPS_NOT_FOUND ${dep})
8+
else()
9+
- string(TOUPPER "${dep}" DEPU)
10+
- if( ${DEPU}_INCLUDE_DIR )
11+
- list(APPEND DEPS_INCLUDE_DIRS ${${DEPU}_INCLUDE_DIR})
12+
+ if( ${dep}_INCLUDE_DIR )
13+
+ list(APPEND DEPS_INCLUDE_DIRS ${${dep}_INCLUDE_DIR})
14+
endif()
15+
- if( ${DEPU}_INCLUDE_DIRS )
16+
- list(APPEND DEPS_INCLUDE_DIRS ${${DEPU}_INCLUDE_DIRS})
17+
+ if( ${dep}_INCLUDE_DIRS )
18+
+ list(APPEND DEPS_INCLUDE_DIRS ${${dep}_INCLUDE_DIRS})
19+
endif()
20+
- list(APPEND DEPS_LIBRARIES ${${DEPU}_LIBRARIES})
21+
+ list(APPEND DEPS_LIBRARIES ${${dep}_LIBRARIES})
22+
endif()
23+
endforeach()
24+

0 commit comments

Comments
 (0)