diff --git a/CommonCheck.cpp b/CommonCheck.cpp index 030be496a..3abb9e2f7 100644 --- a/CommonCheck.cpp +++ b/CommonCheck.cpp @@ -222,9 +222,26 @@ void CheckGlobalFunctionUsage(const std::vector &filenames) // Iterator for UsedGlobalFunctions std::list::const_iterator usedfunc; + unsigned int i1 = 0; + unsigned int i2 = 1; + // Check that every function in GlobalFunctions are used for ( func = GlobalFunctions.begin(); func != GlobalFunctions.end(); func++ ) { + if ( GlobalFunctions.size() > 100 ) + { + ++i1; + if ( i1 > (i2 * GlobalFunctions.size()) / 100 ) + { + if ( (i2 % 10) == 0 ) + std::cout << i2 << "%"; + else + std::cout << "."; + std::cout.flush(); + ++i2; + } + } + const std::string &funcname = func->name(); if ( funcname == "main" || funcname == "WinMain" ) @@ -261,6 +278,8 @@ void CheckGlobalFunctionUsage(const std::vector &filenames) ReportErr( errmsg.str() ); } } + + std::cout << "\n"; } //--------------------------------------------------------------------------- diff --git a/main.cpp b/main.cpp index 0f269525a..1abd75f3d 100644 --- a/main.cpp +++ b/main.cpp @@ -222,10 +222,11 @@ int main(int argc, char* argv[]) std::cerr << errout.str(); } - if ( CheckCodingStyle && filenames.size() > 1 ) + // This generates false positives - especially for libraries + if ( ShowAll && CheckCodingStyle && filenames.size() > 1 ) { errout.str(""); - std::cout << "Checking usage of global functions..\n"; + std::cout << "Checking usage of global functions (this may take several minutes)..\n"; CheckGlobalFunctionUsage(filenames); if ( ! errout.str().empty() ) {