aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler
diff options
context:
space:
mode:
authorGravatar Jonathan Dierksen <jedierksen@gmail.com>2018-01-22 13:26:39 -0800
committerGravatar Thomas Van Lenten <thomasvl@google.com>2018-01-22 16:26:39 -0500
commita721bf6d294915b412e4ba6b5d92a9b84c6bfef9 (patch)
treee2650a8219b383a4e622df32a6294b3418a00594 /src/google/protobuf/compiler
parent47b7d2c7cadf74ceec90fc5042232819cd0dd557 (diff)
Migrate away from deprecated OSAtomic APIs. (#4184)
* Migrate away from deprecated OSAtomic APIs.
Diffstat (limited to 'src/google/protobuf/compiler')
-rw-r--r--src/google/protobuf/compiler/objectivec/objectivec_enum.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_enum.cc b/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
index 02d60b3e..95e53f19 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
@@ -149,7 +149,7 @@ void EnumGenerator::GenerateSource(io::Printer* printer) {
printer->Print(
"GPBEnumDescriptor *$name$_EnumDescriptor(void) {\n"
- " static GPBEnumDescriptor *descriptor = NULL;\n"
+ " static _Atomic(GPBEnumDescriptor*) descriptor = NULL;\n"
" if (!descriptor) {\n",
"name", name_);
@@ -192,7 +192,8 @@ void EnumGenerator::GenerateSource(io::Printer* printer) {
"extraTextFormatInfo", CEscape(text_format_decode_data.Data()));
}
printer->Print(
- " if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {\n"
+ " GPBEnumDescriptor *expected = nil;\n"
+ " if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {\n"
" [worker release];\n"
" }\n"
" }\n"