Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Eikemeier <eikemeier@fillmore-labs.com>
  • Loading branch information
eikemeier committed Jun 11, 2021
1 parent dae1611 commit 7440e97
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Expand Up @@ -3,6 +3,7 @@
*.bzl text
*.java text
*.json text
*.patch text
*.proto text
*.yaml text
BUILD text
Expand Down
17 changes: 0 additions & 17 deletions README.adoc
Expand Up @@ -185,20 +185,3 @@ data model naming conventions. MapStruct uses a fixed und quite unflexible acces
so you can't really decide that protocol buffers should have one convention but Immutables another.
Especially for Immutables we are forced to use JavaBeans-style naming convention, although this is
not a JEE application.

== Known Issues

Warning during build:
[subs="+quotes"]
----
[lime]#INFO:# From Compiling src/google/protobuf/descriptor.cc:
*external/com_google_protobuf/src/google/protobuf/descriptor.cc:1038:9: [fuchsia]#warning:# passing variable 'unknown_enum_values_by_number_' by reference requires holding mutex 'unknown_enum_values_mu_' [-Wthread-safety-reference]*
unknown_enum_values_by_number_, std::make_pair(parent, number));
[lime]#^#
*external/com_google_protobuf/src/google/protobuf/descriptor.cc:1048:9: [fuchsia]#warning:# passing variable 'unknown_enum_values_by_number_' by reference requires holding mutex 'unknown_enum_values_mu_' [-Wthread-safety-reference]*
unknown_enum_values_by_number_, std::make_pair(parent, number));
[lime]#^#
2 warnings generated.
----

Fixed in https://github.com/protocolbuffers/protobuf/pull/8714[GitHub pull request #8714].
1 change: 1 addition & 0 deletions WORKSPACE
Expand Up @@ -29,6 +29,7 @@ http_archive(

http_archive(
name = "com_google_protobuf",
patches = ["//patches:8714.patch"],
sha256 = "c6003e1d2e7fefa78a3039f19f383b4f3a61e81be8c19356f85b6461998ad3db",
strip_prefix = "protobuf-3.17.3",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.17.3.tar.gz"],
Expand Down
39 changes: 39 additions & 0 deletions patches/8714.patch
@@ -0,0 +1,39 @@
https://github.com/protocolbuffers/protobuf/pull/8714
---
src/google/protobuf/stubs/mutex.h | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git src/google/protobuf/stubs/mutex.h src/google/protobuf/stubs/mutex.h
index 79c9f6784..5c025b149 100644
--- src/google/protobuf/stubs/mutex.h
+++ src/google/protobuf/stubs/mutex.h
@@ -52,10 +52,12 @@
__attribute__((acquire_capability(__VA_ARGS__)))
#define GOOGLE_PROTOBUF_RELEASE(...) \
__attribute__((release_capability(__VA_ARGS__)))
+#define GOOGLE_PROTOBUF_SCOPED_CAPABILITY __attribute__((scoped_lockable))
#define GOOGLE_PROTOBUF_CAPABILITY(x) __attribute__((capability(x)))
#else
#define GOOGLE_PROTOBUF_ACQUIRE(...)
#define GOOGLE_PROTOBUF_RELEASE(...)
+#define GOOGLE_PROTOBUF_SCOPED_CAPABILITY
#define GOOGLE_PROTOBUF_CAPABILITY(x)
#endif

@@ -140,10 +142,12 @@ class GOOGLE_PROTOBUF_CAPABILITY("mutex") PROTOBUF_EXPORT WrappedMutex {
using Mutex = WrappedMutex;

// MutexLock(mu) acquires mu when constructed and releases it when destroyed.
-class PROTOBUF_EXPORT MutexLock {
+class GOOGLE_PROTOBUF_SCOPED_CAPABILITY PROTOBUF_EXPORT MutexLock {
public:
- explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
- ~MutexLock() { this->mu_->Unlock(); }
+ explicit MutexLock(Mutex *mu) GOOGLE_PROTOBUF_ACQUIRE(mu) : mu_(mu) {
+ this->mu_->Lock();
+ }
+ ~MutexLock() GOOGLE_PROTOBUF_RELEASE() { this->mu_->Unlock(); }
private:
Mutex *const mu_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLock);
--
Empty file added patches/BUILD
Empty file.

0 comments on commit 7440e97

Please sign in to comment.