From: Francesco Montorsi Date: Tue, 25 Mar 2008 12:26:23 +0000 (+0000) Subject: for each prototype make sure that if the n-th argument has a default value, then... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/203ba76a12c701e24e1cd8dadb31748976af98a2?hp=a6052817bb8cc906c8fc1dc801f8f21c58041f92 for each prototype make sure that if the n-th argument has a default value, then all the following arguments have a default value, too git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52807 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/utils/ifacecheck/src/ifacecheck.cpp b/utils/ifacecheck/src/ifacecheck.cpp index 1e2c5848a1..c119238532 100644 --- a/utils/ifacecheck/src/ifacecheck.cpp +++ b/utils/ifacecheck/src/ifacecheck.cpp @@ -259,6 +259,13 @@ int IfaceCheckApp::CompareClasses(const wxClass* iface, const wxClassPtrArray& a if (overloads.GetCount()==0) { + /* + TODO: sometimes the interface headers re-document a method + inherited from a base class even if the real header does + not actually re-implement it. + To avoid false positives, we'd need to search in the base classes + of api[] classes and search for a matching method. + */ LogMessage("%s: real '%s' class has no method '%s'", header, searchedclasses, m.GetAsString()); // we've found no overloads diff --git a/utils/ifacecheck/src/xmlparser.cpp b/utils/ifacecheck/src/xmlparser.cpp index 35c9e008a3..51e04d35a4 100644 --- a/utils/ifacecheck/src/xmlparser.cpp +++ b/utils/ifacecheck/src/xmlparser.cpp @@ -117,7 +117,7 @@ bool wxType::operator==(const wxType& m) const void wxArgumentType::SetDefaultValue(const wxString& defval) { - m_strDefaultValue=defval; + m_strDefaultValue=defval.Strip(wxString::both); // in order to make valid&simple comparison on argument defaults, // we reduce some of the multiple forms in which the same things may appear @@ -131,7 +131,7 @@ void wxArgumentType::SetDefaultValue(const wxString& defval) if (m_strDefaultValue.Contains("wxGetTranslation")) - m_strDefaultValue = wxEmptyString; // TODO: wxGetTranslation gives problems to gccxml + m_strDefaultValue = "_(TOFIX)"; // TODO: wxGetTranslation gives problems to gccxml } bool wxArgumentType::operator==(const wxArgumentType& m) const @@ -175,13 +175,28 @@ bool wxMethod::IsOk() const for (unsigned int i=0; i) - // so we don't do any test on them. + // so we don't do any test on their contents + if (m_args.GetCount()>0) + { + bool previousArgHasDefault = m_args[0].HasDefaultValue(); + for (unsigned int i=1; i node is a method of the i-th class! wxMethod newfunc; - if (!ParseMethod(child, types, newfunc)) + if (!ParseMethod(child, types, newfunc)) { + LogError("The method '%s' could not be added to class '%s'", + child->GetAttribute("demangled"), p->GetName()); return false; + } if (newfunc.IsCtor() && !p->IsValidCtorForThisClass(newfunc)) { LogError("The method '%s' does not seem to be a ctor for '%s'", @@ -798,7 +816,6 @@ bool wxXmlGccInterface::Parse(const wxString& filename) if ((++nodes%PROGRESS_RATE)==0) ShowProgress(); } - //wxPrint("\n"); if (!CheckParseResults()) return false; @@ -981,20 +998,23 @@ bool wxXmlDoxygenInterface::ParseCompoundDefinition(const wxString& filename) { wxMethod m; - if (ParseMethod(membernode, m, header)) + if (!ParseMethod(membernode, m, header)) { + LogError("The method '%s' could not be added to class '%s'", + m.GetName(), klass.GetName()); + return false; + } + + if (absoluteFile.IsEmpty()) + absoluteFile = header; + else if (header != absoluteFile) { - if (absoluteFile.IsEmpty()) - absoluteFile = header; - else if (header != absoluteFile) - { - LogError("The method '%s' is documented in a different " - "file from others (which belong to '%s') ?", - header, absoluteFile); - return false; - } - - klass.AddMethod(m); + LogError("The method '%s' is documented in a different " + "file from others (which belong to '%s') ?", + header, absoluteFile); + return false; } + + klass.AddMethod(m); } membernode = membernode->GetNext(); diff --git a/utils/ifacecheck/src/xmlparser.h b/utils/ifacecheck/src/xmlparser.h index 200024da61..b503a56d34 100644 --- a/utils/ifacecheck/src/xmlparser.h +++ b/utils/ifacecheck/src/xmlparser.h @@ -84,6 +84,9 @@ public: wxString GetDefaultValue() const { return m_strDefaultValue; } + bool HasDefaultValue() const + { return !m_strDefaultValue.IsEmpty(); } + bool operator==(const wxArgumentType& m) const; bool operator!=(const wxArgumentType& m) const { return !(*this == m); }