Remove redundant code highlighted by warnings in gcc-4.6

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12536 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2011-03-14 07:22:08 +00:00
commit a63d456f8a
25 changed files with 19 additions and 157 deletions

View file

@ -2768,7 +2768,6 @@ types_directive : TYPES LPAREN parms RPAREN stringbracesemi {
template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN valparms GREATERTHAN SEMI { template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN valparms GREATERTHAN SEMI {
Parm *p, *tp; Parm *p, *tp;
Node *n; Node *n;
Node *tnode = 0;
Symtab *tscope = 0; Symtab *tscope = 0;
int specialized = 0; int specialized = 0;
@ -2929,7 +2928,6 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
} }
Delattr(templnode,"templatetype"); Delattr(templnode,"templatetype");
Setattr(templnode,"template",nn); Setattr(templnode,"template",nn);
tnode = templnode;
Setfile(templnode,cparse_file); Setfile(templnode,cparse_file);
Setline(templnode,cparse_line); Setline(templnode,cparse_line);
Delete(temparms); Delete(temparms);

View file

@ -269,7 +269,6 @@ static void String_clear(DOH *so) {
static int String_insert(DOH *so, int pos, DOH *str) { static int String_insert(DOH *so, int pos, DOH *str) {
String *s; String *s;
char *nstr;
int len; int len;
char *data; char *data;
@ -289,7 +288,6 @@ static int String_insert(DOH *so, int pos, DOH *str) {
data = (char *) (str); data = (char *) (str);
len = (int) strlen(data); len = (int) strlen(data);
} }
nstr = s->str;
if (pos < 0) if (pos < 0)
pos = 0; pos = 0;

View file

@ -2500,11 +2500,8 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
Delete(parsed); Delete(parsed);
int isPtrReturn = 0;
if (cl_t) { if (cl_t) {
lclass = lookup_defined_foreign_ltype(cl_t); lclass = lookup_defined_foreign_ltype(cl_t);
isPtrReturn = 1;
} }
int ff_foreign_ptr = 0; int ff_foreign_ptr = 0;
@ -2523,17 +2520,8 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
Replaceall(wrap->code, "$out_fftype", out_ffitype); Replaceall(wrap->code, "$out_fftype", out_ffitype);
if (deref_out_ffitype) if (deref_out_ffitype)
Replaceall(wrap->code, "$*out_fftype", deref_out_ffitype); Replaceall(wrap->code, "$*out_fftype", deref_out_ffitype);
// if(Replaceall(wrap->code,"$lclass", lclass) && !isPtrReturn) {
// Swig_warning(WARN_LANG_RETURN_TYPE,Getfile(n), Getline(n),
// "While Wrapping %s, replaced a $lclass reference when return type is non-pointer %s!\n",
// Getattr(n,"name"), cl_t);
// }
Replaceall(wrap->code, "$body", NewStringf("(swig-ff-call%s)", wrap->locals)); Replaceall(wrap->code, "$body", NewStringf("(swig-ff-call%s)", wrap->locals));
// Replaceall(wrap->code,"$body",
// (!Strcmp(result_type,"void") ?
// NewStringf("(swig-ff-call%s)", wrap->locals) :
// NewStringf("(push (swig-ff-call%s) ACL_result)", wrap->locals)));
String *ldestructor = Copy(lclass); String *ldestructor = Copy(lclass);
if (ff_foreign_ptr) if (ff_foreign_ptr)
Replaceall(ldestructor, ldestructor, "cl::identity"); Replaceall(ldestructor, ldestructor, "cl::identity");
@ -2870,23 +2858,13 @@ int ALLEGROCL::globalvariableHandler(Node *n) {
// String *name = Getattr(n, "name"); // String *name = Getattr(n, "name");
SwigType *type = Getattr(n, "type"); SwigType *type = Getattr(n, "type");
SwigType *ctype;
SwigType *rtype = SwigType_typedef_resolve_all(type); SwigType *rtype = SwigType_typedef_resolve_all(type);
int pointer_added = 0;
if (SwigType_isclass(rtype)) { if (SwigType_isclass(rtype)) {
SwigType_add_pointer(type); SwigType_add_pointer(type);
SwigType_add_pointer(rtype); SwigType_add_pointer(rtype);
pointer_added = 1;
} }
ctype = SwigType_str(type, 0);
// EXPORT <SwigType_str> <mangled_name>;
// <SwigType_str> <mangled_name> = <name>;
// Printf(f_runtime, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name,
// ctype, mangled_name, (pointer_added ? "&" : ""), name);
Printf(f_clwrap, "(swig-defvar \"%s\" \"%s\" :type %s)\n", Printf(f_clwrap, "(swig-defvar \"%s\" \"%s\" :type %s)\n",
Getattr(n, "sym:name"), Getattr(n, "sym:name"), ((SwigType_isconst(type)) ? ":constant" : ":variable")); Getattr(n, "sym:name"), Getattr(n, "sym:name"), ((SwigType_isconst(type)) ? ":constant" : ":variable"));

View file

@ -386,10 +386,6 @@ class Allocate:public Dispatcher {
} }
Node *c = firstChild(cls); Node *c = firstChild(cls);
String *kind = Getattr(cls, "kind");
int mode = PUBLIC;
if (kind && (Strcmp(kind, "class") == 0))
mode = PRIVATE;
while (c) { while (c) {
if (Getattr(c, "error") || GetFlag(c, "feature:ignore")) { if (Getattr(c, "error") || GetFlag(c, "feature:ignore")) {
@ -457,13 +453,6 @@ class Allocate:public Dispatcher {
} }
} }
if (Strcmp(nodeType(c), "access") == 0) {
kind = Getattr(c, "kind");
if (Strcmp(kind, "public") == 0)
mode = PUBLIC;
else
mode = PRIVATE;
}
c = nextSibling(c); c = nextSibling(c);
} }
/* Look for methods in base classes */ /* Look for methods in base classes */

View file

@ -684,9 +684,6 @@ int CHICKEN::variableWrapper(Node *n) {
String *overname = 0; String *overname = 0;
String *scmname; String *scmname;
int num_required;
int num_arguments;
scmname = NewString(iname); scmname = NewString(iname);
Replaceall(scmname, "_", "-"); Replaceall(scmname, "_", "-");
@ -705,10 +702,6 @@ int CHICKEN::variableWrapper(Node *n) {
emit_attach_parmmaps(l, f); emit_attach_parmmaps(l, f);
Setattr(n, "wrap:parms", l); Setattr(n, "wrap:parms", l);
/* Get number of required and total arguments */
num_arguments = emit_num_arguments(l);
num_required = emit_num_required(l);
// evaluation function names // evaluation function names
Append(wname, Swig_name_wrapper(iname)); Append(wname, Swig_name_wrapper(iname));
if (overname) { if (overname) {
@ -845,9 +838,6 @@ int CHICKEN::constantWrapper(Node *n) {
String *rvalue; String *rvalue;
SwigType *nctype; SwigType *nctype;
int num_required;
int num_arguments;
scmname = NewString(iname); scmname = NewString(iname);
Replaceall(scmname, "_", "-"); Replaceall(scmname, "_", "-");
@ -903,10 +893,6 @@ int CHICKEN::constantWrapper(Node *n) {
emit_attach_parmmaps(l, f); emit_attach_parmmaps(l, f);
Setattr(n, "wrap:parms", l); Setattr(n, "wrap:parms", l);
/* Get number of required and total arguments */
num_arguments = emit_num_arguments(l);
num_required = emit_num_required(l);
// evaluation function names // evaluation function names
// Check for interrupts // Check for interrupts
@ -1382,12 +1368,10 @@ void CHICKEN::dispatchFunction(Node *n) {
SortList(flist, compareTypeLists); SortList(flist, compareTypeLists);
String *clos_name; String *clos_name;
int construct = 0;
if (have_constructor && !has_constructor_args) { if (have_constructor && !has_constructor_args) {
has_constructor_args = 1; has_constructor_args = 1;
constructor_dispatch = NewStringf("%s@SWIG@new@dispatch", short_class_name); constructor_dispatch = NewStringf("%s@SWIG@new@dispatch", short_class_name);
clos_name = Copy(constructor_dispatch); clos_name = Copy(constructor_dispatch);
construct = 1;
Printf(clos_methods, "(declare (hide %s))\n", clos_name); Printf(clos_methods, "(declare (hide %s))\n", clos_name);
} else if (in_class) } else if (in_class)
clos_name = NewString(member_name); clos_name = NewString(member_name);

View file

@ -646,7 +646,6 @@ public:
UpcallData *addUpcallMethod(String *imclass_method, String *class_method, String *decl, String *overloaded_name) { UpcallData *addUpcallMethod(String *imclass_method, String *class_method, String *decl, String *overloaded_name) {
UpcallData *udata; UpcallData *udata;
String *imclass_methodidx;
String *class_methodidx; String *class_methodidx;
Hash *new_udata; Hash *new_udata;
String *key = NewStringf("%s|%s", imclass_method, decl); String *key = NewStringf("%s|%s", imclass_method, decl);
@ -659,7 +658,6 @@ public:
return Getattr(udata, "methodoff"); return Getattr(udata, "methodoff");
} }
imclass_methodidx = NewStringf("%d", n_dmethods);
class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod); class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod);
n_dmethods++; n_dmethods++;
@ -668,10 +666,6 @@ public:
Setattr(dmethods_table, key, new_udata); Setattr(dmethods_table, key, new_udata);
Setattr(new_udata, "method", Copy(class_method)); Setattr(new_udata, "method", Copy(class_method));
// TODO: remove fdesc
// Setattr(new_udata, "fdesc", Copy(class_desc));
// Setattr(new_udata, "imclass_method", Copy(imclass_method));
// Setattr(new_udata, "imclass_methodidx", imclass_methodidx);
Setattr(new_udata, "class_methodidx", class_methodidx); Setattr(new_udata, "class_methodidx", class_methodidx);
Setattr(new_udata, "decl", Copy(decl)); Setattr(new_udata, "decl", Copy(decl));
Setattr(new_udata, "overname", Copy(overloaded_name)); Setattr(new_udata, "overname", Copy(overloaded_name));
@ -736,7 +730,6 @@ public:
String *body = NewString(""); String *body = NewString("");
String *im_outattributes = 0; String *im_outattributes = 0;
int num_arguments = 0; int num_arguments = 0;
int num_required = 0;
bool is_void_return; bool is_void_return;
String *overloaded_name = getOverloadedName(n); String *overloaded_name = getOverloadedName(n);
@ -815,7 +808,6 @@ public:
/* Get number of required and total arguments */ /* Get number of required and total arguments */
num_arguments = emit_num_arguments(l); num_arguments = emit_num_arguments(l);
num_required = emit_num_required(l);
int gencomma = 0; int gencomma = 0;
// Now walk the function parameter list and generate code to get arguments // Now walk the function parameter list and generate code to get arguments
@ -2707,7 +2699,6 @@ public:
String *return_type = NewString(""); String *return_type = NewString("");
String *function_code = NewString(""); String *function_code = NewString("");
int num_arguments = 0; int num_arguments = 0;
int num_required = 0;
String *overloaded_name = getOverloadedName(n); String *overloaded_name = getOverloadedName(n);
String *func_name = NULL; String *func_name = NULL;
bool setter_flag = false; bool setter_flag = false;
@ -2767,7 +2758,6 @@ public:
/* Get number of required and total arguments */ /* Get number of required and total arguments */
num_arguments = emit_num_arguments(l); num_arguments = emit_num_arguments(l);
num_required = emit_num_required(l);
bool global_or_member_variable = global_variable_flag || (wrapping_member_flag && !enum_constant_flag); bool global_or_member_variable = global_variable_flag || (wrapping_member_flag && !enum_constant_flag);
int gencomma = 0; int gencomma = 0;
@ -4020,7 +4010,6 @@ public:
int classDirectorDestructor(Node *n) { int classDirectorDestructor(Node *n) {
Node *current_class = getCurrentClass(); Node *current_class = getCurrentClass();
String *full_classname = Getattr(current_class, "name");
String *classname = Swig_class_name(current_class); String *classname = Swig_class_name(current_class);
Wrapper *w = NewWrapper(); Wrapper *w = NewWrapper();
@ -4032,22 +4021,11 @@ public:
Printf(w->def, "SwigDirector_%s::~SwigDirector_%s() {\n", classname, classname); Printf(w->def, "SwigDirector_%s::~SwigDirector_%s() {\n", classname, classname);
} }
/* Ensure that correct directordisconnect typemap's method name is called
* here: */
const String *disconn_tm = NULL;
Node *disconn_attr = NewHash();
String *disconn_methodname = NULL;
disconn_tm = typemapLookup(n, "directordisconnect", full_classname, WARN_NONE, disconn_attr);
disconn_methodname = Getattr(disconn_attr, "tmap:directordisconnect:methodname");
Printv(w->code, "}\n", NIL); Printv(w->code, "}\n", NIL);
Wrapper_print(w, f_directors); Wrapper_print(w, f_directors);
DelWrapper(w); DelWrapper(w);
Delete(disconn_attr);
Delete(classname); Delete(classname);
return SWIG_OK; return SWIG_OK;
} }

View file

@ -1506,7 +1506,6 @@ public:
String *outarg = NewString(""); String *outarg = NewString("");
String *body = NewString(""); String *body = NewString("");
int num_arguments = 0; int num_arguments = 0;
int num_required = 0;
bool is_void_return; bool is_void_return;
String *overloaded_name = getOverloadedName(n); String *overloaded_name = getOverloadedName(n);
@ -1581,7 +1580,6 @@ public:
/* Get number of required and total arguments */ /* Get number of required and total arguments */
num_arguments = emit_num_arguments(l); num_arguments = emit_num_arguments(l);
num_required = emit_num_required(l);
int gencomma = 0; int gencomma = 0;
// Now walk the function parameter list and generate code to get arguments // Now walk the function parameter list and generate code to get arguments
@ -2917,7 +2915,6 @@ private:
String *return_type = NewString(""); String *return_type = NewString("");
String *function_code = NewString(""); String *function_code = NewString("");
int num_arguments = 0; int num_arguments = 0;
int num_required = 0;
String *overloaded_name = getOverloadedName(n); String *overloaded_name = getOverloadedName(n);
String *func_name = NULL; String *func_name = NULL;
String *pre_code = NewString(""); String *pre_code = NewString("");
@ -2973,7 +2970,6 @@ private:
/* Get number of required and total arguments */ /* Get number of required and total arguments */
num_arguments = emit_num_arguments(l); num_arguments = emit_num_arguments(l);
num_required = emit_num_required(l);
int gencomma = 0; int gencomma = 0;
@ -3716,7 +3712,6 @@ private:
String *decl, String *overloaded_name, String *return_type, String *param_list) { String *decl, String *overloaded_name, String *return_type, String *param_list) {
UpcallData *udata; UpcallData *udata;
String *imclass_methodidx;
String *class_methodidx; String *class_methodidx;
Hash *new_udata; Hash *new_udata;
String *key = NewStringf("%s|%s", imclass_method, decl); String *key = NewStringf("%s|%s", imclass_method, decl);
@ -3729,7 +3724,6 @@ private:
return Getattr(udata, "methodoff"); return Getattr(udata, "methodoff");
} }
imclass_methodidx = NewStringf("%d", n_dmethods);
class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod); class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod);
n_dmethods++; n_dmethods++;

View file

@ -402,7 +402,6 @@ String *emit_action(Node *n) {
String *tm; String *tm;
String *action; String *action;
String *wrap; String *wrap;
SwigType *rt;
ParmList *catchlist = Getattr(n, "catchlist"); ParmList *catchlist = Getattr(n, "catchlist");
/* Look for fragments */ /* Look for fragments */
@ -440,9 +439,6 @@ String *emit_action(Node *n) {
action = Getattr(n, "wrap:action"); action = Getattr(n, "wrap:action");
assert(action != 0); assert(action != 0);
/* Get the return type */
rt = Getattr(n, "type");
/* Emit contract code (if any) */ /* Emit contract code (if any) */
if (Swig_contract_mode_get()) { if (Swig_contract_mode_get()) {
/* Preassertion */ /* Preassertion */

View file

@ -1397,7 +1397,6 @@ private:
} }
Printv(current, Getattr(parms, "lname"), NULL); Printv(current, Getattr(parms, "lname"), NULL);
String *last = NULL;
int vc = 0; int vc = 0;
for (Iterator bi = First(base); bi.item; bi = Next(bi)) { for (Iterator bi = First(base); bi.item; bi = Next(bi)) {
Printf(actioncode, " %s *swig_b%d = (%s *)%s;\n", bi.item, vc, bi.item, current); Printf(actioncode, " %s *swig_b%d = (%s *)%s;\n", bi.item, vc, bi.item, current);
@ -1405,7 +1404,6 @@ private:
current = NewString(""); current = NewString("");
Printf(current, "swig_b%d", vc); Printf(current, "swig_b%d", vc);
++vc; ++vc;
last = bi.item;
} }
String *code = Copy(Getattr(n, "wrap:action")); String *code = Copy(Getattr(n, "wrap:action"));

View file

@ -808,7 +808,6 @@ public:
String *outarg = NewString(""); String *outarg = NewString("");
String *body = NewString(""); String *body = NewString("");
int num_arguments = 0; int num_arguments = 0;
int num_required = 0;
int gencomma = 0; int gencomma = 0;
bool is_void_return; bool is_void_return;
String *overloaded_name = getOverloadedName(n); String *overloaded_name = getOverloadedName(n);
@ -885,9 +884,7 @@ public:
Printf(imclass_class_code, " public final static native %s %s(", im_return_type, overloaded_name); Printf(imclass_class_code, " public final static native %s %s(", im_return_type, overloaded_name);
/* Get number of required and total arguments */
num_arguments = emit_num_arguments(l); num_arguments = emit_num_arguments(l);
num_required = emit_num_required(l);
// Now walk the function parameter list and generate code to get arguments // Now walk the function parameter list and generate code to get arguments
for (i = 0, p = l; i < num_arguments; i++) { for (i = 0, p = l; i < num_arguments; i++) {
@ -2619,7 +2616,6 @@ public:
String *return_type = NewString(""); String *return_type = NewString("");
String *function_code = NewString(""); String *function_code = NewString("");
int num_arguments = 0; int num_arguments = 0;
int num_required = 0;
String *overloaded_name = getOverloadedName(n); String *overloaded_name = getOverloadedName(n);
String *func_name = NULL; String *func_name = NULL;
bool setter_flag = false; bool setter_flag = false;
@ -2667,7 +2663,6 @@ public:
/* Get number of required and total arguments */ /* Get number of required and total arguments */
num_arguments = emit_num_arguments(l); num_arguments = emit_num_arguments(l);
num_required = emit_num_required(l);
bool global_or_member_variable = global_variable_flag || (wrapping_member_flag && !enum_constant_flag); bool global_or_member_variable = global_variable_flag || (wrapping_member_flag && !enum_constant_flag);
int gencomma = 0; int gencomma = 0;
@ -4227,11 +4222,10 @@ public:
/* Ensure that correct directordisconnect typemap's method name is called /* Ensure that correct directordisconnect typemap's method name is called
* here: */ * here: */
const String *disconn_tm = NULL;
Node *disconn_attr = NewHash(); Node *disconn_attr = NewHash();
String *disconn_methodname = NULL; String *disconn_methodname = NULL;
disconn_tm = typemapLookup(n, "directordisconnect", full_classname, WARN_NONE, disconn_attr); typemapLookup(n, "directordisconnect", full_classname, WARN_NONE, disconn_attr);
disconn_methodname = Getattr(disconn_attr, "tmap:directordisconnect:methodname"); disconn_methodname = Getattr(disconn_attr, "tmap:directordisconnect:methodname");
Printv(w->code, " swig_disconnect_director_self(\"", disconn_methodname, "\");\n", "}\n", NIL); Printv(w->code, " swig_disconnect_director_self(\"", disconn_methodname, "\");\n", "}\n", NIL);

View file

@ -1192,7 +1192,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
} }
if (dump_typedef) { if (dump_typedef) {
SwigType_print_scope(0); SwigType_print_scope();
} }
if (dump_symtabs) { if (dump_symtabs) {

View file

@ -240,7 +240,6 @@ public:
String *outarg = NewString(""); String *outarg = NewString("");
String *build = NewString(""); String *build = NewString("");
String *tm; String *tm;
int argout_set = 0;
int i = 0; int i = 0;
int numargs; int numargs;
int numreq; int numreq;
@ -381,7 +380,6 @@ public:
Replaceall(tm, "$input", Getattr(p, "emit:input")); Replaceall(tm, "$input", Getattr(p, "emit:input"));
Printv(outarg, tm, "\n", NIL); Printv(outarg, tm, "\n", NIL);
p = Getattr(p, "tmap:argout:next"); p = Getattr(p, "tmap:argout:next");
argout_set = 1;
} else { } else {
p = nextSibling(p); p = nextSibling(p);
} }

View file

@ -445,7 +445,6 @@ public:
String *outarg = NewString(""); String *outarg = NewString("");
String *build = NewString(""); String *build = NewString("");
String *tm; String *tm;
int argout_set = 0;
int i = 0; int i = 0;
int numargs; int numargs;
int numreq; int numreq;
@ -608,7 +607,6 @@ public:
Replaceall(tm, "$ntype", normalizeTemplatedClassName(Getattr(p, "type"))); Replaceall(tm, "$ntype", normalizeTemplatedClassName(Getattr(p, "type")));
Printv(outarg, tm, "\n", NIL); Printv(outarg, tm, "\n", NIL);
p = Getattr(p, "tmap:argout:next"); p = Getattr(p, "tmap:argout:next");
argout_set = 1;
} else { } else {
p = nextSibling(p); p = nextSibling(p);
} }
@ -881,9 +879,8 @@ public:
* ------------------------------------------------------------ */ * ------------------------------------------------------------ */
virtual int staticmemberfunctionHandler(Node *n) { virtual int staticmemberfunctionHandler(Node *n) {
int rv;
static_member_function = 1; static_member_function = 1;
rv = Language::staticmemberfunctionHandler(n); Language::staticmemberfunctionHandler(n);
static_member_function = 0; static_member_function = 0;
return SWIG_OK; return SWIG_OK;
} }

View file

@ -359,13 +359,11 @@ public:
String *name = 0; String *name = 0;
String *type = 0; String *type = 0;
String *value = 0; String *value = 0;
String *ptype = 0;
String *pdoc = Getattr(p, "tmap:doc"); String *pdoc = Getattr(p, "tmap:doc");
if (pdoc) { if (pdoc) {
name = Getattr(p, "tmap:doc:name"); name = Getattr(p, "tmap:doc:name");
type = Getattr(p, "tmap:doc:type"); type = Getattr(p, "tmap:doc:type");
value = Getattr(p, "tmap:doc:value"); value = Getattr(p, "tmap:doc:value");
ptype = Getattr(p, "tmap:doc:pytype");
} }
name = name ? name : Getattr(p, "name"); name = name ? name : Getattr(p, "name");
@ -1243,7 +1241,6 @@ public:
// build argument list and type conversion string // build argument list and type conversion string
idx = 0; idx = 0;
p = l; p = l;
int use_parse = 0;
while (p) { while (p) {
if (checkAttribute(p, "tmap:in:numinputs", "0")) { if (checkAttribute(p, "tmap:in:numinputs", "0")) {
p = Getattr(p, "tmap:in:next"); p = Getattr(p, "tmap:in:next");
@ -1266,7 +1263,6 @@ public:
Printf(wrap_args, "args.append(tmpv);\n"); Printf(wrap_args, "args.append(tmpv);\n");
Putc('O', parse_args); Putc('O', parse_args);
} else { } else {
use_parse = 1;
Append(parse_args, parse); Append(parse_args, parse);
Replaceall(tm, "$input", pname); Replaceall(tm, "$input", pname);
Replaceall(tm, "$owner", "0"); Replaceall(tm, "$owner", "0");

View file

@ -250,7 +250,6 @@ public:
virtual int top(Node *n) { virtual int top(Node *n) {
String *filen; String *filen;
String *s_type;
/* Check if directors are enabled for this module. */ /* Check if directors are enabled for this module. */
Node *mod = Getattr(n, "module"); Node *mod = Getattr(n, "module");
@ -283,7 +282,6 @@ public:
r_shutdown = NewString("/* rshutdown section */\n"); r_shutdown = NewString("/* rshutdown section */\n");
s_header = NewString("/* header section */\n"); s_header = NewString("/* header section */\n");
s_wrappers = NewString("/* wrapper section */\n"); s_wrappers = NewString("/* wrapper section */\n");
s_type = NewStringEmpty();
/* subsections of the init section */ /* subsections of the init section */
s_vinit = NewString("/* vinit subsection */\n"); s_vinit = NewString("/* vinit subsection */\n");
s_vdecl = NewString("/* vdecl subsection */\n"); s_vdecl = NewString("/* vdecl subsection */\n");
@ -2522,7 +2520,6 @@ done:
/* build argument list and type conversion string */ /* build argument list and type conversion string */
idx = 0; idx = 0;
p = l; p = l;
int use_parse = 0;
while (p) { while (p) {
if (checkAttribute(p, "tmap:in:numinputs", "0")) { if (checkAttribute(p, "tmap:in:numinputs", "0")) {
p = Getattr(p, "tmap:in:next"); p = Getattr(p, "tmap:in:next");
@ -2549,7 +2546,6 @@ done:
Printv(wrap_args, tm, "\n", NIL); Printv(wrap_args, tm, "\n", NIL);
Putc('O', parse_args); Putc('O', parse_args);
} else { } else {
use_parse = 1;
Append(parse_args, parse); Append(parse_args, parse);
Replaceall(tm, "$input", pname); Replaceall(tm, "$input", pname);
Replaceall(tm, "$owner", "0"); Replaceall(tm, "$owner", "0");

View file

@ -1215,13 +1215,11 @@ public:
String *name = 0; String *name = 0;
String *type = 0; String *type = 0;
String *value = 0; String *value = 0;
String *ptype = 0;
String *pdoc = Getattr(p, "tmap:doc"); String *pdoc = Getattr(p, "tmap:doc");
if (pdoc) { if (pdoc) {
name = Getattr(p, "tmap:doc:name"); name = Getattr(p, "tmap:doc:name");
type = Getattr(p, "tmap:doc:type"); type = Getattr(p, "tmap:doc:type");
value = Getattr(p, "tmap:doc:value"); value = Getattr(p, "tmap:doc:value");
ptype = Getattr(p, "tmap:doc:pytype");
} }
name = name ? name : Getattr(p, "name"); name = name ? name : Getattr(p, "name");

View file

@ -15,8 +15,6 @@ char cvsroot_r_cxx[] = "$Id$";
#include "swigmod.h" #include "swigmod.h"
#define UNUSED(a) (void)a
static const double DEFAULT_NUMBER = .0000123456712312312323; static const double DEFAULT_NUMBER = .0000123456712312312323;
static const int MAX_OVERLOAD_ARGS = 5; static const int MAX_OVERLOAD_ARGS = 5;
@ -268,12 +266,9 @@ static void replaceRClass(String *tm, SwigType *type) {
Delete(tmp); Delete(tmp_base); Delete(tmp_ref); Delete(tmp); Delete(tmp_base); Delete(tmp_ref);
} }
static double getNumber(String *value, String *type) { static double getNumber(String *value) {
UNUSED(type);
double d = DEFAULT_NUMBER; double d = DEFAULT_NUMBER;
if(Char(value)) { if(Char(value)) {
// Printf(stderr, "getNumber %s %s\n", Char(value), type);
if(sscanf(Char(value), "%lf", &d) != 1) if(sscanf(Char(value), "%lf", &d) != 1)
return(DEFAULT_NUMBER); return(DEFAULT_NUMBER);
} }
@ -1016,7 +1011,6 @@ int R::OutputClassMemberTable(Hash *tb, File *out) {
int R::OutputMemberReferenceMethod(String *className, int isSet, int R::OutputMemberReferenceMethod(String *className, int isSet,
List *el, File *out) { List *el, File *out) {
int numMems = Len(el), j; int numMems = Len(el), j;
int has_getitem = 0, has_setitem = 0, has_str = 0;
int varaccessor = 0; int varaccessor = 0;
if (numMems == 0) if (numMems == 0)
return SWIG_OK; return SWIG_OK;
@ -1036,9 +1030,6 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
if (Getattr(itemList, item)) if (Getattr(itemList, item))
continue; continue;
Setattr(itemList, item, "1"); Setattr(itemList, item, "1");
if (!Strcmp(item, "__getitem__")) has_getitem = 1;
if (!Strcmp(item, "__setitem__")) has_setitem = 1;
if (!Strcmp(item, "__str__")) has_str = 1;
String *dup = Getitem(el, j + 1); String *dup = Getitem(el, j + 1);
char *ptr = Char(dup); char *ptr = Char(dup);
@ -1212,10 +1203,9 @@ int R::enumDeclaration(Node *n) {
// const char *tag = Char(nodeType(c)); // const char *tag = Char(nodeType(c));
// if (Strcmp(tag,"cdecl") == 0) { // if (Strcmp(tag,"cdecl") == 0) {
name = Getattr(c, "name"); name = Getattr(c, "name");
String *type = Getattr(c, "type");
String *val = Getattr(c, "enumvalue"); String *val = Getattr(c, "enumvalue");
if(val && Char(val)) { if(val && Char(val)) {
int inval = (int) getNumber(val, type); int inval = (int) getNumber(val);
if(inval == DEFAULT_NUMBER) if(inval == DEFAULT_NUMBER)
value++; value++;
else else
@ -1738,8 +1728,7 @@ int R::functionWrapper(Node *n) {
} }
int i; int i;
int nargs, num_required, varargs; int nargs;
UNUSED(varargs);
String *wname = Swig_name_wrapper(iname); String *wname = Swig_name_wrapper(iname);
Replace(wname, "_wrap", "R_swig", DOH_REPLACE_FIRST); Replace(wname, "_wrap", "R_swig", DOH_REPLACE_FIRST);
@ -1788,8 +1777,6 @@ int R::functionWrapper(Node *n) {
Setattr(n,"wrap:parms",l); Setattr(n,"wrap:parms",l);
nargs = emit_num_arguments(l); nargs = emit_num_arguments(l);
num_required = emit_num_required(l);
varargs = emit_isvarargs(l);
Wrapper_add_local(f, "r_nprotect", "unsigned int r_nprotect = 0"); Wrapper_add_local(f, "r_nprotect", "unsigned int r_nprotect = 0");
Wrapper_add_localv(f, "r_ans", "SEXP", "r_ans = R_NilValue", NIL); Wrapper_add_localv(f, "r_ans", "SEXP", "r_ans = R_NilValue", NIL);
@ -2134,11 +2121,6 @@ int R::functionWrapper(Node *n) {
Would like to be able to do this so that we can potentialy insert Would like to be able to do this so that we can potentialy insert
*/ */
if(processing_member_access_function || processing_class_member_function) { if(processing_member_access_function || processing_class_member_function) {
String *tmp;
if(member_name)
tmp = member_name;
else
tmp = Getattr(n, "memberfunctionHandler:name");
addAccessor(member_name, sfun, iname); addAccessor(member_name, sfun, iname);
} }

View file

@ -322,13 +322,11 @@ private:
String *name = 0; String *name = 0;
String *type = 0; String *type = 0;
String *value = 0; String *value = 0;
String *ptype = 0;
String *pdoc = Getattr(p, "tmap:doc"); String *pdoc = Getattr(p, "tmap:doc");
if (pdoc) { if (pdoc) {
name = Getattr(p, "tmap:doc:name"); name = Getattr(p, "tmap:doc:name");
type = Getattr(p, "tmap:doc:type"); type = Getattr(p, "tmap:doc:type");
value = Getattr(p, "tmap:doc:value"); value = Getattr(p, "tmap:doc:value");
ptype = Getattr(p, "tmap:doc:pytype");
} }
name = name ? name : Getattr(p, "name"); name = name ? name : Getattr(p, "name");
@ -1608,9 +1606,7 @@ public:
virtual int functionWrapper(Node *n) { virtual int functionWrapper(Node *n) {
String *nodeType; String *nodeType;
bool constructor;
bool destructor; bool destructor;
String *storage;
String *symname = Copy(Getattr(n, "sym:name")); String *symname = Copy(Getattr(n, "sym:name"));
SwigType *t = Getattr(n, "type"); SwigType *t = Getattr(n, "type");
@ -1625,9 +1621,7 @@ public:
return SWIG_NOWRAP; return SWIG_NOWRAP;
nodeType = Getattr(n, "nodeType"); nodeType = Getattr(n, "nodeType");
constructor = (!Cmp(nodeType, "constructor"));
destructor = (!Cmp(nodeType, "destructor")); destructor = (!Cmp(nodeType, "destructor"));
storage = Getattr(n, "storage");
/* If the C++ class constructor is overloaded, we only want to /* If the C++ class constructor is overloaded, we only want to
* write out the "new" singleton method once since it is always * write out the "new" singleton method once since it is always

View file

@ -1062,11 +1062,11 @@ class TypePass:private Dispatcher {
* which is hacked. */ * which is hacked. */
if (Getattr(n, "sym:overloaded")) if (Getattr(n, "sym:overloaded"))
{ {
#ifdef DEBUG_OVERLOADED
show_overloaded(n);
#endif
int cnt = 0; int cnt = 0;
#ifdef DEBUG_OVERLOADED
Node *debugnode = n; Node *debugnode = n;
show_overloaded(n);
#endif
if (!firstChild(n)) { if (!firstChild(n)) {
// Remove from overloaded list ('using' node does not actually end up adding in any methods) // Remove from overloaded list ('using' node does not actually end up adding in any methods)
Node *ps = Getattr(n, "sym:previousSibling"); Node *ps = Getattr(n, "sym:previousSibling");
@ -1113,14 +1113,16 @@ show_overloaded(n);
Setattr(ns, "sym:previousSibling", pp); Setattr(ns, "sym:previousSibling", pp);
Setattr(pp, "sym:nextSibling", ns); Setattr(pp, "sym:nextSibling", ns);
} }
#ifdef DEBUG_OVERLOADED
debugnode = firstoverloaded; debugnode = firstoverloaded;
#endif
} }
Delattr(n, "sym:previousSibling"); Delattr(n, "sym:previousSibling");
Delattr(n, "sym:nextSibling"); Delattr(n, "sym:nextSibling");
Delattr(n, "sym:overloaded"); Delattr(n, "sym:overloaded");
Delattr(n, "sym:overname"); Delattr(n, "sym:overname");
#ifdef DEBUG_OVERLOADED #ifdef DEBUG_OVERLOADED
show_overloaded(debugnode); show_overloaded(debugnode);
#endif #endif
clean_overloaded(n); // Needed? clean_overloaded(n); // Needed?
} }

View file

@ -278,7 +278,8 @@ int UFFI::functionWrapper(Node *n) {
String *funcname = Getattr(n, "sym:name"); String *funcname = Getattr(n, "sym:name");
ParmList *pl = Getattr(n, "parms"); ParmList *pl = Getattr(n, "parms");
Parm *p; Parm *p;
int argnum = 0, first = 1, varargs = 0; int argnum = 0, first = 1;
// int varargs = 0;
//Language::functionWrapper(n); //Language::functionWrapper(n);
@ -291,7 +292,7 @@ int UFFI::functionWrapper(Node *n) {
Printf(f_cl, ":void"); Printf(f_cl, ":void");
} else if (any_varargs(pl)) { } else if (any_varargs(pl)) {
Printf(f_cl, "#| varargs |#"); Printf(f_cl, "#| varargs |#");
varargs = 1; // varargs = 1;
} else { } else {
for (p = pl; p; p = nextSibling(p), argnum++) { for (p = pl; p; p = nextSibling(p), argnum++) {
String *argname = Getattr(p, "name"); String *argname = Getattr(p, "name");

View file

@ -1041,10 +1041,8 @@ int Swig_ConstructorToFunction(Node *n, const_String_or_char_ptr nspace, String
Parm *p; Parm *p;
ParmList *directorparms; ParmList *directorparms;
SwigType *type; SwigType *type;
Node *classNode;
int use_director; int use_director;
classNode = Swig_methodclass(n);
use_director = Swig_directorclass(n); use_director = Swig_directorclass(n);
parms = CopyParmList(nonvoid_parms(Getattr(n, "parms"))); parms = CopyParmList(nonvoid_parms(Getattr(n, "parms")));

View file

@ -1156,11 +1156,9 @@ void Scanner_skip_line(Scanner * s) {
int Scanner_skip_balanced(Scanner * s, int startchar, int endchar) { int Scanner_skip_balanced(Scanner * s, int startchar, int endchar) {
char c; char c;
int num_levels = 1; int num_levels = 1;
int l;
int state = 0; int state = 0;
char temp[2] = { 0, 0 }; char temp[2] = { 0, 0 };
String *locator = 0; String *locator = 0;
l = s->line;
temp[0] = (char) startchar; temp[0] = (char) startchar;
Clear(s->text); Clear(s->text);
Setfile(s->text, Getfile(s->str)); Setfile(s->text, Getfile(s->str));

View file

@ -194,7 +194,7 @@ extern "C" {
extern void SwigType_inherit_scope(Typetab *scope); extern void SwigType_inherit_scope(Typetab *scope);
extern Typetab *SwigType_pop_scope(void); extern Typetab *SwigType_pop_scope(void);
extern Typetab *SwigType_set_scope(Typetab *h); extern Typetab *SwigType_set_scope(Typetab *h);
extern void SwigType_print_scope(Typetab *t); extern void SwigType_print_scope(void);
extern SwigType *SwigType_typedef_resolve(const SwigType *t); extern SwigType *SwigType_typedef_resolve(const SwigType *t);
extern SwigType *SwigType_typedef_resolve_all(const SwigType *t); extern SwigType *SwigType_typedef_resolve_all(const SwigType *t);
extern SwigType *SwigType_typedef_qualified(const SwigType *t); extern SwigType *SwigType_typedef_qualified(const SwigType *t);

View file

@ -1206,19 +1206,17 @@ Node *Swig_symbol_clookup_check(const_String_or_char_ptr name, Symtab *n, int (*
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
Node *Swig_symbol_clookup_local(const_String_or_char_ptr name, Symtab *n) { Node *Swig_symbol_clookup_local(const_String_or_char_ptr name, Symtab *n) {
Hash *h, *hsym; Hash *hsym;
Node *s = 0; Node *s = 0;
if (!n) { if (!n) {
hsym = current_symtab; hsym = current_symtab;
h = ccurrent;
} else { } else {
if (!Checkattr(n, "nodeType", "symboltable")) { if (!Checkattr(n, "nodeType", "symboltable")) {
n = Getattr(n, "sym:symtab"); n = Getattr(n, "sym:symtab");
} }
assert(n); assert(n);
hsym = n; hsym = n;
h = Getattr(n, "csymtab");
} }
if (Swig_scopename_check(name)) { if (Swig_scopename_check(name)) {
@ -1256,19 +1254,17 @@ Node *Swig_symbol_clookup_local(const_String_or_char_ptr name, Symtab *n) {
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr name, Symtab *n, int (*checkfunc) (Node *)) { Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr name, Symtab *n, int (*checkfunc) (Node *)) {
Hash *h, *hsym; Hash *hsym;
Node *s = 0; Node *s = 0;
if (!n) { if (!n) {
hsym = current_symtab; hsym = current_symtab;
h = ccurrent;
} else { } else {
if (!Checkattr(n, "nodeType", "symboltable")) { if (!Checkattr(n, "nodeType", "symboltable")) {
n = Getattr(n, "sym:symtab"); n = Getattr(n, "sym:symtab");
} }
assert(n); assert(n);
hsym = n; hsym = n;
h = Getattr(n, "csymtab");
} }
if (Swig_scopename_check(name)) { if (Swig_scopename_check(name)) {

View file

@ -389,12 +389,11 @@ void SwigType_attach_symtab(Symtab *sym) {
* Debugging function for printing out current scope * Debugging function for printing out current scope
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
void SwigType_print_scope(Typetab *t) { void SwigType_print_scope(void) {
Hash *ttab; Hash *ttab;
Iterator i, j; Iterator i, j;
for (i = First(scopes); i.key; i = Next(i)) { for (i = First(scopes); i.key; i = Next(i)) {
t = i.item;
ttab = Getattr(i.item, "typetab"); ttab = Getattr(i.item, "typetab");
Printf(stdout, "Type scope '%s' (%x)\n", i.key, i.item); Printf(stdout, "Type scope '%s' (%x)\n", i.key, i.item);