Don't show incorrect warning SWIGWARN_LANG_SMARTPTR_MISSING (520)

Was showing for an ignored derived class.

Closes #2879
This commit is contained in:
William S Fulton 2024-09-21 13:28:03 +01:00
parent 2e9e89736e
commit 64649df343
4 changed files with 19 additions and 2 deletions

View File

@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.3.0 (in progress)
===========================
2024-09-19: wsfulton
#2879 Don't show warning SWIGWARN_LANG_SMARTPTR_MISSING (520) if
class is ignored.
2024-09-21: olly
SWIG was ignoring `final` if specified after `noexcept`.

View File

@ -9,6 +9,17 @@ struct BB : AA {};
struct CC : AA {};
struct DD : AA {};
%ignore EE;
struct EE : AA {}; // should not warn for AA base as EE is ignored
struct EEE : EE {}; // should warn for AA base, but not for EE base
%feature("smartptr", noblock=1) YY { std::shared_ptr< YY > }
struct XX {};
struct YY : XX {};
%feature("smartptr", noblock=1) ZZ { std::shared_ptr< YY > }
%ignore ZZ;
struct ZZ : XX {};
// Next two are NOT smartptr and so should not issue warning
struct ZZZ : ZZ {};
struct ZZZZ : ZZZ {};

View File

@ -2,4 +2,5 @@ cpp_smartptr_feature.i:8: Warning 520: Derived class 'BB' of 'AA' is not similar
cpp_smartptr_feature.i:9: Warning 520: Derived class 'CC' of 'AA' is not similarly marked as a smart pointer.
cpp_smartptr_feature.i:10: Error: Invalid type (std::shared_ptr<) in 'smartptr' feature for class DD.
cpp_smartptr_feature.i:10: Warning 520: Derived class 'DD' of 'AA' is not similarly marked as a smart pointer.
cpp_smartptr_feature.i:14: Warning 520: Base class 'XX' of 'YY' is not similarly marked as a smart pointer.
cpp_smartptr_feature.i:14: Warning 520: Derived class 'EEE' of 'AA' is not similarly marked as a smart pointer.
cpp_smartptr_feature.i:18: Warning 520: Base class 'XX' of 'YY' is not similarly marked as a smart pointer.

View File

@ -282,7 +282,8 @@ class TypePass:private Dispatcher {
}
} else {
if (GetFlag(bclass, "smart"))
Swig_warning(WARN_LANG_SMARTPTR_MISSING, Getfile(first), Getline(first), "Derived class '%s' of '%s' is not similarly marked as a smart pointer.\n", SwigType_namestr(Getattr(first, "name")), SwigType_namestr(Getattr(bclass, "name")));
if (!GetFlag(first, "feature:ignore"))
Swig_warning(WARN_LANG_SMARTPTR_MISSING, Getfile(first), Getline(first), "Derived class '%s' of '%s' is not similarly marked as a smart pointer.\n", SwigType_namestr(Getattr(first, "name")), SwigType_namestr(Getattr(bclass, "name")));
}
}
if (!importmode) {