Remove some vc++ /W4 warnings

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10540 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-06-21 15:23:02 +00:00
commit 49675199f4
20 changed files with 146 additions and 152 deletions

View file

@ -2935,11 +2935,9 @@ int ALLEGROCL::classHandler(Node *n) {
#endif
if (Generate_Wrapper)
return cppClassHandler(n);
return cppClassHandler(n);
else
return cClassHandler(n);
return SWIG_OK;
return cClassHandler(n);
}
int ALLEGROCL::cClassHandler(Node *n) {

View file

@ -329,7 +329,6 @@ int CHICKEN::functionWrapper(Node *n) {
Parm *p;
int i;
String *wname;
String *source;
Wrapper *f;
String *mangle = NewString("");
String *get_pointers;
@ -398,8 +397,6 @@ int CHICKEN::functionWrapper(Node *n) {
SwigType *pt = Getattr(p, "type");
String *ln = Getattr(p, "lname");
source = NewStringf("scm%d", i + 1);
Printf(f->def, ", C_word scm%d", i + 1);
Printf(declfunc, ",C_word");
@ -407,6 +404,7 @@ int CHICKEN::functionWrapper(Node *n) {
if ((tm = Getattr(p, "tmap:in"))) {
String *parse = Getattr(p, "tmap:in:parse");
if (!parse) {
String *source = NewStringf("scm%d", i + 1);
Replaceall(tm, "$source", source);
Replaceall(tm, "$target", ln);
Replaceall(tm, "$input", source);
@ -445,20 +443,15 @@ int CHICKEN::functionWrapper(Node *n) {
}
}
}
} else {
Delete(source);
}
p = Getattr(p, "tmap:in:next");
continue;
} else {
Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0));
break;
}
Delete(source);
p = nextSibling(p);
}
/* finish argument marshalling */

View file

@ -1097,38 +1097,33 @@ int Language::globalfunctionHandler(Node *n) {
String *name = Getattr(n, "name");
String *symname = Getattr(n, "sym:name");
SwigType *type = Getattr(n, "type");
String *storage = Getattr(n, "storage");
ParmList *parms = Getattr(n, "parms");
if (0 && (Cmp(storage, "static") == 0)) {
Swig_restore(n);
return SWIG_NOWRAP; /* Can't wrap static functions */
} else {
/* Check for callback mode */
String *cb = GetFlagAttr(n, "feature:callback");
if (cb) {
String *cbname = Getattr(n, "feature:callback:name");
if (!cbname) {
cbname = NewStringf(cb, symname);
Setattr(n, "feature:callback:name", cbname);
}
callbackfunctionHandler(n);
if (Cmp(cbname, symname) == 0) {
Delete(cbname);
Swig_restore(n);
return SWIG_NOWRAP;
}
Delete(cbname);
/* Check for callback mode */
String *cb = GetFlagAttr(n, "feature:callback");
if (cb) {
String *cbname = Getattr(n, "feature:callback:name");
if (!cbname) {
cbname = NewStringf(cb, symname);
Setattr(n, "feature:callback:name", cbname);
}
Setattr(n, "parms", nonvoid_parms(parms));
String *call = Swig_cfunction_call(name, parms);
String *cres = Swig_cresult(type, "result", call);
Setattr(n, "wrap:action", cres);
Delete(cres);
Delete(call);
functionWrapper(n);
callbackfunctionHandler(n);
if (Cmp(cbname, symname) == 0) {
Delete(cbname);
Swig_restore(n);
return SWIG_NOWRAP;
}
Delete(cbname);
}
Setattr(n, "parms", nonvoid_parms(parms));
String *call = Swig_cfunction_call(name, parms);
String *cres = Swig_cresult(type, "result", call);
Setattr(n, "wrap:action", cres);
Delete(cres);
Delete(call);
functionWrapper(n);
Swig_restore(n);
return SWIG_OK;
}
@ -1376,9 +1371,6 @@ int Language::variableHandler(Node *n) {
* ---------------------------------------------------------------------- */
int Language::globalvariableHandler(Node *n) {
String *storage = Getattr(n, "storage");
if (0 && (Cmp(storage, "static") == 0))
return SWIG_NOWRAP;
variableWrapper(n);
return SWIG_OK;
}
@ -2108,8 +2100,8 @@ int Language::classDirector(Node *n) {
String *using_protected_members_code = NewString("");
for (ni = Getattr(n, "firstChild"); ni; ni = nextSibling(ni)) {
Node *nodeType = Getattr(ni, "nodeType");
bool cdecl = (Cmp(nodeType, "cdecl") == 0);
if (cdecl && !GetFlag(ni, "feature:ignore")) {
bool cdeclaration = (Cmp(nodeType, "cdecl") == 0);
if (cdeclaration && !GetFlag(ni, "feature:ignore")) {
if (is_non_virtual_protected_access(ni)) {
Node *overloaded = Getattr(ni, "sym:overloaded");
// emit the using base::member statement (but only once if the method is overloaded)
@ -3391,7 +3383,8 @@ int Language::is_assignable(Node *n) {
SwigType *ftd = SwigType_typedef_resolve_all(type);
SwigType *td = SwigType_strip_qualifiers(ftd);
if (SwigType_type(td) == T_USER) {
if ((cn = Swig_symbol_clookup(td, 0))) {
cn = Swig_symbol_clookup(td, 0);
if (cn) {
if ((Strcmp(nodeType(cn), "class") == 0)) {
if (Getattr(cn, "allocate:noassign")) {
SetFlag(n, "feature:immutable");

View file

@ -490,8 +490,6 @@ public:
Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0));
break;
}
p = nextSibling(p);
}
// add all argcheck code
@ -1101,7 +1099,6 @@ public:
virtual int staticmemberfunctionHandler(Node *n) {
current = STATIC_FUNC;
return Language::staticmemberfunctionHandler(n);
current = NO_CPP;
}
/* ------------------------------------------------------------
@ -1123,7 +1120,6 @@ public:
// REPORT("staticmembervariableHandler",n);
current = STATIC_VAR;
return Language::staticmembervariableHandler(n);
current = NO_CPP;
}
/* ---------------------------------------------------------------------

View file

@ -472,9 +472,9 @@ MODULA3():
cap = true;
} else {
if (cap) {
m3sym[i] = toupper(c);
m3sym[i] = (char)toupper(c);
} else {
m3sym[i] = tolower(c);
m3sym[i] = (char)tolower(c);
}
cap = false;
}

View file

@ -150,45 +150,44 @@ void SwigPHP_emit_resource_registrations() {
ki = First(zend_types);
if (ki.key)
Printf(s_oinit, "\n/* Register resource destructors for pointer types */\n");
while (ki.key)
if (1 /* is pointer type */ ) {
DOH *key = ki.key;
Node *class_node = ki.item;
String *human_name = key;
while (ki.key) {
DOH *key = ki.key;
Node *class_node = ki.item;
String *human_name = key;
// Write out destructor function header
Printf(s_wrappers, "/* NEW Destructor style */\nstatic ZEND_RSRC_DTOR_FUNC(_wrap_destroy%s) {\n", key);
// Write out destructor function header
Printf(s_wrappers, "/* NEW Destructor style */\nstatic ZEND_RSRC_DTOR_FUNC(_wrap_destroy%s) {\n", key);
// write out body
if ((class_node != NOTCLASS)) {
String *destructor = Getattr(class_node, "destructor");
human_name = Getattr(class_node, "sym:name");
if (!human_name)
human_name = Getattr(class_node, "name");
// Do we have a known destructor for this type?
if (destructor) {
Printf(s_wrappers, " %s(rsrc, SWIGTYPE%s->name TSRMLS_CC);\n", destructor, key);
} else {
Printf(s_wrappers, " /* No destructor for class %s */\n", human_name);
}
// write out body
if ((class_node != NOTCLASS)) {
String *destructor = Getattr(class_node, "destructor");
human_name = Getattr(class_node, "sym:name");
if (!human_name)
human_name = Getattr(class_node, "name");
// Do we have a known destructor for this type?
if (destructor) {
Printf(s_wrappers, " %s(rsrc, SWIGTYPE%s->name TSRMLS_CC);\n", destructor, key);
} else {
Printf(s_wrappers, " /* No destructor for simple type %s */\n", key);
Printf(s_wrappers, " /* No destructor for class %s */\n", human_name);
}
// close function
Printf(s_wrappers, "}\n");
// declare le_swig_<mangled> to store php registration
Printf(s_vdecl, "static int le_swig_%s=0; /* handle for %s */\n", key, human_name);
// register with php
Printf(s_oinit, "le_swig_%s=zend_register_list_destructors_ex" "(_wrap_destroy%s,NULL,(char *)(SWIGTYPE%s->name),module_number);\n", key, key, key);
// store php type in class struct
Printf(s_oinit, "SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n", key, key);
ki = Next(ki);
} else {
Printf(s_wrappers, " /* No destructor for simple type %s */\n", key);
}
// close function
Printf(s_wrappers, "}\n");
// declare le_swig_<mangled> to store php registration
Printf(s_vdecl, "static int le_swig_%s=0; /* handle for %s */\n", key, human_name);
// register with php
Printf(s_oinit, "le_swig_%s=zend_register_list_destructors_ex" "(_wrap_destroy%s,NULL,(char *)(SWIGTYPE%s->name),module_number);\n", key, key, key);
// store php type in class struct
Printf(s_oinit, "SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n", key, key);
ki = Next(ki);
}
}
class PHP:public Language {

View file

@ -1773,7 +1773,6 @@ public:
Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0));
break;
}
p = nextSibling(p);
}
/* finish argument marshalling */

View file

@ -57,11 +57,13 @@ static String * getRTypeName(SwigType *t, int *outCount = NULL) {
Insert(tmp, 0, retName);
return tmp;
/*
if(count)
return(b);
Delete(b);
return(NewString(""));
*/
}
#if 0
@ -104,7 +106,7 @@ static String * getRType(Node *n) {
Now handles arrays, i.e. struct A[2]
****************/
static String *getRClassName(String *retType, int addRef = 1, int upRef=0) {
static String *getRClassName(String *retType, int /*addRef*/ = 1, int upRef=0) {
String *tmp = NewString("");
SwigType *resolved = SwigType_typedef_resolve_all(retType);
char *retName = Char(SwigType_manglestr(resolved));
@ -115,6 +117,7 @@ static String *getRClassName(String *retType, int addRef = 1, int upRef=0) {
}
return tmp;
/*
#if 1
List *l = SwigType_split(retType);
int n = Len(l);
@ -160,6 +163,7 @@ static String *getRClassName(String *retType, int addRef = 1, int upRef=0) {
#endif
return tmp;
*/
}
/*********************
@ -2030,14 +2034,18 @@ int R::functionWrapper(Node *n) {
Replaceall(tm,"$owner", "R_SWIG_EXTERNAL");
}
if(0 && addCopyParam) {
#if 0
if(addCopyParam) {
Printf(f->code, "if(LOGICAL(s_swig_copy)[0]) {\n");
Printf(f->code, "/* Deal with returning a reference. */\nr_ans = R_NilValue;\n");
Printf(f->code, "}\n else {\n");
}
#endif
Printf(f->code, "%s\n", tm);
if(0 && addCopyParam)
#if 0
if(addCopyParam)
Printf(f->code, "}\n"); /* end of if(s_swig_copy) ... else { ... } */
#endif
} else {
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number,

View file

@ -448,7 +448,7 @@ private:
parent_name = Copy( Getattr(mod, "name") );
if ( parent_name )
{
(Char(parent_name))[0] = toupper((Char(parent_name))[0]);
(Char(parent_name))[0] = (char)toupper((Char(parent_name))[0]);
}
}
if ( parent_name )
@ -1194,7 +1194,7 @@ public:
while (m.item) {
if (Len(m.item) > 0) {
String *cap = NewString(m.item);
(Char(cap))[0] = toupper((Char(cap))[0]);
(Char(cap))[0] = (char)toupper((Char(cap))[0]);
if (last != 0) {
Append(module, "::");
}
@ -1206,7 +1206,7 @@ public:
if (feature == 0) {
feature = Copy(last);
}
(Char(last))[0] = toupper((Char(last))[0]);
(Char(last))[0] = (char)toupper((Char(last))[0]);
modvar = NewStringf("m%s", last);
Delete(modules);
}
@ -2219,7 +2219,7 @@ public:
return name;
if (islower(name[0])) {
name[0] = toupper(name[0]);
name[0] = (char)toupper(name[0]);
Swig_warning(WARN_RUBY_WRONG_NAME, input_file, line_number, "Wrong %s name (corrected to `%s')\n", reason, name);
return name;
}
@ -2545,7 +2545,7 @@ public:
String *name = Copy(symname);
char *cname = Char(name);
if (cname)
cname[0] = toupper(cname[0]);
cname[0] = (char)toupper(cname[0]);
Printv(director_prot_ctor_code,
"if ( $comparison ) { /* subclassed */\n",
" $director_new \n",