diff --git a/CHANGES.current b/CHANGES.current index 077c5d955..784df509f 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -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`. diff --git a/Examples/test-suite/errors/cpp_smartptr_feature.i b/Examples/test-suite/errors/cpp_smartptr_feature.i index 4a0d510cd..11cf62feb 100644 --- a/Examples/test-suite/errors/cpp_smartptr_feature.i +++ b/Examples/test-suite/errors/cpp_smartptr_feature.i @@ -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 {}; diff --git a/Examples/test-suite/errors/cpp_smartptr_feature.stderr b/Examples/test-suite/errors/cpp_smartptr_feature.stderr index 442f795ac..4a6a5ee28 100644 --- a/Examples/test-suite/errors/cpp_smartptr_feature.stderr +++ b/Examples/test-suite/errors/cpp_smartptr_feature.stderr @@ -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. diff --git a/Source/Modules/typepass.cxx b/Source/Modules/typepass.cxx index 716204c7f..a75be41b3 100644 --- a/Source/Modules/typepass.cxx +++ b/Source/Modules/typepass.cxx @@ -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) {