Skip to content

Commit

Permalink
Merge pull request #77 from Alzathar/matlab-unused-parameter
Browse files Browse the repository at this point in the history
Matlab unused parameter
  • Loading branch information
jaeandersson authored Nov 9, 2016
2 parents 989d8d6 + 9c7240f commit 282170e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Lib/matlab/matlabrun.swg
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ SWIG_Matlab_CallInterpEx(int nlhs, mxArray *plhs[], int nrhs,

/* Convert a packed value value */
SWIGRUNTIME int
SWIG_Matlab_ConvertPacked(mxArray* pm, void *ptr, size_t sz, swig_type_info *ty) {
SWIG_Matlab_ConvertPacked(mxArray* /*pm*/, void* /*ptr*/, size_t /*sz*/, swig_type_info* /*ty*/) {
mexErrMsgIdAndTxt("SWIG:ConvertPacked","Not implemented");
return SWIG_ERROR;
}
Expand Down Expand Up @@ -221,7 +221,7 @@ SWIGRUNTIME mxArray* SWIG_Matlab_NewPointerObj(void *ptr, swig_type_info *type,
/* Create a new packed object */

SWIGRUNTIMEINLINE mxArray*
SWIG_Matlab_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
SWIG_Matlab_NewPackedObj(void* /*ptr*/, size_t /*sz*/, swig_type_info* /*type*/) {
mexErrMsgIdAndTxt("SWIG:NewPackedOb","Not implemented");
return 0;
}
Expand Down
12 changes: 9 additions & 3 deletions Source/Modules/matlab.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ int MATLAB::top(Node *n) {
Printf(f_begin,"}\n\n");

// Touch module
Printf(f_begin,"int swigTouch(int resc, mxArray *resv[], int argc, mxArray *argv[]) {\n");
Printf(f_begin,"int swigTouch(int resc, mxArray** /*resv*/, int argc, mxArray** /*argv*/) {\n");

// Make sure no inputs or outputs
Printf(f_begin," if (argc!=0 || resc!=0) {\n");
Expand Down Expand Up @@ -919,7 +919,10 @@ int MATLAB::functionWrapper(Node *n) {

Printf(f->code, "if (!SWIG_check_num_args(\"%s\",argc,%i,%i,%i)) "
"{\n SWIG_fail;\n }\n", iname, num_arguments, num_required, varargs);
if (constructor && num_arguments == 1 && num_required == 1) {
if (num_arguments == 0 && num_required == 0) {
Printf(f->code, "(void)argv; // Unused variable\n");
}
else if (constructor && num_arguments == 1 && num_required == 1) {
if (Cmp(storage, "explicit") == 0) {
Node *parent = Swig_methodclass(n);
if (GetFlag(parent, "feature:implicitconv")) {
Expand Down Expand Up @@ -2314,7 +2317,7 @@ void MATLAB::finalizeGateway() {

void MATLAB::initConstant() {
if (CPlusPlus) Printf(f_constants,"extern \"C\"\n");
Printf(f_constants,"int swigConstant(int resc, mxArray *resv[], int argc, mxArray *argv[]) {\n");
Printf(f_constants,"int swigConstant(int /*resc*/, mxArray *resv[], int argc, mxArray *argv[]) {\n");

// The first argument is always the ID
Printf(f_constants," if (--argc < 0 || !mxIsDouble(*argv) || mxGetNumberOfElements(*argv)!=1) {\n");
Expand Down Expand Up @@ -2344,6 +2347,9 @@ void MATLAB::finalizeConstant() {
Printf(f_constants," SWIG_Error(SWIG_RuntimeError, \"No such constant.\");\n");
Printf(f_constants," return 1;\n");
Printf(f_constants," }\n");
if (num_constant == 0) {
Printf(f_constants," (void)resv; // Unused variable\n");
}
Printf(f_constants," return 0;\n");
Printf(f_constants,"}\n");
}
Expand Down

0 comments on commit 282170e

Please sign in to comment.