Fix partial overloading warning messages appearing

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12527 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2011-03-11 22:36:59 +00:00
commit c8b89bd075
4 changed files with 32 additions and 3 deletions

View file

@ -0,0 +1,13 @@
%module xxx
void check(const int *v) {}
void check(int *v) {}
void check(int &v) {}
void check(const int &v) {} // note: no warning as marshalled by value
struct OverStruct {};
void check(const OverStruct *v) {}
void check(OverStruct *v) {}
void check(OverStruct &v) {}
void check(const OverStruct &v) {}

View file

@ -288,6 +288,18 @@ cpp_nobase.i:6: Warning 401: Maybe you forgot to instantiate 'Bar< int >' using
:::::::::::::::::::::::::::::::: cpp_overload.i ::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::: cpp_overload.i :::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::: cpp_overload_const.i :::::::::::::::::::::::::::::::::::
cpp_overload_const.i:4: Warning 509: Overloaded method check(int *) effectively ignored,
cpp_overload_const.i:3: Warning 509: as it is shadowed by check(int const *).
cpp_overload_const.i:5: Warning 509: Overloaded method check(int &) effectively ignored,
cpp_overload_const.i:3: Warning 509: as it is shadowed by check(int const *).
cpp_overload_const.i:10: Warning 509: Overloaded method check(OverStruct *) effectively ignored,
cpp_overload_const.i:9: Warning 509: as it is shadowed by check(OverStruct const *).
cpp_overload_const.i:11: Warning 509: Overloaded method check(OverStruct &) effectively ignored,
cpp_overload_const.i:9: Warning 509: as it is shadowed by check(OverStruct const *).
cpp_overload_const.i:12: Warning 509: Overloaded method check(OverStruct const &) effectively ignored,
cpp_overload_const.i:9: Warning 509: as it is shadowed by check(OverStruct const *).
:::::::::::::::::::::::::::::::: cpp_private_defvalue.i ::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::: cpp_private_defvalue.i :::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::: cpp_private_inherit.i ::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::: cpp_private_inherit.i :::::::::::::::::::::::::::::::::::

View file

@ -76,6 +76,7 @@ cpp_nested
cpp_no_access cpp_no_access
cpp_nobase cpp_nobase
cpp_overload cpp_overload
cpp_overload_const
cpp_private_defvalue cpp_private_defvalue
cpp_private_inherit cpp_private_inherit
cpp_recursive_typedef cpp_recursive_typedef

View file

@ -231,13 +231,14 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
Swig_warning(WARN_LANG_OVERLOAD_CONST, Getfile(nodes[i].n), Getline(nodes[i].n), Swig_warning(WARN_LANG_OVERLOAD_CONST, Getfile(nodes[i].n), Getline(nodes[i].n),
"using non-const method %s instead.\n", Swig_name_decl(nodes[i].n)); "using non-const method %s instead.\n", Swig_name_decl(nodes[i].n));
} else { } else {
if (!Getattr(nodes[j].n, "overload:ignore")) if (!Getattr(nodes[j].n, "overload:ignore")) {
Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n), Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n),
"Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n)); "Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n));
Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[i].n), Getline(nodes[i].n), Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[i].n), Getline(nodes[i].n),
"using %s instead.\n", Swig_name_decl(nodes[i].n)); "using %s instead.\n", Swig_name_decl(nodes[i].n));
} }
} }
}
nodes[j].error = 1; nodes[j].error = 1;
} else if (!SwigType_isconst(d1) && SwigType_isconst(d2)) { } else if (!SwigType_isconst(d1) && SwigType_isconst(d2)) {
differ = 1; differ = 1;
@ -248,13 +249,14 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
Swig_warning(WARN_LANG_OVERLOAD_CONST, Getfile(nodes[i].n), Getline(nodes[i].n), Swig_warning(WARN_LANG_OVERLOAD_CONST, Getfile(nodes[i].n), Getline(nodes[i].n),
"using non-const method %s instead.\n", Swig_name_decl(nodes[i].n)); "using non-const method %s instead.\n", Swig_name_decl(nodes[i].n));
} else { } else {
if (!Getattr(nodes[j].n, "overload:ignore")) if (!Getattr(nodes[j].n, "overload:ignore")) {
Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n), Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n),
"Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n)); "Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n));
Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[i].n), Getline(nodes[i].n), Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[i].n), Getline(nodes[i].n),
"using %s instead.\n", Swig_name_decl(nodes[i].n)); "using %s instead.\n", Swig_name_decl(nodes[i].n));
} }
} }
}
nodes[j].error = 1; nodes[j].error = 1;
} }
} }
@ -270,12 +272,13 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
Swig_warning(WARN_LANG_OVERLOAD_SHADOW, Getfile(nodes[i].n), Getline(nodes[i].n), Swig_warning(WARN_LANG_OVERLOAD_SHADOW, Getfile(nodes[i].n), Getline(nodes[i].n),
"as it is shadowed by %s.\n", Swig_name_decl(nodes[i].n)); "as it is shadowed by %s.\n", Swig_name_decl(nodes[i].n));
} else { } else {
if (!Getattr(nodes[j].n, "overload:ignore")) if (!Getattr(nodes[j].n, "overload:ignore")) {
Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n), Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n),
"Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n)); "Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n));
Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[i].n), Getline(nodes[i].n), Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[i].n), Getline(nodes[i].n),
"using %s instead.\n", Swig_name_decl(nodes[i].n)); "using %s instead.\n", Swig_name_decl(nodes[i].n));
} }
}
nodes[j].error = 1; nodes[j].error = 1;
} }
} }