Discussion:
[Swig-devel] Issue #526 : C++11 noexcept should propagate to director classes
Christophe Duvernois
2017-04-04 13:28:36 UTC
Permalink
Hi,

I would like to see this issue fixed.I can do a fix implementation but I
need some help to get started.

I play a little with swig source code and it seems the Swig_method_decl is
the place for generating the missing noexcept.

I guess, we probably should have the information in SwigType *decl like for
the const keyword ?

It seems we already have the information from the parser
for example in the method :
int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super)

a simple
fprintf(stderr, "%s:%d %s\n", __FUNCTION__, __LINE__, Char(Getattr(n,
"noexcept")) ); will return true if noexcept is here.

but I have no idea here where to link the information ...

Any hints will be appreciated.

Regards,
Christophe Duvernois
William S Fulton
2017-04-25 06:10:42 UTC
Permalink
On 4 April 2017 at 14:28, Christophe Duvernois <
Post by Christophe Duvernois
Hi,
I would like to see this issue fixed.I can do a fix implementation but I
need some help to get started.
I play a little with swig source code and it seems the Swig_method_decl is
the place for generating the missing noexcept.
I guess, we probably should have the information in SwigType *decl like
for the const keyword ?
It seems we already have the information from the parser
int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super)
a simple
fprintf(stderr, "%s:%d %s\n", __FUNCTION__, __LINE__, Char(Getattr(n,
"noexcept")) ); will return true if noexcept is here.
but I have no idea here where to link the information ...
Using Getattr(n, "noexcept") will indeed indicate whether or not a noexcept
needs generating. I would add this new code wherever we have Getattr(n,
"throw") as noexcept replaces exception specifications which are in a
node's "throw" attribute. In this case, the code is shortly after the call
to Swig_method_decl in PYTHON::classDirectorMethod.

William

Loading...