More warning and error fixes (work in progress with Tinderbox).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba 2005-05-31 17:47:46 +00:00
parent 47a4a1aec8
commit 60ec1c8778
5 changed files with 78 additions and 57 deletions

View File

@ -750,7 +750,7 @@ int main(int argc, char **argv)
header.c_str()); header.c_str());
} }
else if ( mode == Mode_Dump ) { else if ( mode == Mode_Dump ) {
((spFile *)ctxTop)->mFileName = header; ((spFile *)ctxTop)->m_FileName = header;
visitor.VisitAll(*ctxTop); visitor.VisitAll(*ctxTop);
visitor.EndVisit(); visitor.EndVisit();
} }
@ -902,7 +902,7 @@ void HelpGenVisitor::CloseClass()
wxString section(m_arrayFuncDocs[n].text); wxString section(m_arrayFuncDocs[n].text);
// Strip leading whitespace // Strip leading whitespace
int pos = section.Find("\\membersection"); int pos = section.Find(_T("\\membersection"));
if (pos > -1) if (pos > -1)
{ {
section = section.Mid(pos); section = section.Mid(pos);
@ -953,7 +953,7 @@ void HelpGenVisitor::EndVisit()
void HelpGenVisitor::VisitFile( spFile& file ) void HelpGenVisitor::VisitFile( spFile& file )
{ {
m_fileHeader = file.mFileName; m_fileHeader = file.m_FileName;
wxLogVerbose("%s: started generating docs for classes from file '%s'...", wxLogVerbose("%s: started generating docs for classes from file '%s'...",
GetCurrentTimeFormatted("%H:%M:%S"), m_fileHeader.c_str()); GetCurrentTimeFormatted("%H:%M:%S"), m_fileHeader.c_str());
} }
@ -1295,13 +1295,19 @@ void HelpGenVisitor::VisitOperation( spOperation& op )
m_classname.c_str(), funcname.c_str(), m_classname.c_str(), funcname.c_str(),
MakeLabel(m_classname, funcname).c_str()); MakeLabel(m_classname, funcname).c_str());
wxString constStr;
if(op.mIsConstant) constStr = _T("const");
wxString virtualStr;
if(op.mIsVirtual) virtualStr = _T("virtual ");
wxString func; wxString func;
func.Printf("\n" func.Printf(_T("\n")
"\\%sfunc{%s%s}{%s}{", _T("\\%sfunc{%s%s}{%s}{"),
op.mIsConstant ? "const" : "", constStr.c_str(),
op.mIsVirtual ? "virtual " : "", virtualStr.c_str(),
op.m_RetType.c_str(), op.m_RetType.c_str(),
funcname.c_str()); funcname.c_str());
m_textFunc += func; m_textFunc += func;
} }
@ -1829,21 +1835,29 @@ bool DocManager::DumpDifferences(spContext *ctxTop) const
const MethodInfo& method = *(methods[index]); const MethodInfo& method = *(methods[index]);
bool isVirtual = ctxMethod->mIsVirtual; bool isVirtual = ctxMethod->mIsVirtual;
if ( isVirtual != method.HasFlag(MethodInfo::Virtual) ) { if ( isVirtual != method.HasFlag(MethodInfo::Virtual) )
{
wxString virtualStr;
if(isVirtual)virtualStr = _T("not ");
wxLogWarning("'%s::%s' is incorrectly documented as %s" wxLogWarning("'%s::%s' is incorrectly documented as %s"
"virtual.", "virtual.",
nameClass.c_str(), nameClass.c_str(),
nameMethod.c_str(), nameMethod.c_str(),
isVirtual ? "not " : ""); virtualStr.c_str());
} }
bool isConst = ctxMethod->mIsConstant; bool isConst = ctxMethod->mIsConstant;
if ( isConst != method.HasFlag(MethodInfo::Const) ) { if ( isConst != method.HasFlag(MethodInfo::Const) )
{
wxString constStr;
if(isConst)constStr = _T("not ");
wxLogWarning("'%s::%s' is incorrectly documented as %s" wxLogWarning("'%s::%s' is incorrectly documented as %s"
"constant.", "constant.",
nameClass.c_str(), nameClass.c_str(),
nameMethod.c_str(), nameMethod.c_str(),
isConst ? "not " : ""); constStr.c_str());
} }
// check that the params match // check that the params match
@ -2197,6 +2211,9 @@ static const wxString GetVersionString()
/* /*
$Log$ $Log$
Revision 1.44 2005/05/31 17:47:45 ABX
More warning and error fixes (work in progress with Tinderbox).
Revision 1.43 2005/05/31 15:42:43 ABX Revision 1.43 2005/05/31 15:42:43 ABX
More warning and error fixes (work in progress with Tinderbox). More warning and error fixes (work in progress with Tinderbox).

View File

@ -33,11 +33,11 @@
/***** Implementation for class spInterFileContext *****/ /***** Implementation for class spInterFileContext *****/
size_t spInterFileContext::GetFileNo( const string& fname ) size_t spInterFileContext::GetFileNo( const wxString& fname )
{ {
for ( size_t i = 0; i != mFiles.size(); ++i ) for ( size_t i = 0; i != m_Files.size(); ++i )
{ {
if ( fname == mFiles[i] ) if ( fname == m_Files[i] )
return i; return i;
} }
@ -53,7 +53,7 @@ size_t spInterFileContext::GetFileNoOfContext( spContext& ctx )
// DBG:: outer-file context should be present // DBG:: outer-file context should be present
wxASSERT( pCtx && pCtx->GetType() == SP_CTX_FILE ); wxASSERT( pCtx && pCtx->GetType() == SP_CTX_FILE );
return GetFileNo( ((spFile*)pCtx)->mFileName ); return GetFileNo( ((spFile*)pCtx)->m_FileName );
} }
/*** public interface ***/ /*** public interface ***/
@ -64,10 +64,10 @@ spInterFileContext::spInterFileContext()
spInterFileContext::~spInterFileContext() spInterFileContext::~spInterFileContext()
{} {}
void spInterFileContext::AddFile( const string& fname, const string& content ) void spInterFileContext::AddFile( const wxString& fname, const wxString& content )
{ {
mFiles.push_back( fname ); m_Files.push_back( fname );
mContents.push_back( content ); m_Contents.push_back( content );
} }
void spInterFileContext::RemoveContext( spContext& ctx ) void spInterFileContext::RemoveContext( spContext& ctx )
@ -210,13 +210,13 @@ void spInterFileContext::GenrateContents()
for( size_t f = 0; f != lst.size(); ++f ) for( size_t f = 0; f != lst.size(); ++f )
{ {
string& fname = ((spFile*)lst[f])->mFileName; wxString& fname = ((spFile*)lst[f])->m_FileName;
size_t fileNo = GetFileNo( fname ); size_t fileNo = GetFileNo( fname );
string& source = mContents[ fileNo ]; wxString& source = m_Contents[ fileNo ];
string result; wxString result;
size_t lastKnownPos = 0, // the begining of the file is always "known" size_t lastKnownPos = 0, // the begining of the file is always "known"
lastSavedPos = 0; lastSavedPos = 0;
@ -227,7 +227,7 @@ void spInterFileContext::GenrateContents()
// the end of file is always known // the end of file is always known
lastKnownPos = mContents[ fileNo ].length(); lastKnownPos = m_Contents[ fileNo ].length();
// append the reminder // append the reminder
@ -237,7 +237,7 @@ void spInterFileContext::GenrateContents()
// replace original contnet with newly generated one // replace original contnet with newly generated one
mContents[ fileNo ] = result; m_Contents[ fileNo ] = result;
} }
} }
@ -249,13 +249,13 @@ void spInterFileContext::ParseContents( SourceParserPlugin* pPlugin )
mParser.SetPlugin( pPlugin ); mParser.SetPlugin( pPlugin );
for( size_t i = 0; i != mFiles.size(); ++i ) for( size_t i = 0; i != m_Files.size(); ++i )
{ {
char* s = (char*)(mContents[i].c_str()); wxChar* s = (char*)(m_Contents[i].c_str());
spFile* pFCtx = mParser.Parse( s, s + mContents[i].length() ); spFile* pFCtx = mParser.Parse( s, s + m_Contents[i].length() );
pFCtx->mFileName = mFiles[i]; pFCtx->m_FileName = m_Files[i];
AddMember( pFCtx ); AddMember( pFCtx );
} }
@ -263,13 +263,13 @@ void spInterFileContext::ParseContents( SourceParserPlugin* pPlugin )
void spInterFileContext::WriteToFiles() void spInterFileContext::WriteToFiles()
{ {
for( size_t i = 0; i != mFiles.size(); ++i ) for( size_t i = 0; i != m_Files.size(); ++i )
{ {
FILE* fp = fopen( mFiles[i].c_str(), "w+t" ); FILE* fp = fopen( m_Files[i].c_str(), "w+t" );
if ( fp != NULL ) if ( fp != NULL )
{ {
fwrite( mContents[i].c_str(), sizeof(char), mContents[i].length(), fp ); fwrite( m_Contents[i].c_str(), sizeof(char), m_Contents[i].length(), fp );
fclose( fp ); fclose( fp );
} }
@ -280,7 +280,7 @@ wxString spInterFileContext::GetBody( spContext* pCtx )
{ {
wxASSERT( pCtx->PositionIsKnown() ); // DBG:: should be checked by-user code wxASSERT( pCtx->PositionIsKnown() ); // DBG:: should be checked by-user code
wxString& source = mContents[ GetFileNoOfContext( *pCtx ) ]; wxString& source = m_Contents[ GetFileNoOfContext( *pCtx ) ];
return wxString( source.c_str() + pCtx->mSrcOffset, pCtx->mContextLength ); return wxString( source.c_str() + pCtx->mSrcOffset, pCtx->mContextLength );
} }
@ -291,7 +291,7 @@ wxString spInterFileContext::GetHeader( spContext* pCtx )
wxASSERT( pCtx->mHeaderLength != -1 ); // DBG:: -/- wxASSERT( pCtx->mHeaderLength != -1 ); // DBG:: -/-
wxString& source = mContents[ GetFileNoOfContext( *pCtx ) ]; wxString& source = m_Contents[ GetFileNoOfContext( *pCtx ) ];
return wxString( source.c_str() + pCtx->mSrcOffset, pCtx->mHeaderLength ); return wxString( source.c_str() + pCtx->mSrcOffset, pCtx->mHeaderLength );
} }

View File

@ -55,7 +55,7 @@ protected:
protected: protected:
size_t GetFileNoOfContext( spContext& ctx ); size_t GetFileNoOfContext( spContext& ctx );
size_t GetFileNo( const string& fname ); size_t GetFileNo( const wxString& fname );
void InsertBookmarkSorted( BookmarkListT& lst, spBookmark& mark ); void InsertBookmarkSorted( BookmarkListT& lst, spBookmark& mark );
@ -71,15 +71,15 @@ protected:
public: public:
StrListT mFiles; StrListT m_Files;
StrListT mContents; StrListT m_Contents;
public: public:
spInterFileContext(); spInterFileContext();
~spInterFileContext(); ~spInterFileContext();
void AddFile( const string& fname, const string& content ); void AddFile( const wxString& fname, const wxString& content );
void RemoveContext( spContext& ctx ); void RemoveContext( spContext& ctx );

View File

@ -606,10 +606,14 @@ void spOperation::DumpThis(const wxString& indent) const
protection = "global"; protection = "global";
} }
wxString constStr,virtualStr;
if(mIsConstant) constStr = _T("const ");
if(mIsVirtual) virtualStr = _T("virtual ");
wxLogDebug("%s%s%s%s function named '%s::%s' of type '%s'", wxLogDebug("%s%s%s%s function named '%s::%s' of type '%s'",
indent.c_str(), indent.c_str(),
mIsConstant ? "const " : "", constStr.c_str(),
mIsVirtual ? "virtual " : "", virtualStr.c_str(),
protection.c_str(), protection.c_str(),
mScope.c_str(), m_Name.c_str(), m_RetType.c_str()); mScope.c_str(), m_Name.c_str(), m_RetType.c_str());
} }
@ -700,7 +704,7 @@ void spTypeDef::DumpThis(const wxString& indent) const
void spFile::DumpThis(const wxString& indent) const void spFile::DumpThis(const wxString& indent) const
{ {
wxLogDebug("%sfile '%s'", wxLogDebug("%sfile '%s'",
indent.c_str(), mFileName.c_str()); indent.c_str(), m_FileName.c_str());
} }
#endif // __WXDEBUG__ #endif // __WXDEBUG__

View File

@ -701,7 +701,7 @@ class spFile : public spContext
public: public:
// since file name cannot be determined from // since file name cannot be determined from
// source code, filling in this field is optional // source code, filling in this field is optional
string mFileName; wxString m_FileName;
public: public:
virtual int GetContextType() const { return SP_CTX_FILE; } virtual int GetContextType() const { return SP_CTX_FILE; }