diff --git a/CommonCheck.cpp b/CommonCheck.cpp index 79c190499..1c81afafb 100644 --- a/CommonCheck.cpp +++ b/CommonCheck.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include //--------------------------------------------------------------------------- extern bool CheckCodingStyle; @@ -48,10 +48,10 @@ bool SameFileName( const char fname1[], const char fname2[] ) #ifdef __linux__ return bool( strcmp(fname1, fname2) == 0 ); #endif -#ifdef __BORLANDC__ - return bool( stricmp(fname1, fname2) == 0 ); -#else +#ifdef __GNUC__ return bool( strcasecmp(fname1, fname2) == 0 ); +#else + return bool( stricmp(fname1, fname2) == 0 ); #endif } //--------------------------------------------------------------------------- diff --git a/MiniCppUnit.cpp b/MiniCppUnit.cpp index 0f7d3b497..191a636af 100644 --- a/MiniCppUnit.cpp +++ b/MiniCppUnit.cpp @@ -37,6 +37,16 @@ namespace std } #endif +#ifdef __GNUC__ +#include +namespace std +{ + bool isinf(double x) { + return bool(x == DBL_MAX); + } +} +#endif + TestsListener& TestsListener::theInstance() { static TestsListener instancia; diff --git a/main.cpp b/main.cpp index d1788ce86..7b1f88e85 100644 --- a/main.cpp +++ b/main.cpp @@ -29,15 +29,15 @@ #include #include -#include +#include #include -#ifdef __BORLANDC__ -#include -#else +#ifdef __GNUC__ #include #include +#else +#include #endif //--------------------------------------------------------------------------- @@ -51,16 +51,7 @@ static void CppCheck(const char FileName[], unsigned int FileId); static void AddFiles( std::vector &filenames, const char path[], const char pattern[] ) { - #ifdef __BORLANDC__ - struct ffblk f; - for ( int done = findfirst(pattern, &f, 0); ! done; done = findnext(&f) ) - { - std::ostringstream fname; - fname << path << f.ff_name; - filenames.push_back( fname.str() ); - } - findclose(&f); - #else + #ifdef __GNUC__ glob_t glob_results; glob(pattern, 0, 0, &glob_results); for ( unsigned int i = 0; i < glob_results.gl_pathc; i++ ) @@ -70,6 +61,15 @@ static void AddFiles( std::vector &filenames, const char path[], co filenames.push_back( fname.str() ); } globfree(&glob_results); + #else + struct ffblk f; + for ( int done = findfirst(pattern, &f, 0); ! done; done = findnext(&f) ) + { + std::ostringstream fname; + fname << path << f.ff_name; + filenames.push_back( fname.str() ); + } + findclose(&f); #endif } @@ -79,20 +79,7 @@ static void RecursiveAddFiles( std::vector &filenames, const char p AddFiles( filenames, path, "*.cc" ); AddFiles( filenames, path, "*.c" ); - #ifdef __BORLANDC__ - struct ffblk f ; - for ( int done = findfirst("*", &f, FA_DIREC); ! done; done = findnext(&f) ) - { - if ( f.ff_attrib != FA_DIREC || f.ff_name[0] == '.' ) - continue; - chdir( f.ff_name ); - std::ostringstream curdir; - curdir << path << f.ff_name << "/"; - RecursiveAddFiles( filenames, curdir.str().c_str() ); - chdir( ".." ); - } - findclose(&f); - #else + #ifdef __GNUC__ // gcc / cygwin.. glob_t glob_results; glob("*", GLOB_MARK, 0, &glob_results); @@ -112,6 +99,19 @@ static void RecursiveAddFiles( std::vector &filenames, const char p chdir( ".." ); } globfree(&glob_results); + #else + struct ffblk f ; + for ( int done = findfirst("*", &f, FA_DIREC); ! done; done = findnext(&f) ) + { + if ( f.ff_attrib != FA_DIREC || f.ff_name[0] == '.' ) + continue; + chdir( f.ff_name ); + std::ostringstream curdir; + curdir << path << f.ff_name << "/"; + RecursiveAddFiles( filenames, curdir.str().c_str() ); + chdir( ".." ); + } + findclose(&f); #endif }