duplicate symbol error with rtiddsgen

4 posts / 0 new
Last post
Offline
Last seen: 10 months 3 days ago
Joined: 02/07/2020
Posts: 21
duplicate symbol error with rtiddsgen

Connext Version: 7.2.0

Running the following command (simplified to show just the key arguments):

rtiddsgen -strict -language C++11 -unboundedSupport -inputXml types.xml

I get the following error:

types.xml line 160 duplicate symbol 'Tx1' was previously defined in file types.xml line 5

Looking in the XML, I have two enums defined as:

<enum name="FirstEnum">
  <enumerator name="TX1" value="0" />
  ...
</enum>

And 

<enum name="SecondEnum">
  <enumerator name="Tx1" value="93" />
  ...
</enum>

I don't see why these would be duplicate symbols.  If I turn off strict generatrion, then I receive the following unhelpful warning:

WARN com.rti.ndds.nddsgen.antlr.IdlSymbolTable Factory identifier, collide with an idl keyword (Case-Insensitive). This is not compliant with the XTypes specification. You can make this message an error by using the -strict flag

and the enum class definitions are created correctly.

I suspect this is a bug in rtiddsgen, as the target language is case-sensitive, and the use of enum classes ensures the symbols wouldn't collide even if they were they were the same.

Offline
Last seen: 10 months 3 days ago
Joined: 02/07/2020
Posts: 21

I'm assuming the warning message is referring to this document.  If thee's a statement indicating that enumerators of different enums must be unque (case-insensitive), I didn't see it.

Offline
Last seen: 2 days 16 hours ago
Joined: 04/23/2014
Posts: 58

Hi Seairth,

The Xtypes document that you linked mentions that the enums should be compatible with the IDL spec, here the link. The IDL spec, mentions in the section "7.4.1.4.4.4.3 Enumerations" how to define the enum, which includes an identifier (the name of the element). Then, the section "7.2.3 Identifiers" mentions that identifiers are case insensitive. This is done because IDL is language independent, so it allows also a translation between IDL and case-insensitive languages.

This means that the datamodel that you put is not Xtypes compliant and that is why rtiddsgen throws that error/warning. If you disable the strict error checking, does rtiddsgen generate code? As you have mentioned, C++11 is case-sensitive and there shouldn't be any issues. However, you have to bear in mind that you datatype may not be portable to other languages such as Ada. The recommendation is to follow the spec and use different identifiers for your enums.

Offline
Last seen: 10 months 3 days ago
Joined: 02/07/2020
Posts: 21

Thanks for the additional reference.  I did read throuth the IDL spec, and I incorrectly interpreted the enum statement itselt to be a scope.  Searching further, I found an example (enum constants in 7.4.1.4.3) that show this not to be the case.  I will take this issue up with the authors of the IDL.