Summary: | IFR does not handle recursive types. | ||
---|---|---|---|
Product: | TAO | Reporter: | Bogdan Jeram <bjeram> |
Component: | Interface Repository | Assignee: | Jeff Parsons <j.parsons> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bjeram, jwillemsen, yurii.kantonistov |
Priority: | P3 | ||
Version: | 1.7.8 | ||
Hardware: | x86 | ||
OS: | Linux | ||
Attachments: |
Example with recursive structure which causes problerm
Patch for forwad declared unions and strcuts Test IDL file for testing forward declaration support |
Description
Bogdan Jeram
2001-06-19 06:50:04 CDT
I've changed the summary of this bug to the more general and appropriate statement that the IFR does not handle recursive types. It's on my TODO list, but this is as good a time as any to make the Bugzilla entry. I'm leaving the long example IDL file, but a much shorter one will do to reproduce the problem. Accepted. Corrected the TAO component. This is an Interface Repository problem, not an Implementation Repository problem. *** Bug 1579 has been marked as a duplicate of this bug. *** *** Bug 1604 has been marked as a duplicate of this bug. *** *** Bug 1657 has been marked as a duplicate of this bug. *** Support added some time ago by Simon Massey <sma@prismtech.com>. Created attachment 885 [details]
Example with recursive structure which causes problerm
It looks like IFR still does not support recursive types.
It looks like IFR still has problem with IFR. Please try to load the attached IDL. Here is a simpler exaple that causes the problem to IFR: struct ET; typedef sequence<ET> LinkedList; /* this is the problematic part */ typedef string RTY; struct ET { double value; }; interface Ex { LinkedList testOp(); /* but here it fails */ }; In case of loading the above IDL the command "tao_ifr" fails with the following messages: (21839|3086829264) EXCEPTION, ifr_adding_visitor_operation::visit_operation system exception, ID 'IDL:omg.org/CORBA/COMM_FAILURE:1.0' TAO exception, minor code = 6 (failed to recv request response; ENOENT), completed = MAYBE (ifr_adding_visitor.cpp:110) ifr_adding_visitor::visit_scope - failed to accept visitor (ifr_adding_visitor.cpp:2763) ifr_adding_visitor::create_interface_def - visit_scope failed (ifr_adding_visitor.cpp:110) ifr_adding_visitor::visit_scope - failed to accept visitor (ifr_adding_visitor.cpp:2281) ifr_adding_visitor::visit_root - visit_scope failed (be_produce.cpp:230) BE_produce - failed to accept adding visitor Fatal Error - Aborting Actually it is problem with forward declaration of structs and unions when we want to use either of them when we define a sequence. union ET; typedef sequence<ET> MySeq; // here is the problem union ET switch(long) { case 0: double value; case 1: string b; }; interface tt { MySeq opT(); // here the IFR will crash }; The problem is that link to internal (IFR) information about ET is redefined when forward declaration is replaced with the real one, but the sequence still refer to the old one. This shouldn't be too hard to fix, but I'm surprised that it hasn't showed up before. This Bugzilla entry dates to before support for recursive types was added to the IFR. When this support was added, you'd think this bug would be the first one that would show up. What version of TAO are you using? At the moment we are still with version 1.6.5 Okay, this is mine to fix. I'll be tied up with other work for the next few weeks, but I want to get to this before we release TAO 2.0 sometime this summer. Thanks for reporting it. Created attachment 1243 [details]
Patch for forwad declared unions and strcuts
I attached a patch that should fix the probnlem with forward declaration of
struct and unions.
The patch, if finds out that a structure or union is forward declaration, does not destroy it from IFR, but just simply add members. So that "the reference" stays the same.
Please check if the patch is good.
Here is a simple IDL test that can be put in the TAO test some where.
struct ET;
union UT;
typedef sequence<ET> LinkedList;
typedef sequence<UT> UnionLinkedList;
struct ET
{
double value;
};
union UT switch(long)
{
case 0:
double value;
case 1:
string b;
};
interface Ex
{
LinkedList testOp1();
UnionLinkedList testOp2();
};
Created attachment 1249 [details]
Test IDL file for testing forward declaration support
The IDL file that can be used to test forward declaration properly works in any version of TAO IFR. Just try to load it using tao_ifr command.
Today, I tested VERSION x.7.8 of ACE+TAO, and it looks that the problem is fixed = forward declaration of struct and union are handled w/o problem. Thank you for the fix, so probably the bug can be closed. set to fixed |