add %exceptionclass and %noexceptionclass directives and manage the feature:exceptionclass in a consistent way
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7548 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3119b1e40e
commit
33a752b0bd
4 changed files with 28 additions and 14 deletions
|
|
@ -5,21 +5,29 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
/* Mark all of them as exception classes */
|
/*
|
||||||
%feature("exceptionclass") exception;
|
Mark all of std exception classes as "exception classes" via
|
||||||
%feature("exceptionclass") bad_exception;
|
the "exceptionclass" feature.
|
||||||
%feature("exceptionclass") logic_error;
|
|
||||||
%feature("exceptionclass") domain_error;
|
If needed, you can disable it by using %noexceptionclass.
|
||||||
%feature("exceptionclass") invalid_argument;
|
*/
|
||||||
%feature("exceptionclass") length_error;
|
%exceptionclass exception;
|
||||||
%feature("exceptionclass") out_of_range;
|
%exceptionclass bad_exception;
|
||||||
%feature("exceptionclass") runtime_error;
|
%exceptionclass logic_error;
|
||||||
%feature("exceptionclass") range_error;
|
%exceptionclass domain_error;
|
||||||
%feature("exceptionclass") overflow_error;
|
%exceptionclass invalid_argument;
|
||||||
%feature("exceptionclass") underflow_error;
|
%exceptionclass length_error;
|
||||||
|
%exceptionclass out_of_range;
|
||||||
|
%exceptionclass runtime_error;
|
||||||
|
%exceptionclass range_error;
|
||||||
|
%exceptionclass overflow_error;
|
||||||
|
%exceptionclass underflow_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
struct exception
|
struct exception
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,10 @@
|
||||||
#endif
|
#endif
|
||||||
#define %noexception %feature("except","")
|
#define %noexception %feature("except","")
|
||||||
|
|
||||||
|
#define %exceptionclass %feature("exceptionclass","1")
|
||||||
|
#define %noexceptionclass %feature("exceptionclass","0")
|
||||||
|
|
||||||
|
|
||||||
#define %newobject %feature("new")
|
#define %newobject %feature("new")
|
||||||
|
|
||||||
/* Warnings */
|
/* Warnings */
|
||||||
|
|
|
||||||
|
|
@ -467,7 +467,9 @@ class Allocate : public Dispatcher {
|
||||||
}
|
}
|
||||||
Node *c = Swig_symbol_clookup(t,0);
|
Node *c = Swig_symbol_clookup(t,0);
|
||||||
if (c) {
|
if (c) {
|
||||||
Setattr(c,"feature:exceptionclass","1");
|
if (!Getattr(c,"feature:exceptionclass")) {
|
||||||
|
Setattr(c,"feature:exceptionclass","1");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
Delete(t);
|
Delete(t);
|
||||||
|
|
|
||||||
|
|
@ -1954,7 +1954,7 @@ public:
|
||||||
have_constructor = 0;
|
have_constructor = 0;
|
||||||
have_repr = 0;
|
have_repr = 0;
|
||||||
|
|
||||||
if (Getattr(n,"feature:exceptionclass")) {
|
if (checkAttribute(n,"feature:exceptionclass","1")) {
|
||||||
classic = 1;
|
classic = 1;
|
||||||
modern = 0;
|
modern = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue