[Bf-blender-cvs] [32ceb0b8071] master: Fix std::optional value() build error on older macOS SDK

Brecht Van Lommel noreply at git.blender.org
Fri Jan 21 21:48:22 CET 2022


Commit: 32ceb0b80710473c9a9b818da23919f184fa3aae
Author: Brecht Van Lommel
Date:   Fri Jan 21 20:07:20 2022 +0100
Branches: master
https://developer.blender.org/rB32ceb0b80710473c9a9b818da23919f184fa3aae

Fix std::optional value() build error on older macOS SDK

No longer happens on the buildbot, but for users building with an older
Xcode we still need to avoid using value().

===================================================================

M	source/blender/blenkernel/intern/idprop_serialize.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/idprop_serialize.cc b/source/blender/blenkernel/intern/idprop_serialize.cc
index 92dce49500c..08a7f13b806 100644
--- a/source/blender/blenkernel/intern/idprop_serialize.cc
+++ b/source/blender/blenkernel/intern/idprop_serialize.cc
@@ -304,7 +304,7 @@ class IDPStringSerializer : public IDPropertySerializer {
   std::unique_ptr<IDProperty, IDPropertyDeleter> entry_to_idprop(
       DictionaryEntryParser &entry_reader) const override
   {
-    BLI_assert(entry_reader.get_type().value() == IDP_STRING);
+    BLI_assert(*(entry_reader.get_type()) == IDP_STRING);
     std::optional<std::string> name = entry_reader.get_name();
     if (!name.has_value()) {
       return nullptr;
@@ -344,7 +344,7 @@ class IDPIntSerializer : public IDPropertySerializer {
   std::unique_ptr<IDProperty, IDPropertyDeleter> entry_to_idprop(
       DictionaryEntryParser &entry_reader) const override
   {
-    BLI_assert(entry_reader.get_type().value() == IDP_INT);
+    BLI_assert(*(entry_reader.get_type()) == IDP_INT);
     std::optional<std::string> name = entry_reader.get_name();
     if (!name.has_value()) {
       return nullptr;
@@ -384,7 +384,7 @@ class IDPFloatSerializer : public IDPropertySerializer {
   std::unique_ptr<IDProperty, IDPropertyDeleter> entry_to_idprop(
       DictionaryEntryParser &entry_reader) const override
   {
-    BLI_assert(entry_reader.get_type().value() == IDP_FLOAT);
+    BLI_assert(*(entry_reader.get_type()) == IDP_FLOAT);
     std::optional<std::string> name = entry_reader.get_name();
     if (!name.has_value()) {
       return nullptr;
@@ -424,7 +424,7 @@ class IDPDoubleSerializer : public IDPropertySerializer {
   std::unique_ptr<IDProperty, IDPropertyDeleter> entry_to_idprop(
       DictionaryEntryParser &entry_reader) const override
   {
-    BLI_assert(entry_reader.get_type().value() == IDP_DOUBLE);
+    BLI_assert(*(entry_reader.get_type()) == IDP_DOUBLE);
     std::optional<std::string> name = entry_reader.get_name();
     if (!name.has_value()) {
       return nullptr;
@@ -502,7 +502,7 @@ class IDPArraySerializer : public IDPropertySerializer {
   std::unique_ptr<IDProperty, IDPropertyDeleter> entry_to_idprop(
       DictionaryEntryParser &entry_reader) const override
   {
-    BLI_assert(entry_reader.get_type().value() == IDP_ARRAY);
+    BLI_assert(*(entry_reader.get_type()) == IDP_ARRAY);
     std::optional<eIDPropertyType> property_subtype = entry_reader.get_subtype();
     if (!property_subtype.has_value()) {
       return nullptr;
@@ -556,8 +556,8 @@ class IDPArraySerializer : public IDPropertySerializer {
   std::unique_ptr<IDProperty, IDPropertyDeleter> idprop_array_int_from_value(
       DictionaryEntryParser &entry_reader) const
   {
-    BLI_assert(entry_reader.get_type().value() == IDP_ARRAY);
-    BLI_assert(entry_reader.get_subtype().value() == IDP_INT);
+    BLI_assert(*(entry_reader.get_type()) == IDP_ARRAY);
+    BLI_assert(*(entry_reader.get_subtype()) == IDP_INT);
     std::optional<std::string> name = entry_reader.get_name();
     if (!name.has_value()) {
       return nullptr;
@@ -572,8 +572,8 @@ class IDPArraySerializer : public IDPropertySerializer {
   std::unique_ptr<IDProperty, IDPropertyDeleter> idprop_array_float_from_value(
       DictionaryEntryParser &entry_reader) const
   {
-    BLI_assert(entry_reader.get_type().value() == IDP_ARRAY);
-    BLI_assert(entry_reader.get_subtype().value() == IDP_FLOAT);
+    BLI_assert(*(entry_reader.get_type()) == IDP_ARRAY);
+    BLI_assert(*(entry_reader.get_subtype()) == IDP_FLOAT);
     std::optional<std::string> name = entry_reader.get_name();
     if (!name.has_value()) {
       return nullptr;
@@ -588,8 +588,8 @@ class IDPArraySerializer : public IDPropertySerializer {
   std::unique_ptr<IDProperty, IDPropertyDeleter> idprop_array_double_from_value(
       DictionaryEntryParser &entry_reader) const
   {
-    BLI_assert(entry_reader.get_type().value() == IDP_ARRAY);
-    BLI_assert(entry_reader.get_subtype().value() == IDP_DOUBLE);
+    BLI_assert(*(entry_reader.get_type()) == IDP_ARRAY);
+    BLI_assert(*(entry_reader.get_subtype()) == IDP_DOUBLE);
     std::optional<std::string> name = entry_reader.get_name();
     if (!name.has_value()) {
       return nullptr;
@@ -639,7 +639,7 @@ class IDPGroupSerializer : public IDPropertySerializer {
   std::unique_ptr<IDProperty, IDPropertyDeleter> entry_to_idprop(
       DictionaryEntryParser &entry_reader) const override
   {
-    BLI_assert(entry_reader.get_type().value() == IDP_GROUP);
+    BLI_assert(*(entry_reader.get_type()) == IDP_GROUP);
     std::optional<std::string> name = entry_reader.get_name();
     if (!name.has_value()) {
       return nullptr;
@@ -796,7 +796,7 @@ static IDProperty *idprop_from_value(const DictionaryValue &value)
     return nullptr;
   }
 
-  const IDPropertySerializer &serializer = serializer_for(property_type.value());
+  const IDPropertySerializer &serializer = serializer_for(*property_type);
   return serializer.entry_to_idprop(entry_reader).release();
 }



More information about the Bf-blender-cvs mailing list