New generator options for oneofs: allow skipping or generating as normal 'optional...
[apps/agl-service-can-low-level.git] / docs / migration.rst
index 67f97b3..d5ded64 100644 (file)
@@ -11,6 +11,25 @@ are included, in order to make it easier to find this document.
 
 .. contents ::
 
+Nanopb-0.3.2 (2015-01-xx)
+=========================
+
+Add support for OneOfs
+----------------------
+**Rationale:** Previously nanopb did not support the *oneof* construct in
+*.proto* files. Those fields were generated as regular *optional* fields.
+
+**Changes:** OneOfs are now generated as C unions. Callback fields are not
+supported inside oneof and generator gives an error.
+
+**Required actions:** The generator option *no_unions* can be used to restore old
+behaviour and to allow callbacks to be used. To use unions, one change is
+needed: use *which_xxxx* field to detect which field is present, instead
+of *has_xxxx*. Compare the value against *MyStruct_myfield_tag*.
+
+**Error indications:** Generator error: "Callback fields inside of oneof are
+not supported". Compiler error: "Message" has no member named "has_xxxx".
+
 Nanopb-0.3.0 (2014-08-26)
 =========================
 
@@ -151,12 +170,12 @@ Callback function signature
 as *void\**. This allowed passing of any data, but made it unnecessarily
 complex to return a pointer from callback.
 
-**Changes:** The callback function parameter was changed to *void\**.
+**Changes:** The callback function parameter was changed to *void\*\**.
 
 **Required actions:** You can continue using the old callback style by
 defining *PB_OLD_CALLBACK_STYLE*. Recommended action is to:
 
-  * Change the callback signatures to contain *void\** for decoders and
+  * Change the callback signatures to contain *void\*\** for decoders and
     *void \* const \** for encoders.
   * Change the callback function body to use *\*arg* instead of *arg*.