CastXML / pygccxml

pygccxml is a specialized XML reader that reads the output from CastXML or GCCXML. It provides a simple framework to navigate C++ declarations, using Python classes.
Boost Software License 1.0
129 stars 44 forks source link

Restrict qualifier applied wrongly. #97

Open dermont123 opened 6 years ago

dermont123 commented 6 years ago

Hi, The "__restrict__" qualifier is for linux only and applied to the start of the decl_string, rather than the end. `

if defined( _MSC_VER )

#define RESTRICT_ALIAS \_\_restrict   
#define RESTRICT_ALIAS_RETURN \_\_restrict

else

#define RESTRICT_ALIAS \_\_restrict\_\_
#define RESTRICT_ALIAS_RETURN

endif

class Rest { protected: float RESTRICT_ALIAS restVar; ----- (1) ... }; ` (1) The return_type.declstring output produces the following ie. ::ns::Rest::restVar __restrict_\ float

From class restrict_t def build_decl_string(self, with_defaults=True): return '__restrict__ ' + self.base.build_decl_string(with_defaults) Code using the decl_string does not compile, the restrict qualifier should be applied to the pointer/ref/function not the variable, e.g. def build_decl_string(self, with_defaults=True): if os.name == 'nt': return self.base.build_decl_string(with_defaults) + ' __restrict' else: return self.base.build_decl_string(with_defaults) + ' __restrict__'

dermont123 commented 3 years ago

Any news on this?

tao558 commented 3 years ago

Any news on this?

Starting work on this now. Can I use your above example in a test case?