Contract checking now turned on by default. Some other cleanup.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5313 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a649c7237c
commit
72f738909e
4 changed files with 11 additions and 62 deletions
|
|
@ -78,7 +78,7 @@ int Swig_contract_mode_get() {
|
|||
|
||||
/* Apply contracts */
|
||||
void Swig_contracts(Node *n) {
|
||||
Printf(stdout,"Applying contracts (experimental version)\n");
|
||||
// Printf(stdout,"Applying contracts (experimental version)\n");
|
||||
|
||||
Contracts *a = new Contracts;
|
||||
a->top(n);
|
||||
|
|
@ -551,7 +551,7 @@ int Contracts::emit_contract(Node *n) {
|
|||
ret = ret && AssertModify(n, 1);
|
||||
ret = ret && AssertModify(n, 2);
|
||||
ret = ret && AssertModify(n, 3);
|
||||
ret = ret && InheritModify(n);
|
||||
if (InClass) { ret = ret && InheritModify(n); }
|
||||
if ((InClass) && (!InConstructor) && (!InDestructor)){
|
||||
Setattr(n, "feature:contract_classparm", SWIG_CONTRACT_SET);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,30 +84,6 @@ void emit_args(SwigType *rt, ParmList *l, Wrapper *f) {
|
|||
p = nextSibling(p);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEPRECATED
|
||||
/* Apply the ignore typemap */
|
||||
p = l;
|
||||
while (p) {
|
||||
tm = Getattr(p,"tmap:ignore");
|
||||
if (tm) {
|
||||
Parm *np;
|
||||
Replace(tm,"$target", Getattr(p,"lname"), DOH_REPLACE_ANY);
|
||||
Printv(f->code,tm,"\n",NIL);
|
||||
np = Getattr(p,"tmap:ignore:next");
|
||||
|
||||
/* Deprecate this part later */
|
||||
while (p && (p != np)) {
|
||||
Setattr(p,"ignore","1");
|
||||
p = nextSibling(p);
|
||||
}
|
||||
/* -- end deprecate */
|
||||
|
||||
} else {
|
||||
p = nextSibling(p);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -235,23 +211,6 @@ int emit_num_arguments(ParmList *parms) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DEPRECATED
|
||||
while (p) {
|
||||
/* Ignored arguments */
|
||||
if (Getattr(p,"tmap:ignore")) {
|
||||
p = Getattr(p,"tmap:ignore:next");
|
||||
} else {
|
||||
/* Marshalled arguments */
|
||||
nargs++;
|
||||
if (Getattr(p,"tmap:in")) {
|
||||
p = Getattr(p,"tmap:in:next");
|
||||
} else {
|
||||
p = nextSibling(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* DB 04/02/2003: Not sure this is necessary with tmap:in:numinputs */
|
||||
/*
|
||||
if (parms && (p = Getattr(parms,"emit:varargs"))) {
|
||||
|
|
@ -347,23 +306,6 @@ void emit_mark_varargs(ParmList *l) {
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* -----------------------------------------------------------------------------
|
||||
* replace_args()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
static
|
||||
void replace_args(Parm *p, String *s) {
|
||||
while (p) {
|
||||
String *n = Getattr(p,"name");
|
||||
if (n) {
|
||||
Replace(s,n,Getattr(p,"lname"), DOH_REPLACE_ID);
|
||||
}
|
||||
p = nextSibling(p);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* replace_contract_args. This function replaces argument names in contract
|
||||
specifications. Used in conjunction with the %contract directive. */
|
||||
|
||||
|
|
|
|||
|
|
@ -320,6 +320,8 @@ static Node *first_nontemplate(Node *n) {
|
|||
* Handle swig pragma directives.
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
||||
extern void emit_constant_aggregation(String *s);
|
||||
|
||||
void swig_pragma(char *lang, char *name, char *value) {
|
||||
if (strcmp(lang,"swig") == 0) {
|
||||
if ((strcmp(name,"make_default") == 0) || ((strcmp(name,"makedefault") == 0))) {
|
||||
|
|
@ -1670,6 +1672,7 @@ int Language::classHandler(Node *n) {
|
|||
|
||||
bool hasDirector = Swig_directorclass(n) ? true : false;
|
||||
|
||||
|
||||
/* Emit all of the class members */
|
||||
emit_children(n);
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ static char *usage = (char*)"\
|
|||
-MM - List dependencies, but omit files in SWIG library\n\
|
||||
-makedefault - Create default constructors/destructors (the default)\n\
|
||||
-module <name> - Set module name to <name>\n\
|
||||
-nocontract - Turn off contract checking \n\
|
||||
-nodefault - Do not generate constructors/destructors\n\
|
||||
-noexcept - Do not wrap exception specifiers\n\
|
||||
-noextern - Do not generate extern declarations\n\
|
||||
|
|
@ -273,6 +274,9 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
Delete(package_version);
|
||||
assert(count == 3); // Check version format is correct
|
||||
|
||||
/* Turn on contracts */
|
||||
|
||||
Swig_contract_mode_set(1);
|
||||
Preprocessor_define(vers,0);
|
||||
|
||||
// Check for SWIG_LIB environment variable
|
||||
|
|
@ -458,9 +462,9 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
} else if (strcmp(argv[i],"-dump_tree") == 0) {
|
||||
dump_tree = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-contracts") == 0) {
|
||||
} else if (strcmp(argv[i],"-nocontract") == 0) {
|
||||
Swig_mark_arg(i);
|
||||
Swig_contract_mode_set(1);
|
||||
Swig_contract_mode_set(0);
|
||||
} else if (strcmp(argv[i],"-browse") == 0) {
|
||||
browse = 1;
|
||||
Swig_mark_arg(i);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue