[Rock-dev] clang vs. typelib

Sylvain Joyeux bir.sylvain at gmail.com
Fri Jul 18 14:35:15 CEST 2014


On Fri, Jul 18, 2014 at 2:23 PM, Martin Zenzes <martin.zenzes at dfki.de> wrote:
> In the moment (as far as i understand this) _all_ the records and
> typedefs from the whole include-chain triggered by a single
> "import_from" are stored in a database to be read by orogen. This allows
> usage of "struct timespec" although no one explicitly did "import_from
> time.h". This also allowed usage of "uint16_t" for properties although
> no one explicitly did "import_from stdint.h". This was caused by how
> gccxml works. Is this parse-and-store-everything still desired?
Wrong.

The database contains all the types that are defined in the explicitly
given headers (import_types_from) as well as all the types that are
necessary to define them. If you have a type in your header that uses
timespec, it will end in the database, otherwise it gets thrown out.

> - _all_ mappings "typedef" -> "CanonicalName" declared somewhere in the
> include-chain of the given header file.
All typedefs pointing to a type that should be included in the database.

> - give all enum-values as strings
As string-value pairs.

> Additionally reject Records with:
> - pointers
> - virtual functions
> - references
> - bitfields?
Not *exactly*.

Typelib and orogen allows to define "opaque types", which is basically
a way to name a type and tell the system that it is not able to handle
it BUT that it is of interest. In orogen, opaques get converted to a
typelib-compatible type
(http://rock-robotics.org/master/documentation/orogen/opaque_types.html)

During parsing, one MUST define the types that use Records that are
opaques, even if these opaques have pointers, references, virtual
functions, ...

To make it usable for the user, it is allowed to specify an opaque
from a typedef name (i.e. the user says "make base/Vector3d opaque"
instead of Eigen::MatrixBase<double,3,0,0,...>). That also has to be
handled during import.

Finally, the type names are typelib-normalized, not C++-normalized, so
the importer has to handle the convertion. It is currently done in
Ruby (because the gccxml importer is written in Ruby)

> And warn about Records with:
> - FieldTypes with architecture-dependent size, like int
I would prefer leaving that to as post-processing pass instead of
embedding it in the importer.

Sylvain


More information about the Rock-dev mailing list