Add new warning if an empty template declaration is used on a base class, minor docs improvement for empty template declarations.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13840 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-09-14 22:25:35 +00:00
commit bc43673a86
6 changed files with 37 additions and 7 deletions

View file

@ -965,7 +965,7 @@ int Language::cDeclaration(Node *n) {
DohIncref(type);
Setattr(n, "type", ty);
if (GetFlag(n, "feature:onlychildren") && !GetFlag(n, "feature:ignore")) {
// Found an unignored templated method that has a an empty template instantiation (%template())
// Found an unignored templated method that has an empty template instantiation (%template())
// Ignore it unless it has been %rename'd
if (Strncmp(symname, "__dummy_", 8) == 0) {
SetFlag(n, "feature:ignore");

View file

@ -185,9 +185,14 @@ class TypePass:private Dispatcher {
bcls = 0;
} else {
if (Getattr(bcls, "typepass:visit")) {
if (!ilist)
ilist = alist = NewList();
Append(ilist, bcls);
if (!Getattr(bcls, "feature:onlychildren")) {
if (!ilist)
ilist = alist = NewList();
Append(ilist, bcls);
} else {
Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bname), Getline(bname), "Base class '%s' has no name as it is an empty template instantiated with '%%template()'. Ignored.\n", SwigType_namestr(bname));
Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bcls), Getline(bcls), "The %%template directive must be written before '%s' is used as a base class and be declared with a name.\n", SwigType_namestr(bname));
}
} else {
Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bname), Getline(bname), "Base class '%s' undefined.\n", SwigType_namestr(bname));
Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bcls), Getline(bcls), "'%s' must be defined before it is used as a base class.\n", SwigType_namestr(bname));