OpenAADL / osate2-ocarina

Ocarina Plugin for OSATE2
Eclipse Public License 2.0
7 stars 3 forks source link

Report a warning instead of an error when instantiating incomplete features #6

Closed philip-alldredge closed 12 years ago

philip-alldredge commented 12 years ago

When trying to instantiate a model that contains a bus access feature that does not reference a type, for example:

 ba1: requires bus access;

Ocarina report "cannot be properly instantiated". Is this intended behavior? I would like to be able to check REAL Constraints, etc on such models. Currently I have a model that had those features but even though they are not referenced anywhere(there are no connections that use them), I can not instantiate the model with Ocarina.

yoogx commented 12 years ago

Yes, this is the intended behavior. Ocarina is first to be viewed as a model compiler, aiming at code generation. Therefore, all types shall be clearly defined. This can be changed, of course. Can you please post a small reproducer so that I can change the behavior? Thanks

philip-alldredge commented 12 years ago

Sure. I wasn't able to create the same error with my reproducer, but I have 2 versions that produce different error messages.

First one:

package Reproducer
public
system A
features
    ba1: requires bus access;
end A;

system implementation A.impl
end A.impl;

end Reproducer;

Second one:

package Reproducer
public
system A
features
    ba1: requires bus access;
end A;

system B
end B;

system implementation B.impl
end B.impl;

system implementation A.impl
subcomponents
    b1: system B.impl;
end A.impl;

end Reproducer;
philip-alldredge commented 12 years ago

The command line being use is: ocarina -real_continue_eval -aadlv2 -g real_theorem -r A.impl test2.aadl

yoogx commented 12 years ago

OK, here is the "correct" reproducer

package Reproducer public system A end A;

system B features ba1: requires bus access; end B;

system implementation B.impl end B.impl;

system implementation A.impl subcomponents b1: system B.impl; end A.impl;

end Reproducer;

Note that per Ocarina design, a "root" system is a system implementation whose corresponding type has no feature. The rationale is that we consider only "closed" systems

I investigate this bug. Regarding the definition of root system, I'm pretty sure you'll ask me to change it as well ;)

philip-alldredge commented 12 years ago

I was not aware of that. Thanks for fixing the reproducer. I hate to disappoint, but I don't think i'll ask you to change your definition of a root system. It might be helpful in some cases, but a clear explanation to the user would probably be just as effective.

yoogx commented 12 years ago

Bug resolved, here is the new output

neraka-2% ocarina -aadlv2 -i -r A.impl t3.aadl t3.aadl:8:05: warning: ba1 cannot be properly instantiated ocarina: Total: 0 error and 1 warning

Note that as a consequence of this patch, any further manipulation of ba1 could lead to a segfault, but this will be easy to correct. A patched variant of Ocarina shall be available thursday.

philip-alldredge commented 12 years ago

Thanks!

yoogx commented 12 years ago

Since the behavior now meets your expectation, I close the ticket