Skip to content

Fix array declarations in IDL serialization - #6530

Open
vpfkfl753 wants to merge 1 commit into
eProsima:masterfrom
vpfkfl753:hotfix/idl-array-declarators
Open

Fix array declarations in IDL serialization#6530
vpfkfl753 wants to merge 1 commit into
eProsima:masterfrom
vpfkfl753:hotfix/idl-array-declarators

Conversation

@vpfkfl753

Copy link
Copy Markdown

Description

idl_serialize() writes array bounds before the name in typedefs and union members, for example typedef double[9] Covariance;. Reuse the struct-member declaration formatting so the bounds follow the name.

The regression tests cover one- and multidimensional arrays, chained aliases, and labelled/default union members. The alias test also parses the emitted IDL and compares the resulting type.

Tested on Ubuntu 24.04 with GCC 13.3, Debug: both new tests fail before the fix; all 16 IDL serialization tests pass after it. Uncrustify passes. Local line coverage of dynamic_type_idl.cpp increases from 480/590 (81.36%) to 488/599 (81.47%). The linked nightly coverage server timed out, so this comparison uses the local baseline.

Backport: 3.6.x has the same serializer; the patch applies cleanly there.

Fixes #6509.

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • Any new/modified methods have been properly documented using Doxygen.
  • N/A Any new configuration API has an equivalent XML API (with the corresponding XSD extension) No configuration API changes.
  • Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • Changes are API compatible.
  • N/A New feature has been added to the versions.md file (if applicable). Bug fix; no new feature.
  • N/A New feature has been documented/Current behavior is correctly described in the documentation. Restores valid IDL output; no documentation change.
  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • If this is a critical bug fix, backports to the critical-only supported branches have been requested.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

Reuse the struct member declaration formatting for aliases and union
members so array bounds follow the declarator name.

Cover one- and multidimensional arrays, chained aliases, and labelled
and default union members. Check that serialized array aliases parse
back into the same DynamicType.

Fixes eProsima#6509

Signed-off-by: Sungwon Woo <vpfkfl753@gmail.com>
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.

idl_serialize() emits invalid IDL for array typedefs and array union members (typedef double[9] d9; instead of typedef double d9[9];)

1 participant