Astyle cleanup with new Astyle options.
This commit is contained in:
parent
056c21367e
commit
2fa4378338
|
@ -57,7 +57,7 @@ int ThreadExecutor::handleRead(unsigned int &result)
|
||||||
char type = 0;
|
char type = 0;
|
||||||
if (read(_pipe[0], &type, 1) <= 0)
|
if (read(_pipe[0], &type, 1) <= 0)
|
||||||
{
|
{
|
||||||
if ( errno == EAGAIN )
|
if (errno == EAGAIN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -141,10 +141,10 @@ unsigned int ThreadExecutor::check()
|
||||||
|
|
||||||
unsigned int childCount = 0;
|
unsigned int childCount = 0;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
while ( true )
|
while (true)
|
||||||
{
|
{
|
||||||
// Start a new child
|
// Start a new child
|
||||||
if ( i < _filenames.size() && childCount < _settings._jobs )
|
if (i < _filenames.size() && childCount < _settings._jobs)
|
||||||
{
|
{
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
|
@ -185,9 +185,9 @@ unsigned int ThreadExecutor::check()
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
int readRes = handleRead(result);
|
int readRes = handleRead(result);
|
||||||
if ( readRes == -1 )
|
if (readRes == -1)
|
||||||
break;
|
break;
|
||||||
else if ( readRes == 0 )
|
else if (readRes == 0)
|
||||||
usleep(5000); // 5 ms
|
usleep(5000); // 5 ms
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -747,7 +747,7 @@ unsigned int CppCheck::check()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string appendCode = _settings.append();
|
std::string appendCode = _settings.append();
|
||||||
if ( !appendCode.empty() )
|
if (!appendCode.empty())
|
||||||
Preprocessor::preprocessWhitespaces(appendCode);
|
Preprocessor::preprocessWhitespaces(appendCode);
|
||||||
|
|
||||||
checkFile(codeWithoutCfg + appendCode, _filenames[c].c_str());
|
checkFile(codeWithoutCfg + appendCode, _filenames[c].c_str());
|
||||||
|
|
|
@ -45,7 +45,7 @@ private:
|
||||||
* Execute check using n jobs for y files which are have
|
* Execute check using n jobs for y files which are have
|
||||||
* identical data, given within data.
|
* identical data, given within data.
|
||||||
*/
|
*/
|
||||||
void check( int jobs, int files, int result, const std::string &data)
|
void check(int jobs, int files, int result, const std::string &data)
|
||||||
{
|
{
|
||||||
errout.str("");
|
errout.str("");
|
||||||
output.str("");
|
output.str("");
|
||||||
|
@ -56,7 +56,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> filenames;
|
std::vector<std::string> filenames;
|
||||||
for ( int i = 1; i <= files; ++i )
|
for (int i = 1; i <= files; ++i)
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "file_" << i << ".cpp";
|
oss << "file_" << i << ".cpp";
|
||||||
|
@ -67,7 +67,7 @@ private:
|
||||||
settings._jobs = jobs;
|
settings._jobs = jobs;
|
||||||
ThreadExecutor executor(filenames, settings, *this);
|
ThreadExecutor executor(filenames, settings, *this);
|
||||||
for (unsigned int i = 0; i < filenames.size(); ++i)
|
for (unsigned int i = 0; i < filenames.size(); ++i)
|
||||||
executor.addFileContent(filenames[i], data );
|
executor.addFileContent(filenames[i], data);
|
||||||
|
|
||||||
ASSERT_EQUALS(result, executor.check());
|
ASSERT_EQUALS(result, executor.check());
|
||||||
}
|
}
|
||||||
|
@ -87,11 +87,11 @@ private:
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "int main()\n"
|
oss << "int main()\n"
|
||||||
<< "{\n";
|
<< "{\n";
|
||||||
for ( int i = 0; i < 500; i++ )
|
for (int i = 0; i < 500; i++)
|
||||||
oss << " {char *a = malloc(10);}\n";
|
oss << " {char *a = malloc(10);}\n";
|
||||||
|
|
||||||
oss << "}\n";
|
oss << "}\n";
|
||||||
check( 2, 3, 3, oss.str() );
|
check(2, 3, 3, oss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void no_errors_more_files()
|
void no_errors_more_files()
|
||||||
|
@ -100,7 +100,7 @@ private:
|
||||||
oss << "int main()\n"
|
oss << "int main()\n"
|
||||||
<< "{\n";
|
<< "{\n";
|
||||||
oss << "}\n";
|
oss << "}\n";
|
||||||
check( 2, 3, 0, oss.str() );
|
check(2, 3, 0, oss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void no_errors_less_files()
|
void no_errors_less_files()
|
||||||
|
@ -109,7 +109,7 @@ private:
|
||||||
oss << "int main()\n"
|
oss << "int main()\n"
|
||||||
<< "{\n";
|
<< "{\n";
|
||||||
oss << "}\n";
|
oss << "}\n";
|
||||||
check( 2, 1, 0, oss.str() );
|
check(2, 1, 0, oss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void no_errors_equal_amount_files()
|
void no_errors_equal_amount_files()
|
||||||
|
@ -118,7 +118,7 @@ private:
|
||||||
oss << "int main()\n"
|
oss << "int main()\n"
|
||||||
<< "{\n";
|
<< "{\n";
|
||||||
oss << "}\n";
|
oss << "}\n";
|
||||||
check( 2, 2, 0, oss.str() );
|
check(2, 2, 0, oss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void one_error_less_files()
|
void one_error_less_files()
|
||||||
|
@ -128,7 +128,7 @@ private:
|
||||||
<< "{\n";
|
<< "{\n";
|
||||||
oss << " {char *a = malloc(10);}\n";
|
oss << " {char *a = malloc(10);}\n";
|
||||||
oss << "}\n";
|
oss << "}\n";
|
||||||
check( 2, 1, 1, oss.str() );
|
check(2, 1, 1, oss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void one_error_several_files()
|
void one_error_several_files()
|
||||||
|
@ -138,7 +138,7 @@ private:
|
||||||
<< "{\n";
|
<< "{\n";
|
||||||
oss << " {char *a = malloc(10);}\n";
|
oss << " {char *a = malloc(10);}\n";
|
||||||
oss << "}\n";
|
oss << "}\n";
|
||||||
check( 2, 20, 20, oss.str());
|
check(2, 20, 20, oss.str());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue