From 24f5cd42b7d4deca8db649a059158c72d2342136 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Thu, 27 Mar 2008 21:15:04 +0000 Subject: [PATCH] avoid even more false warnings better handling numeric default values git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52865 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/ifacecheck/src/xmlparser.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/utils/ifacecheck/src/xmlparser.cpp b/utils/ifacecheck/src/xmlparser.cpp index 43892d970d..c91695a4bd 100644 --- a/utils/ifacecheck/src/xmlparser.cpp +++ b/utils/ifacecheck/src/xmlparser.cpp @@ -119,12 +119,13 @@ void wxArgumentType::SetDefaultValue(const wxString& defval, const wxString& def { m_strDefaultValue=defval.Strip(wxString::both); m_strDefaultValueForCmp=defvalForCmp.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 // to a single form: - m_strDefaultValue.Replace("0u", "0"); - + if (m_strDefaultValue == "0u") + m_strDefaultValue = "0"; +/* if (IsPointer()) m_strDefaultValue.Replace("0", "NULL"); else @@ -144,7 +145,20 @@ bool wxArgumentType::operator==(const wxArgumentType& m) const const wxString& def2 = m.m_strDefaultValueForCmp.IsEmpty() ? m.m_strDefaultValue : m.m_strDefaultValueForCmp; if (def1 != def2) + { + // maybe the default values are numbers. + // in this case gccXML gives as default values things like '-0x0000001' instead of just '-1'. + // To handle these cases, we try to convert the default value strings to numbers: + long def1val, def2val; + if (def1.ToLong(&def1val, 0 /* auto-detect */) && + def2.ToLong(&def2val, 0 /* auto-detect */)) + { + if (def1val == def2val) + return true; // the default values match + } + return false; + } // we deliberately avoid checks on the argument name -- 2.47.2