Re: [pygccxml-development] type_traits.has_public_destructor problem
Brought to you by:
mbaas,
roman_yakovenko
|
From: Gustavo C. <gjc...@gm...> - 2008-07-06 20:40:21
|
2008/7/6 Roman Yakovenko <rom...@gm...>:
> On Sun, Jul 6, 2008 at 6:07 PM, Gustavo Carneiro <gjc...@gm...>
> wrote:
> > When parsing a simple class like:
> >
> > /**
> > * \brief a 3d cartesian position vector
> > *
> > * Unit is meters.
> > */
> > class Vector
> > {
> > public:
> > /**
> > * \param _x x coordinate of vector vector
> > * \param _y y coordinate of vector vector
> > * \param _z z coordinate of vector vector
> > *
> > * Create vector vector (_x, _y, _z)
> > */
> > Vector (double _x, double _y, double _z);
> > /**
> > * Create vector vector (0.0, 0.0, 0.0)
> > */
> > Vector ();
> > /**
> > * x coordinate of vector vector
> > */
> > double x;
> > /**
> > * y coordinate of vector vector
> > */
> > double y;
> > /**
> > * z coordinate of vector vector
> > */
> > double z;
> > };
> >
> > pygccxml.declarations.type_traits.has_public_destructor is returning
> False.
> > The class has an implicit public destructor, so pygccxml is wrong
> (0.9.5).
> >
> > In my code I am working around this problem like this:
> >
> > + def _has_public_destructor(self, cls):
> > + for member in cls.get_members():
> > + if isinstance(member, calldef.destructor_t):
> > + if member.access_type != 'public':
> > + return False
> > + return True
> >
> > Regards.
>
> Thanks. Latest CVS version of GCCXML dumps artificial declarations. It
> is the only way to reliably find-out whether a class has public
> destructor or not.
>
> For example, next use case is not covered by the posted code:
>
> struct XXX{
>
> private:
>
> virtual ~XXX(){}
>
> };
>
>
>
> struct YYY : public XXX{
>
> };
I see. I think I can always modify my code; it's just a matter to recursing
into base classes. But I'm too lazy, some other day :P
>
>
>
>
> /*void do_smth(){
>
> YYY y;
>
> }
>
> */
>
>
> SVN version of pygccxml was updated.
>
> I suggest you to switch to the latest versions
Last time I checked, I got numerous cases of implicit constructors not being
reported. It might have been that I was using an old GCCXML CVS (0.9)
version and pygccxml expecting a new CVS snapshot, but I had no time to
test.
Thanks.
--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
|