fix unused 'fail:' label warnings
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8716 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
27acb50747
commit
403e9ebc9e
6 changed files with 55 additions and 22 deletions
|
|
@ -34,12 +34,20 @@ private:
|
||||||
XYZ* operator&(); // prevent dereferencing used in normally generated get method
|
XYZ* operator&(); // prevent dereferencing used in normally generated get method
|
||||||
};
|
};
|
||||||
%}
|
%}
|
||||||
|
#if defined(SWIGUTL)
|
||||||
|
%exception {
|
||||||
|
/*
|
||||||
|
$action
|
||||||
|
*/
|
||||||
|
SWIG_fail;
|
||||||
|
}
|
||||||
|
#else
|
||||||
%exception {
|
%exception {
|
||||||
/*
|
/*
|
||||||
$action
|
$action
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
%allowexception;
|
%allowexception;
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
|
|
||||||
|
|
@ -479,6 +479,13 @@ int Language::constantDirective(Node *n) {
|
||||||
|
|
||||||
if (CurrentClass && (cplus_mode != PUBLIC)) return SWIG_NOWRAP;
|
if (CurrentClass && (cplus_mode != PUBLIC)) return SWIG_NOWRAP;
|
||||||
|
|
||||||
|
if (!GetFlag(n,"feature:allowexcept")) {
|
||||||
|
UnsetFlag(n,"feature:except");
|
||||||
|
}
|
||||||
|
if (Getattr(n,"feature:exceptvar")) {
|
||||||
|
Setattr(n,"feature:except",Getattr(n,"feature:exceptvar"));
|
||||||
|
}
|
||||||
|
|
||||||
if (!ImportMode) {
|
if (!ImportMode) {
|
||||||
Swig_require("constantDirective",n,"name", "?value",NIL);
|
Swig_require("constantDirective",n,"name", "?value",NIL);
|
||||||
String *name = Getattr(n,"name");
|
String *name = Getattr(n,"name");
|
||||||
|
|
@ -1548,6 +1555,13 @@ int Language::memberconstantHandler(Node *n) {
|
||||||
|
|
||||||
Swig_require("memberconstantHandler",n,"*name","*sym:name","value",NIL);
|
Swig_require("memberconstantHandler",n,"*name","*sym:name","value",NIL);
|
||||||
|
|
||||||
|
if (!GetFlag(n,"feature:allowexcept")) {
|
||||||
|
UnsetFlag(n,"feature:except");
|
||||||
|
}
|
||||||
|
if (Getattr(n,"feature:exceptvar")) {
|
||||||
|
Setattr(n,"feature:except",Getattr(n,"feature:exceptvar"));
|
||||||
|
}
|
||||||
|
|
||||||
String *name = Getattr(n,"name");
|
String *name = Getattr(n,"name");
|
||||||
String *symname = Getattr(n,"sym:name");
|
String *symname = Getattr(n,"sym:name");
|
||||||
String *value = Getattr(n,"value");
|
String *value = Getattr(n,"value");
|
||||||
|
|
|
||||||
|
|
@ -844,7 +844,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now write a function to evaluate the variable */
|
/* Now write a function to evaluate the variable */
|
||||||
|
int addfail = 0;
|
||||||
Printf(getf->def,"SWIGCLASS_STATIC int %s(pTHX_ SV *sv, MAGIC *SWIGUNUSEDPARM(mg)) {\n", val_name);
|
Printf(getf->def,"SWIGCLASS_STATIC int %s(pTHX_ SV *sv, MAGIC *SWIGUNUSEDPARM(mg)) {\n", val_name);
|
||||||
Printv(getf->code,
|
Printv(getf->code,
|
||||||
tab4, "MAGIC_PPERL\n",
|
tab4, "MAGIC_PPERL\n",
|
||||||
|
|
@ -860,15 +860,17 @@ public:
|
||||||
Replaceall(tm, "$shadow", "0");
|
Replaceall(tm, "$shadow", "0");
|
||||||
}
|
}
|
||||||
/* Printf(getf->code,"%s\n", tm);*/
|
/* Printf(getf->code,"%s\n", tm);*/
|
||||||
emit_action_code(n, getf, tm);
|
addfail = emit_action_code(n, getf, tm);
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_TYPEMAP_VAROUT_UNDEF, input_file, line_number,
|
Swig_warning(WARN_TYPEMAP_VAROUT_UNDEF, input_file, line_number,
|
||||||
"Unable to read variable of type %s\n", SwigType_str(t,0));
|
"Unable to read variable of type %s\n", SwigType_str(t,0));
|
||||||
return SWIG_NOWRAP;
|
return SWIG_NOWRAP;
|
||||||
}
|
}
|
||||||
Printf(getf->code," return 1;\n");
|
Printf(getf->code," return 1;\n");
|
||||||
Append(getf->code,"fail:\n");
|
if (addfail) {
|
||||||
Append(getf->code," return 0;\n");
|
Append(getf->code,"fail:\n");
|
||||||
|
Append(getf->code," return 0;\n");
|
||||||
|
}
|
||||||
Append(getf->code,"}\n");
|
Append(getf->code,"}\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1393,7 +1393,7 @@ public:
|
||||||
|
|
||||||
String *tmp = NewString("");
|
String *tmp = NewString("");
|
||||||
String *dispatch;
|
String *dispatch;
|
||||||
const char *dispatch_code = funpack ? "return %s(self, argv);" : "return %s(self, args);";
|
const char *dispatch_code = funpack ? "return %s(self, argc, argv);" : "return %s(self, args);";
|
||||||
|
|
||||||
if (castmode) {
|
if (castmode) {
|
||||||
dispatch = Swig_overload_dispatch_cast(n,dispatch_code,&maxargs);
|
dispatch = Swig_overload_dispatch_cast(n,dispatch_code,&maxargs);
|
||||||
|
|
@ -1737,11 +1737,12 @@ public:
|
||||||
if (overname) {
|
if (overname) {
|
||||||
if (noargs) {
|
if (noargs) {
|
||||||
Printv(f->def, "SWIGINTERN PyObject *", wname,
|
Printv(f->def, "SWIGINTERN PyObject *", wname,
|
||||||
"(PyObject *SWIGUNUSEDPARM(self), PyObject **SWIGUNUSEDPARM(swig_obj)) {", NIL);
|
"(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {", NIL);
|
||||||
} else{
|
} else{
|
||||||
Printv(f->def, "SWIGINTERN PyObject *", wname,
|
Printv(f->def, "SWIGINTERN PyObject *", wname,
|
||||||
"(PyObject *SWIGUNUSEDPARM(self), PyObject **swig_obj) {", NIL);
|
"(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {", NIL);
|
||||||
}
|
}
|
||||||
|
Printf(parse_args,"if ((nobjs < %d) || (nobjs > %d)) SWIG_fail;\n", num_required, num_arguments);
|
||||||
} else {
|
} else {
|
||||||
if (noargs) {
|
if (noargs) {
|
||||||
Printv(f->def, "SWIGINTERN PyObject *", wname,
|
Printv(f->def, "SWIGINTERN PyObject *", wname,
|
||||||
|
|
@ -1751,12 +1752,13 @@ public:
|
||||||
"(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {", NIL);
|
"(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {", NIL);
|
||||||
}
|
}
|
||||||
if (onearg) {
|
if (onearg) {
|
||||||
Printf(parse_args,"if (!args) { SWIG_fail; } else { swig_obj[0] = args; }\n");
|
Printf(parse_args,"if (!args) SWIG_fail;\n");
|
||||||
|
Printf(parse_args,"swig_obj[0] = args;\n");
|
||||||
} else if (!noargs) {
|
} else if (!noargs) {
|
||||||
Printf(parse_args,"if(!SWIG_Python_UnpackTuple(args,\"%s\",%d,%d,swig_obj)) SWIG_fail;\n",
|
Printf(parse_args,"if (!SWIG_Python_UnpackTuple(args,\"%s\",%d,%d,swig_obj)) SWIG_fail;\n",
|
||||||
iname, num_required, num_arguments);
|
iname, num_required, num_arguments);
|
||||||
} else if (noargs) {
|
} else if (noargs) {
|
||||||
Printf(parse_args,"if(!SWIG_Python_UnpackTuple(args,\"%s\",%d,%d,0)) SWIG_fail;\n",
|
Printf(parse_args,"if (!SWIG_Python_UnpackTuple(args,\"%s\",%d,%d,0)) SWIG_fail;\n",
|
||||||
iname, num_required, num_arguments);
|
iname, num_required, num_arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2129,7 +2131,6 @@ public:
|
||||||
setnamef = Swig_name_set(iname);
|
setnamef = Swig_name_set(iname);
|
||||||
|
|
||||||
/* Create a function for setting the value of the variable */
|
/* Create a function for setting the value of the variable */
|
||||||
|
|
||||||
if (assignable) {
|
if (assignable) {
|
||||||
Printf(setf->def,"SWIGINTERN int %s(PyObject *_val) {", setnamef);
|
Printf(setf->def,"SWIGINTERN int %s(PyObject *_val) {", setnamef);
|
||||||
if ((tm = Swig_typemap_lookup_new("varin",n,name,0))) {
|
if ((tm = Swig_typemap_lookup_new("varin",n,name,0))) {
|
||||||
|
|
@ -2165,22 +2166,24 @@ public:
|
||||||
Wrapper_print(setf,f_wrappers);
|
Wrapper_print(setf,f_wrappers);
|
||||||
|
|
||||||
/* Create a function for getting the value of a variable */
|
/* Create a function for getting the value of a variable */
|
||||||
|
int addfail = 0;
|
||||||
Printf(getf->def,"SWIGINTERN PyObject *%s(void) {", getnamef);
|
Printf(getf->def,"SWIGINTERN PyObject *%s(void) {", getnamef);
|
||||||
Wrapper_add_local(getf,"pyobj", "PyObject *pyobj = 0");
|
Wrapper_add_local(getf,"pyobj", "PyObject *pyobj = 0");
|
||||||
if ((tm = Swig_typemap_lookup_new("varout",n,name,0))) {
|
if ((tm = Swig_typemap_lookup_new("varout",n,name,0))) {
|
||||||
Replaceall(tm,"$source",name);
|
Replaceall(tm,"$source",name);
|
||||||
Replaceall(tm,"$target","pyobj");
|
Replaceall(tm,"$target","pyobj");
|
||||||
Replaceall(tm,"$result","pyobj");
|
Replaceall(tm,"$result","pyobj");
|
||||||
emit_action_code(n, getf, tm);
|
addfail = emit_action_code(n, getf, tm);
|
||||||
Delete(tm);
|
Delete(tm);
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_TYPEMAP_VAROUT_UNDEF, input_file, line_number,
|
Swig_warning(WARN_TYPEMAP_VAROUT_UNDEF, input_file, line_number,
|
||||||
"Unable to read variable of type %s\n", SwigType_str(t,0));
|
"Unable to read variable of type %s\n", SwigType_str(t,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Append(getf->code," return pyobj;\n");
|
Append(getf->code," return pyobj;\n");
|
||||||
Append(getf->code,"fail:\n");
|
if (addfail) {
|
||||||
Append(getf->code," return NULL;\n");
|
Append(getf->code,"fail:\n");
|
||||||
|
Append(getf->code," return NULL;\n");
|
||||||
|
}
|
||||||
Append(getf->code,"}\n");
|
Append(getf->code,"}\n");
|
||||||
|
|
||||||
Wrapper_print(getf,f_wrappers);
|
Wrapper_print(getf,f_wrappers);
|
||||||
|
|
|
||||||
|
|
@ -1426,6 +1426,7 @@ public:
|
||||||
setf = NewWrapper();
|
setf = NewWrapper();
|
||||||
|
|
||||||
/* create getter */
|
/* create getter */
|
||||||
|
int addfail = 0;
|
||||||
getfname = Swig_name_get(iname);
|
getfname = Swig_name_get(iname);
|
||||||
Printv(getf->def, "SWIGINTERN VALUE\n", getfname, "(", NIL);
|
Printv(getf->def, "SWIGINTERN VALUE\n", getfname, "(", NIL);
|
||||||
Printf(getf->def, "VALUE self");
|
Printf(getf->def, "VALUE self");
|
||||||
|
|
@ -1438,14 +1439,16 @@ public:
|
||||||
Replaceall(tm,"$target","_val");
|
Replaceall(tm,"$target","_val");
|
||||||
Replaceall(tm,"$source",name);
|
Replaceall(tm,"$source",name);
|
||||||
/* Printv(getf->code,tm, NIL); */
|
/* Printv(getf->code,tm, NIL); */
|
||||||
emit_action_code(n, getf, tm);
|
addfail = emit_action_code(n, getf, tm);
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_TYPEMAP_VAROUT_UNDEF, input_file, line_number,
|
Swig_warning(WARN_TYPEMAP_VAROUT_UNDEF, input_file, line_number,
|
||||||
"Unable to read variable of type %s\n", SwigType_str(t,0));
|
"Unable to read variable of type %s\n", SwigType_str(t,0));
|
||||||
}
|
}
|
||||||
Printv(getf->code, tab4, "return _val;\n", NIL);
|
Printv(getf->code, tab4, "return _val;\n", NIL);
|
||||||
Append(getf->code,"fail:\n");
|
if (addfail) {
|
||||||
Append(getf->code," return Qnil;\n");
|
Append(getf->code,"fail:\n");
|
||||||
|
Append(getf->code," return Qnil;\n");
|
||||||
|
}
|
||||||
Append(getf->code,"}\n");
|
Append(getf->code,"}\n");
|
||||||
|
|
||||||
Wrapper_print(getf,f_wrappers);
|
Wrapper_print(getf,f_wrappers);
|
||||||
|
|
|
||||||
|
|
@ -574,6 +574,7 @@ public:
|
||||||
if (!addSymbol(iname,n)) return SWIG_ERROR;
|
if (!addSymbol(iname,n)) return SWIG_ERROR;
|
||||||
|
|
||||||
/* Create a function for getting a variable */
|
/* Create a function for getting a variable */
|
||||||
|
int addfail = 0;
|
||||||
getf = NewWrapper();
|
getf = NewWrapper();
|
||||||
getname = Swig_name_get(iname);
|
getname = Swig_name_get(iname);
|
||||||
Printv(getf->def,"SWIGINTERN char *",getname,"(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, char *name1, char *name2, int flags) {",NIL);
|
Printv(getf->def,"SWIGINTERN char *",getname,"(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, char *name1, char *name2, int flags) {",NIL);
|
||||||
|
|
@ -583,14 +584,16 @@ public:
|
||||||
Replaceall(tm,"$target","value");
|
Replaceall(tm,"$target","value");
|
||||||
Replaceall(tm,"$result", "value");
|
Replaceall(tm,"$result", "value");
|
||||||
/* Printf(getf->code, "%s\n",tm); */
|
/* Printf(getf->code, "%s\n",tm); */
|
||||||
emit_action_code(n, getf, tm);
|
addfail = emit_action_code(n, getf, tm);
|
||||||
Printf(getf->code, "if (value) {\n");
|
Printf(getf->code, "if (value) {\n");
|
||||||
Printf(getf->code, "Tcl_SetVar2(interp,name1,name2,Tcl_GetStringFromObj(value,NULL), flags);\n");
|
Printf(getf->code, "Tcl_SetVar2(interp,name1,name2,Tcl_GetStringFromObj(value,NULL), flags);\n");
|
||||||
Printf(getf->code, "Tcl_DecrRefCount(value);\n");
|
Printf(getf->code, "Tcl_DecrRefCount(value);\n");
|
||||||
Printf(getf->code, "}\n");
|
Printf(getf->code, "}\n");
|
||||||
Printf(getf->code, "return NULL;\n");
|
Printf(getf->code, "return NULL;\n");
|
||||||
Append(getf->code,"fail:\n");
|
if (addfail) {
|
||||||
Printf(getf->code,"return \"%s\";\n", iname);
|
Append(getf->code,"fail:\n");
|
||||||
|
Printf(getf->code,"return \"%s\";\n", iname);
|
||||||
|
}
|
||||||
Printf(getf->code,"}\n");
|
Printf(getf->code,"}\n");
|
||||||
Wrapper_print(getf,f_wrappers);
|
Wrapper_print(getf,f_wrappers);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue