Skip to content

Add support for try construct#2377

Merged
eboasson merged 38 commits into
eclipse-cyclonedds:masterfrom
eboasson:try-construct-cleanup
May 4, 2026
Merged

Add support for try construct#2377
eboasson merged 38 commits into
eclipse-cyclonedds:masterfrom
eboasson:try-construct-cleanup

Conversation

@eboasson
Copy link
Copy Markdown
Contributor

It also fixes some things discovered in the process:

  • The assignability check didn't correctly detect all cases of members with the same name having different ids and vice-versa
  • The assignability check didn't correctly detect all cases where one type had more key fields than the other
  • A clang update from Apple caused a bunch of new warnings ...
  • Some bugs in the dynamic type API got fixed
  • One can now set annotations on the most recently added member by specifying member id AUTO
  • Rudimentary support for FLOAT128 got added
  • An example program with a rudimentary library for using types defined in XML files and writing samples specified in XML

@eboasson eboasson force-pushed the try-construct-cleanup branch from 7d8f91e to 998901e Compare April 1, 2026 11:31
eboasson and others added 20 commits April 21, 2026 11:48
See XTypes 1.3 table 19:

  Any members in T1 and T2 that have the same name also have the same ID and any members
  with the same ID also have the same name.

We only looked at the name for members with the same ID (the second half of the
sentence). This commits adds a check that the other way round.

Checking the name hash is not a correct implementation of this requirement, but
assignability is supposed to be determined from the minimal type ids, and this is
therefore all we have.
This allows DDS_DYNAMIC_MEMBER_ID_AUTO as the member_id argument when updating a member
and interprets it as the most recently added member.
Co-authored-by: Dennis Potman <dennis@zettascale.tech>
Signed-off-by: Erik Boasson <eb@ilities.com>
This is still very rudimentary with bad error handling, undocumented limitations and
certainly some leaks in error paths (and perhaps in non-error paths), but it has already
proven to be quite useful.
Microsoft started warning, now Clang. It is only a matter of time until GCC and other
compilers add a warning. This

* replaces all macros used in generated code by #defines,
* changes the name of the enum symbols from DDS_OP to DDS_SOP (etc.),

This ensures the generated code compiles cleanly and that the CDR serializer code still
checks all enum opcodes and types are covered in switch statements.
1. xtypes v1.3 specification, 7.3.2 XML Type Representation, Design rationale, the XML specification should be just a direct translation from the IDL specification, therefore the IDL specification should apply
2. IDL v4.2 specification, 7.4.2 Keywords, "default" is a default keyword, and any identifiers that collide with a keyword are illegal, e.g. boolean is a valid keyword, Boolean and BooLean would be illegal identifiers
3. IDL v4.2 specification, 7.4.1.4.4.4.3 Enumerations, enumerators are classified as identifiers

Therefore an enum with a literal named "default" would be an illegal enum and there would be a problem somewhere else in Cyclone for not catching it
@eboasson eboasson force-pushed the try-construct-cleanup branch from 6576c53 to 7016737 Compare April 21, 2026 14:03
@eboasson eboasson force-pushed the try-construct-cleanup branch from e6e79c0 to 0a4345d Compare May 2, 2026 11:39
eboasson and others added 7 commits May 4, 2026 10:04
Discriminant values outside the 32-bit range are not supported yet and
IDLC probably has some issues, but it mostly works
The generated union discriminator labels for negative 8- and 16-bit
discriminants were incompatible with the (de)serializer because the
former sign extended them, whereas the latter did not. The way this sign
extension was done furthermore caused compile-time warnings for implicit
conversion of signed to unsigned.

It could easily be fixed by also performing the sign extension in
the (de)serializer, but not doing that has a small run-time benefit and
results in slightly simpler code. As these cases didn't work at all
before, it is a reasonable assumption that no-one would benefit from
keeping the generated code unchanged.
This only provides an API function for setting the key flag on the
union. The typebuilder code doesn't yet support generating a topic
descriptor for this.
eboasson added 11 commits May 4, 2026 10:14
This allows defining multiple modules or multiple types at
top-level in a single XML file.
These functions store the created serdata in an out-parameter and return a proper error
code. (On error, the output pointer is set to NULL.)

The functions that return a pointer now wrap these new ones and always return NULL on any
failure. This means that the ugly DDSI_SERDATA_FROM_SER_DISCARD macro is now entirely
opt-in for the serdata implementation and no longer relevant for the rest of the code.
This adds a check to prevent overflow of the multiplication of sequence length and element
size. While it can't overflow given the small factors between in-memory and CDR sizes, the
limited input sizes and the code checking that the sequence length is bounded by the
remaining bytes of the input, the conditions may change in the future.
The "unable to deliver strategy" enum symbols used to be DISCARD_SAMPLE and BLOCK, but
have been remained (in 0.8.999) to DISCARD_DATA and RETRY_UNTIL_DELIVERED.
@eboasson eboasson force-pushed the try-construct-cleanup branch from 0a4345d to f5bbdf8 Compare May 4, 2026 08:20
@eboasson eboasson merged commit e53552f into eclipse-cyclonedds:master May 4, 2026
20 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants